[SERVER-57741] SBE should order projection fields ahead of expression fields in a $project stage Created: 16/Jun/21 Updated: 29/Oct/23 Resolved: 29/Jun/21 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 5.1.0-rc0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Arun Banala | Assignee: | Mohammad Dashti (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | sbe-diff, sbe-post-v1, sbe-rollout | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||
| Backwards Compatibility: | Minor Change | ||||||||||||||||||||||||||||||||
| Operating System: | ALL | ||||||||||||||||||||||||||||||||
| Sprint: | Query Execution 2021-06-28, Query Execution 2021-07-12 | ||||||||||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||||||||||
| Linked BF Score: | 148 | ||||||||||||||||||||||||||||||||
| Description |
|
The behavior of $project in the classic engine is to order projection fields ahead of fields which require expression evaluation. SBE engine doesn't seemed to follow this convention, which is producing failures on the aggregation fuzzers. We should fix the behavior to match that of classic engine. |
| Comments |
| Comment by Vivian Ge (Inactive) [ 06/Oct/21 ] |
|
Updating the fixversion since branching activities occurred yesterday. This ticket will be in rc0 when it’s been triggered. For more active release information, please keep an eye on #server-release. Thank you! |
| Comment by Githook User [ 29/Jun/21 ] |
|
Author: {'name': 'Mohammad Dashti', 'email': 'mdashti@gmail.com', 'username': 'mdashti'}Message: |
| Comment by Arun Banala [ 22/Jun/21 ] |
|
mohammad.dashti That's the current behaviour in the classic engine. The projected fields are ordered first and in the order in which they appear in the underlying documents. Then the expression fields (the new fields to be added) are ordered in the way they appear in the specification. |
| Comment by Mohammad Dashti (Inactive) [ 22/Jun/21 ] |
This is a good question for arun.banala, regarding the expected behaviour for this issue, but your example is exactly how it's done in |
| Comment by Ethan Zhang (Inactive) [ 22/Jun/21 ] |
|
So if I have a document {a: 1, b: 2, c: 3}and do db.coll.find({}, {_id: 0, c: 1, b: 1, a: {$add: ["$a", 1]}}), the returning document should have a field order of b, c, a (still preserving the order of projection fields)? |
| Comment by Ethan Zhang (Inactive) [ 20/Jun/21 ] |
|
We will talk about this in this week's Triage meeting. |
| Comment by Ethan Zhang (Inactive) [ 16/Jun/21 ] |
|
This can address one of the issues that mohammad.dashti found in |