[Join Optimization] Fallback on queries with numeric field paths

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Optimization
    • ALL
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      This following query currently hits a tassert in NDV estimation.

      db.localColl.drop();
      db.foreignColl.drop();
      
      db.adminCommand({setParameter: 1, internalEnableJoinOptimization: true});
      
      db.localColl.insertMany([
        { _id: 1, foo: [10, 20], localPayload: "L1" },
        { _id: 2, foo: [30, 40], localPayload: "L2" },
        { _id: 3, foo: [50, 60], localPayload: "L3" }
      ]);
      db.foreignColl.insertMany([
        { _id: "a", bar: [10, 99], foreignPayload: "F1" },
        { _id: "b", bar: [30, 88], foreignPayload: "F2" },
        { _id: "c", bar: [70, 77], foreignPayload: "F3" }
      ]);
      
      db.localColl.createIndex({ "foo.0": 1 });
      db.foreignColl.createIndex({ "bar.0": 1 });
      
      const pipeline = [
        {
          $lookup: {
            from: "foreignColl",
            localField: "foo.0",
            foreignField: "bar.0",
            as: "joined"
          }
        },
        { $unwind: "$joined" }
      ];
      db.localColl.aggregate(pipeline).forEach(doc => printjson(doc)); 

      This may be done as part of SERVER-113718 depending on the implementation. We certainly need test cases for it.

            Assignee:
            Unassigned
            Reporter:
            Ben Shteinfeld
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: