`internalQueryPlannerPushdownFilterToIxscanForSort` can cause tassert for $or queries

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Query Execution
    • ALL
    • Hide
      // When off, no tassert is thrown. When on, tassert is thrown.
      db.adminCommand({setParameter: 1, internalQueryPlannerPushdownFilterToIxscanForSort: true});
      
      const coll = db.match_expr_repro;
      coll.drop();
      coll.insert({});
      coll.createIndex({"a.b": 1, c: 1});
      
      const pipeline = [
          {$match: {$expr: {$or: [{$eq: ["$c", 0]}, {$eq: ["$a.b", 0]}]}}},
          {$sort: {"a.b": 1}},
          {$group: {_id: null}},
      ];
      
      printjson(coll.aggregate(pipeline).toArray());
      // tassert 6929401
      
      Show
      // When off, no tassert is thrown. When on, tassert is thrown. db.adminCommand({setParameter: 1, internalQueryPlannerPushdownFilterToIxscanForSort: true }); const coll = db.match_expr_repro; coll.drop(); coll.insert({}); coll.createIndex({ "a.b" : 1, c: 1}); const pipeline = [ {$match: {$expr: {$or: [{$eq: [ "$c" , 0]}, {$eq: [ "$a.b" , 0]}]}}}, {$sort: { "a.b" : 1}}, {$group: {_id: null }}, ]; printjson(coll.aggregate(pipeline).toArray()); // tassert 6929401
    • QE 2026-05-25
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      I haven't had time to investigate this, but it seems related to SERVER-103601. I wrote a new PBT for $expr and it caught this

            Assignee:
            Catalin Sumanaru
            Reporter:
            Matt Boros
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: