Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-54750

[SBE] Rename cmp3w VM instruction and inspect usages in the SBE codebase

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
    • 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.

            Assignee:
            backlog-query-execution [DO NOT USE] Backlog - Query Execution
            Reporter:
            nikita.lapkov@mongodb.com Nikita Lapkov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: