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

Always fold the input of valueBlockLogicalAnd and all arguments of methods that use a bitmap

    • Type: Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Execution
    • ALL
    • QE 2024-03-18, QE 2024-04-01

      It is possible to get wrong results if we do not fold the arguments of a valueBlockLogicalAnd when the input data has arrays.

      Consider for example the arrays A1 : [true, false] and A2 : [false, true] . The arrays are for the same document but another predicate has been evaluated for each one.

      If we first run AND and then FOLD we get  [false, false] -> false, i.e. the document does not qualify

      If we first FOLD and then run AND we get true AND true -> true , i.e. the document does qualify

       

      Additionally, all methods that take a bitmap as an argument should fold all other inputs to make them comparable.

      Example: {$match:{ "a.x" : {$lt: 10} } }, {$match: {$expr: {$map: { "input": "$a", "as": "arr", "in": {$add: ["$$arr.x", 10]} } } } }

      {$match:{ "a.x" : {$lt: 10} } } will return a a bitmap on the measures.

      {$match: {$expr: {$map: { "input": "$a", "as": "arr", "in": {$add: ["$$arr.x", 10]} } } } } if we don't fold it will use a bitmap on the measures and a block on the elements.

            Assignee:
            foteini.alvanaki@mongodb.com Foteini Alvanaki
            Reporter:
            foteini.alvanaki@mongodb.com Foteini Alvanaki
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: