[SERVER-82368] Match top/bottom N accumulators in SBE and Classic Created: 23/Oct/23 Updated: 20/Nov/23 Resolved: 31/Oct/23 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 7.2.0-rc0, 7.0.5, 6.0.13 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Ivan Fefer | Assignee: | Ivan Fefer |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | bkp | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||||||||||
| Issue Links: |
|
||||||||||||||||
| Assigned Teams: |
Query Execution
|
||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||
| Operating System: | ALL | ||||||||||||||||
| Backport Requested: |
v7.0, v6.0
|
||||||||||||||||
| Sprint: | QE 2023-10-30, QE 2023-11-13 | ||||||||||||||||
| Participants: | |||||||||||||||||
| Linked BF Score: | 130 | ||||||||||||||||
| Description |
|
Currently in Classic, $bottom accumulator will compare arrays element-by-element, which is natural, but contradicts our documentation: https://www.mongodb.com/docs/manual/reference/bson-type-comparison-order/#arrays
SBE will follow the docs. This is because in Classic, accumulator wraps sort keys in array and sort key generator considers the array being nested, so it returns it fully in a sort key. SBE accepts document fully as-is, so the array is not nested, so only one element is returned as a sort key. Reproduction script is attached. |
| Comments |
| Comment by Githook User [ 20/Nov/23 ] |
|
Author: {'name': 'Ivan Fefer', 'email': 'ivan.fefer@mongodb.com', 'username': 'Fefer-Ivan'}Message: |
| Comment by Githook User [ 20/Nov/23 ] |
|
Author: {'name': 'Ivan Fefer', 'email': 'ivan.fefer@mongodb.com', 'username': 'Fefer-Ivan'}Message: |
| Comment by Githook User [ 31/Oct/23 ] |
|
Author: {'name': 'Ivan Fefer', 'email': 'ivan.fefer@mongodb.com', 'username': 'Fefer-Ivan'}Message: |
| Comment by Ivan Fefer [ 27/Oct/23 ] |
|
The classic implementation affected array comparison by mistake, so we are going to match SBE and Classic and documentation altogether. |