Details
Description
In PipelineD::prepareExecutor, we are sometimes pushing down a computed projection past a sort+limit. This is incorrect because the projection can raise an error when it sees documents that the sort+limit would not return.
We should change buildProjectionForPushdown so that it never returns a computed projection:
/**
|
* Given a dependency set and a pipeline, builds a projection BSON object to push down into the
|
* PlanStage layer. The rules to push down the projection are as follows:
|
* 1. If there is an inclusion projection at the front of the pipeline, it will be pushed down
|
* as is.
|
* 2. If there is no inclusion projection at the front of the pipeline, but there is a finite
|
* dependency set, a projection representing this dependency set will be pushed down.
|
* 3. Otherwise, an empty projection is returned and no projection push down will happen.
|
*/
|
auto buildProjectionForPushdown(const DepsTracker& deps, Pipeline* pipeline) {
|
Computed projections should be ineligible for case 1. For example, if the pipeline starts with {$project: {b: {$round: "$a"}}}, we'll fall through to case 2 and push down {a: 1}, based on the dependencies.
Attachments
Issue Links
- related to
-
SERVER-54768 Sort/project re-ordering is inconsistent between find() and aggregation
-
- Backlog
-