[SBE] SizeMatchExpression can produce wrong results in some cases involving nesting

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 4.9.0
    • Affects Version/s: None
    • Component/s: Querying
    • Fully Compatible
    • ALL
    • Hide
      > db.coll.insert({a: 1, b: "foo"})
      > db.coll.insert({a: 1, b: [7,8,9]})
      > db.coll.find({}, {_id: 0})
      { "a" : 1, "b" : "foo" }
      { "a" : 1, "b" : [ 7, 8, 9 ] }
      > db.adminCommand({setParameter:1, internalQueryEnableSlotBasedExecutionEngine:false})
      > db.coll.find({$or: [{$and: [{b: {$size: 3}}, {a: 1}]}, {a: 0}]}, {_id: 0})
      { "a" : 1, "b" : [ 7, 8, 9 ] }
      > db.adminCommand({setParameter:1, internalQueryEnableSlotBasedExecutionEngine:true})
      > db.coll.find({$or: [{$and: [{b: {$size: 3}}, {a: 1}]}, {a: 0}]}, {_id: 0})
      { "a" : 1, "b" : "foo" }
      { "a" : 1, "b" : [ 7, 8, 9 ] }
      Show
      > db.coll.insert({a: 1, b: "foo"}) > db.coll.insert({a: 1, b: [7,8,9]}) > db.coll.find({}, {_id: 0}) { "a" : 1, "b" : "foo" } { "a" : 1, "b" : [ 7, 8, 9 ] } > db.adminCommand({setParameter:1, internalQueryEnableSlotBasedExecutionEngine:false}) > db.coll.find({$or: [{$and: [{b: {$size: 3}}, {a: 1}]}, {a: 0}]}, {_id: 0}) { "a" : 1, "b" : [ 7, 8, 9 ] } > db.adminCommand({setParameter:1, internalQueryEnableSlotBasedExecutionEngine:true}) > db.coll.find({$or: [{$and: [{b: {$size: 3}}, {a: 1}]}, {a: 0}]}, {_id: 0}) { "a" : 1, "b" : "foo" } { "a" : 1, "b" : [ 7, 8, 9 ] }
    • Query 2020-11-16
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      See the "Steps to Reproduce" section for an example where using the $size operator in the find() command can produce incorrect results when SBE mode is enabled.

            Assignee:
            Melodee Li
            Reporter:
            Drew Paroski
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: