-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Query Execution
SBE VM has two types of comparison instructions:
- less, lessEq, greater, greaterEq, eq, neq implemented using genericCompare function. These instructions compare values using MQL semantics.
- cmp3w implemented using value::compareValue function. This instructions performs 3-way comparison (spaceship operator), but does not follow MQL semantics. The behaviour of this instruction is closer to SQL comparison semantics.
Having two kinds of instructions is intentional because we want to keep SBE VM generic to be extendable and (possibly) execute non-MQL queries in the future. But it can be misleading for the developer since cmp3w and other comparison instructions are not interchangeable. We should rename cmp3w to make it clear that this instruction does not implement MQL semantics. We should also add documentation to the respective places and expect all usages of cmp3w in the SBE codebase for correctness purposes.
It seems that they are certain types supported by value::compareValue and not supported by genericCompare. We should also fix this in the scope of this ticket.
- is related to
-
SERVER-55029 Investigate correctness of comparison semantics in SBE
- Backlog