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

Fix ABT translation for match expressions which compare against array values

    • Type: Icon: Bug Bug
    • Resolution: Won't Do
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • ALL
    • QO 2022-01-10, QO 2022-01-24, QO 2022-02-07

      Current ABTs for $eq, $exists, $in, and $type can fail when matching against arrays.

      For example {$match: {a: {$eq: ["abc"]}}} should match both {a: ["abc"]} and {a: [["abc"]]}, though it currently only matches the latter. This is because in the first case PathTraverse will perform comparisons on the array elements (that is, "abc") but not the top-level array. In SBE the solution seems to be to detect when a comparison against a top-level array is necessary, and specifically compare against it in addition to the comparison done by the traverse.

       I think it should be fixed during translation to ABT (as opposed to path lowering, or somewhere else), otherwise either 1) the ABTs produced by translation would be semantically incorrect until lowering or 2) the PathTraverse operator would have a different meaning within an ABT than "traverse" does in an SBE plan.

            Assignee:
            hana.pearlman@mongodb.com Hana Pearlman
            Reporter:
            hana.pearlman@mongodb.com Hana Pearlman
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: