Initialize $add with no operands to zero when translating to SBE

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 5.3.0, 5.2.1
    • Affects Version/s: None
    • Component/s: None
    • Fully Compatible
    • ALL
    • v5.2, v5.1
    • Hide
      db.c.insert({_id: 0, x: 1})
      db.c.aggregate([{$project: {z: {$add: []}}}])
      Show
      db.c.insert({_id: 0, x: 1}) db.c.aggregate([{$project: {z: {$add: []}}}])
    • QE 2022-02-07
    • 191
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      This was flagged by the agg optimization fuzzer and I was able to boil down the failing pipeline to just an $add with no args [].

      The classic engine returns 0 as an int in this case so this fix will do the same during sbe translation of $add.

              Assignee:
              Eric Cox (Inactive)
              Reporter:
              Eric Cox (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: