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

Resolve inconsistency in ABT and SBE assumptions for duplicate predicates in $or

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.3.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Fully Compatible
    • ALL
    • v7.2, v7.1, v7.0
    • Hide

      Failing Test: jstests/query_golden/match_with_and_or.js

      • When we run a $or find query over two duplicate predicates with parameterization, no results are getting returned

      Failing Query:

      {{[{"$match":{"

      $or":[

      {"a":1}

      ,{"a":1}

      ] }}]}}

      Show
      Failing Test: jstests/query_golden/match_with_and_or.js When we run a $or find query over two duplicate predicates with parameterization, no results are getting returned Failing Query: {{[{"$match":{" $or":[ {"a":1} ,{"a":1} ] }}]}}
    • QO 2023-11-13, QO 2023-11-27, QO 2023-12-11

      If there are predicates over the same path in $or, they are translated into $in during match expression optimization. It also provides deduplication, so for the query above, we'd get a.b $in [ 1.0 ].

      Currently, ABT translation and optimization transforms a singleton $in array into an Operations::Eq and extracts the value from the array. However, parameter binding in SBE stores all $in arrays as inListData (regardless of the size), and expects to use isMember to perform matching. We cannot compare an integer in a query predicate to an InListData member containing that element, so no matches are returned in the above case.

      Proposed Fix: In Bonsai, bind a single value when parameterizing $in’s with singleton lists in bind_input_params.

            Assignee:
            lynne.wang@mongodb.com Lynne Wang
            Reporter:
            lynne.wang@mongodb.com Lynne Wang
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: