[SERVER-77301] rewriteGroupByMinMax in timeseries doesn't respect collation Created: 18/May/23 Updated: 29/Oct/23 Resolved: 30/May/23 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 7.1.0-rc0, 6.0.7, 7.0.0-rc4 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Irina Yatsenko (Inactive) | Assignee: | Irina Yatsenko (Inactive) |
| 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: |
v7.0, v6.0, v5.0
|
||||
| Steps To Reproduce: | db.createCollection("ts", {timeseries: {timeField: 'time', metaField: 'meta'}, collation: {locale: "en", numericOrdering: true}}) ts.insertMany([\{time: ISODate(), meta: 1, value: "10"}, \{time: ISODate(), meta: 1, value: "5"}]) db.ts.explain().aggregate([\{$group: {_id: "$meta", m: {$max: "$value"}}}], {collation: {locale: 'en', numericOrdering: false}}) the query returns wrong result of {_id: 1, m: "10" } instead of {_id: 1, m: "5" } which is the max in lexicographic order. |
||||
| Sprint: | QI 2023-05-29, QI 2023-06-12 | ||||
| Participants: | |||||
| Description |
|
The rewrite of group with min/max accumulators takes advantage of the min/max being stored for each bucket so it can completely avoid unpacking if the group id is such that it would include whole buckets into each group (currently we do the rewrite only for group by meta field). However, buckets' min/max are computed using the collection's collation and they shouldn't be used if the query specifies a different collation. |
| Comments |
| Comment by Githook User [ 13/Jun/23 ] |
|
Author: {'name': 'Irina Yatsenko', 'email': 'irina.yatsenko@mongodb.com', 'username': 'IrinaYatsenko'}Message: |
| Comment by Githook User [ 07/Jun/23 ] |
|
Author: {'name': 'Irina Yatsenko', 'email': 'irina.yatsenko@mongodb.com', 'username': 'IrinaYatsenko'}Message: |
| Comment by Githook User [ 24/May/23 ] |
|
Author: {'name': 'Irina Yatsenko', 'email': 'irina.yatsenko@mongodb.com', 'username': 'IrinaYatsenko'}Message: |