Ensure $or -> $in optimization parity

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Fixed
    • Priority: Major - P3
    • 7.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Query Optimization
    • Fully Compatible
    • QO 2022-03-07
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      During pipeline optimization, we currently rewrite a $or with equality conditions on the same path into a $in. That is:

      {$or: [{a: 1}, {a: 2}]}

      becomes

      {a: {$in: [1, 2]}}.

      There is also support to rewrite part of a $or as follows:

      {$or: [{a: 1}, {a: 2}, {b: 3}]} 

      becomes

      {$or: [{a: {$in: [1, 2]}}, {b: 3}].

      The first part of the optimization (replacing an entire $or with an $in) is supported by the new optimizer in the logical rewrites phase. The second part is not yet supported by the new optimizer. Eventually, when we don't run pipeline optimization before we hit the new optimizer, we'll need to support this behavior in the new optimizer.

              Assignee:
              Hana Pearlman
              Reporter:
              Hana Pearlman
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: