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

SBE hash intersection can miss documents

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Query Execution
    • ALL
    • Hide
      const coll = db.coll;
      coll.drop()
      assert.commandWorked(db.adminCommand({
          setParameter: 1,
          internalQueryForceIntersectionPlans: 1,
          internalQueryPlannerEnableHashIntersection: 1,
          internalQueryFrameworkControl: 'trySbeEngine'
      }));
      assert.commandWorked(coll.insert({
          _id: 0,
          a: 0
      }))
      
      const query = [
          {
              $match: {
                  a: {$exists: true},
                  _id: {$exists: true},
                  $or: [{a: 0}, {a: {$ne: 1}}]
              }
          },
          {$sort: {a: 1}}
      ];
      jsTestLog(coll.aggregate(query).toArray())
      // 1 document, the correct result
      assert.commandWorked(coll.createIndex({_id: 1, a: 1}))
      jsTestLog(coll.aggregate(query).toArray())
      // Hashed intersection plan - No results
      
      Show
      const coll = db.coll; coll.drop() assert .commandWorked(db.adminCommand({ setParameter: 1, internalQueryForceIntersectionPlans: 1, internalQueryPlannerEnableHashIntersection: 1, internalQueryFrameworkControl: 'trySbeEngine' })); assert .commandWorked(coll.insert({ _id: 0, a: 0 })) const query = [ { $match: { a: {$exists: true }, _id: {$exists: true }, $or: [{a: 0}, {a: {$ne: 1}}] } }, {$sort: {a: 1}} ]; jsTestLog(coll.aggregate(query).toArray()) // 1 document, the correct result assert .commandWorked(coll.createIndex({_id: 1, a: 1})) jsTestLog(coll.aggregate(query).toArray()) // Hashed intersection plan - No results
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      With internalQueryPlannerEnableHashIntersection=1, internalQueryForceIntersectionPlans=1, and internalQueryFrameworkControl=trySbeEngine, the repro below shows that an SBE hash intersection plan can miss documents.

            Assignee:
            Unassigned Unassigned
            Reporter:
            matt.boros@mongodb.com Matt Boros
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: