[SERVER-27195] Symbol BSON type compares incorrectly with String when the collation is non-simple Created: 28/Nov/16 Updated: 11/Oct/23 |
|
| Status: | Backlog |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | 3.4.0-rc5 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Critical - P2 |
| Reporter: | David Storch | Assignee: | Backlog - Query Execution |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | 34errata, query-44-grooming | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||
| Assigned Teams: |
Query Execution
|
||||||||||||||||||||
| Backport Requested: |
v3.4
|
||||||||||||||||||||
| Participants: | |||||||||||||||||||||
| Description |
|
The original design for the collation feature specified that collation-aware string comparison would only apply to BSONType::String. However, in all existing versions, String and Symbol have been considered the same canonical type, meaning that String "a" == Symbol "a", String "a" < Symbol "b" and Symbol "a" < String "b". As currently implemented, we only translate String (not Symbol) to the corresponding ICU comparison key. Therefore, translated String comparison keys will be compared directly to raw, untranslated Symbols in indexes with a collation. Such indexes are broken. Furthermore, comparisons between Symbol and String may not have a total order, since we only use the collator in the comparison if String is on the left-hand side. There may also be places in the query planner which are incorrect if the query involves the combination of Symbol and Collation. |
| Comments |
| Comment by Mathias Stearn [ 28/Nov/16 ] |
|
Fixing this requires an on-disk change that will be incompatible with existing v:2 indexes (3.3/3.4-rc only) since we will need to generate different index keys for some input documents. |