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

$group with $avg in $lookup inner pipeline fails

    • Type: Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • ALL
    • QE 2021-11-29

      jstests/sharding/query/sharded_lookup_execution.js fails with an assertion in src/mongo/db/pipeline/accumulator_avg.cpp:62 executing this pipeline (see "assertLookupExecution(pipeline, {comment: "unsharded_to_sharded_cache"}" at sharded_lookup_execution.js:632):
      [[ {"$match" : {"customer" : "Alice"}}, {"$unwind" : "$products"}, { "$lookup" : { "from" : "reviews", "let" :

      {"customer_product_name" : "$products._id"}

      , "pipeline" : [ { "$group" : { "_id" : "$product_id", "avg_stars" :

      { "$avg" : "$stars" }

      , "name" : { "$first" : "$product_id" } } }, {"$match" : {"$expr" :

      {"$eq" : ["$name","$$customer_product_name"]}

      }} ], "as" : "avg_review" } }, {"$unwind" : {"path" : "$avg_review", "preserveNullAndEmptyArrays" : true}}, {"$group" : {"_id" : "$_id", "products" : {"$push" : {"_id" : "$products._id","avg_review" : "$avg_review.avg_stars"}}}}]
       

      The patch: https://spruce.mongodb.com/version/61956b90e3c3316cd49b37a4/tasks?sorts=STATUS%3AASC%3BBASE_STATUS%3ADESC

      Log for this failure:

      https://logkeeper.mongodb.org/lobster/build/1d8dc05c673604aecbc4cec148ef4f4f/test/619577cc54f24805af62463d#bookmarks=0%2C25189&l=1&shareLine=22315

            Assignee:
            yoonsoo.kim@mongodb.com Yoon Soo Kim
            Reporter:
            eric.cox@mongodb.com Eric Cox (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: