[SERVER-54750] [SBE] Rename cmp3w VM instruction and inspect usages in the SBE codebase Created: 24/Feb/21  Updated: 06/Dec/22

Status: Backlog
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Nikita Lapkov (Inactive) Assignee: Backlog - Query Execution
Resolution: Unresolved Votes: 0
Labels: sbe-post-v1
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-55029 Investigate correctness of comparison... Backlog
Assigned Teams:
Query Execution
Participants:

 Description   

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.


Generated at Thu Feb 08 05:34:22 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.