A $group can prevent $lu SBE pushdown in some pipelines

    • Type: Task
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Execution
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      In the following repro a $group + $match + $lu pipeline should have been completely pushed down to SBE. But the $lu part of the pipeline stays in classic, even with all the required feature flags set.

      const books = db.group_match_lu_repro_books;
      const editions = db.group_match_lu_repro_editions;
      
      books.drop();
      editions.drop();
      
      books.insertMany([
          {_id: 0, title: "The C++ Programming Language", edition: "premium"},
          {_id: 1, title: "Programming: Principles and Practice", edition: "premium"},
          {_id: 2, title: "The C Programming Language", edition: "standard"},
          {_id: 3, title: "Object-Oriented Analysis and Design", edition: "standard"},
      ]);
      books.createIndex({edition: 1});
      
      editions.insertMany([
          {edition: "premium", format: "hardcover"},
          {edition: "premium", format: "deluxe"},
          {edition: "standard", format: "paperback"},
          {edition: "standard", format: "ebook"},
      ]);
      editions.createIndex({edition: 1});
      
      const pipeline = [
          {
              $group: {
                  _id: "$edition",
                  title: {$push: "$title"},
                  edition: {$first: "$edition"},
              },
          },
          {$match: {edition: {$in: ["standard", "premium"]}}},
          {
              $lookup: {
                  from: editions.getName(),
                  localField: "edition",
                  foreignField: "edition",
                  as: "edition",
              },
          },
          {$unwind: "$edition"},
      ];
      
      books.explain().aggregate(pipeline);
      

            Assignee:
            Unassigned
            Reporter:
            Felipe Goron Farinon
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: