[SERVER-71270] Time series optimization pushes $match on timeField before $project stage that removes the field from pipeline Created: 10/Nov/22 Updated: 29/Oct/23 Resolved: 16/Nov/22 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 6.2.0-rc2, 6.3.0-rc0, 6.0.7 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Davis Haupt (Inactive) | Assignee: | Ivan Fefer |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
|||||||||||||||||||||||
| Backwards Compatibility: | Fully Compatible | |||||||||||||||||||||||
| Operating System: | ALL | |||||||||||||||||||||||
| Backport Requested: |
v6.2, v6.0
|
|||||||||||||||||||||||
| Steps To Reproduce: |
|
|||||||||||||||||||||||
| Sprint: | QO 2022-11-14, QE 2022-11-28 | |||||||||||||||||||||||
| Participants: | ||||||||||||||||||||||||
| Linked BF Score: | 135 | |||||||||||||||||||||||
| Description |
|
With the query:
The optimized plan looks like:
It appears as if the $match is getting pushed before the $project. The $cursor stage fetches the matching documents, and then the $_internalUnpackBucket excludes the time field, which represents the $project. For this query to be correct, a $match should not be pushed before a $project if the $project modifies a field included in the $match. |
| Comments |
| Comment by Githook User [ 08/Jun/23 ] |
|
Author: {'name': 'Ivan Fefer', 'email': 'ivan.fefer@mongodb.com', 'username': 'Fefer-Ivan'}Message: (cherry picked from commit e332ea00d872740058898541277bf6547774be90) |
| Comment by Githook User [ 23/Nov/22 ] |
|
Author: {'name': 'Ivan Fefer', 'email': 'ivan.fefer@mongodb.com', 'username': 'Fefer-Ivan'}Message: |
| Comment by Ivan Fefer [ 16/Nov/22 ] |
|
We will need to backport it to 6.2.0 |
| Comment by Githook User [ 16/Nov/22 ] |
|
Author: {'name': 'Ivan Fefer', 'email': 'ivan.fefer@mongodb.com', 'username': 'Fefer-Ivan'}Message: |
| Comment by Davis Haupt (Inactive) [ 11/Nov/22 ] |
|
Since this is related to |
| Comment by Davis Haupt (Inactive) [ 11/Nov/22 ] |
|
Seems likely to have been caused by |