[SERVER-77183] $project followed by $group gives incorrect results sometimes Created: 16/May/23 Updated: 29/Oct/23 Resolved: 14/Jul/23 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | 6.0.5 |
| Fix Version/s: | 7.1.0-rc0, 7.0.1, 6.0.10 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Oleksandr Poliakov | Assignee: | Rui Liu |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||
| Assigned Teams: |
Query Execution
|
||||||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||||||
| Operating System: | ALL | ||||||||||||||||||||
| Backport Requested: |
v7.0, v6.0
|
||||||||||||||||||||
| Steps To Reproduce: |
|
||||||||||||||||||||
| Sprint: | QO 2023-06-12, QE 2023-07-24 | ||||||||||||||||||||
| Participants: | |||||||||||||||||||||
| Description |
|
See steps to reproduce. In the steps below we expected both aggregation pipelines return the same results. In server version before v6 it was working as expected. The problem seems to started with v6 (we tested 6.0.2 and 6.0.5 versions). The difference between two aggregation pipelines is that in the first case we project using A : "$A" and in the second we project using A : 1. We expect them to be equivalent. |
| Comments |
| Comment by Githook User [ 22/Aug/23 ] | |||||||||||||||||||||||||||||||||
|
Author: {'name': 'Peter Volk', 'email': 'peter.volk@mongodb.com', 'username': 'HCSPete'}Message: | |||||||||||||||||||||||||||||||||
| Comment by Githook User [ 21/Aug/23 ] | |||||||||||||||||||||||||||||||||
|
Author: {'name': 'Rui Liu', 'email': 'lriuui0x0@gmail.com', 'username': 'lriuui0x0'}Message: (cherry picked from commit 107f24c1bf0c8f7041978b2dfb718bb6694e0ba5) | |||||||||||||||||||||||||||||||||
| Comment by Kyle Suarez [ 18/Aug/23 ] | |||||||||||||||||||||||||||||||||
|
Requesting backports to 6.0 and 7.0 given the affects version is 6.0.5. | |||||||||||||||||||||||||||||||||
| Comment by Githook User [ 14/Jul/23 ] | |||||||||||||||||||||||||||||||||
|
Author: {'name': 'Rui Liu', 'email': 'lriuui0x0@gmail.com', 'username': 'lriuui0x0'}Message: | |||||||||||||||||||||||||||||||||
| Comment by Rushan Chen [ 04/Jul/23 ] | |||||||||||||||||||||||||||||||||
|
Background: project seems to be lost and we should make sure SBE group push down didn't cause this. SBE Group pushdown is owned by QE. | |||||||||||||||||||||||||||||||||
| Comment by Projjal Chanda [ 03/Jul/23 ] | |||||||||||||||||||||||||||||||||
|
anton.korshunov@mongodb.com . This looks like a QO issue. The query plan for the second query is wrong as the projection stage is missing. | |||||||||||||||||||||||||||||||||
| Comment by Anton Korshunov [ 20/Jun/23 ] | |||||||||||||||||||||||||||||||||
|
Sending to QE for investigation as the plan is executed with the SBE engine in v6.0. | |||||||||||||||||||||||||||||||||
| Comment by James Kovacs [ 16/May/23 ] | |||||||||||||||||||||||||||||||||
|
Looking at the explain plans for the two queries:
Notice how GROUP takes a PROJECTION_DEFAULT as its input. Now compare that to…
The GROUP takes a COLLSCAN as input disregarding the $project entirely. |