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

Constant Nothing in $group's _id expression should be converted to null in $group SBE stage builder

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 6.0.1, 6.1.0-rc0
    • Affects Version/s: 5.3.2, 6.0.0
    • Component/s: None
    • Labels:
      None
    • Fully Compatible
    • ALL
    • v6.0
    • QE 2022-08-08
    • 135

      > db.a.insert({_id: 1});
      > db.a.explain().aggregate([{$group: {_id: "$$REMOVE", o: {$first: "$a"}}}]).queryPlanner.winningPlan.slotBasedPlan.stages;
      [2] mkbson s9 [_id = s6, o = s8] true false
      [2] group [s6] [s8 = first (fillEmpty (s7, null))]
      [2] project [s7 = getField (s4, "a")]
      [2] project [s6 = Nothing]
      [1] scan s4 s5 none none none none [] @"39336b7b-b5b8-4328-8ae6-e5a7e9ce31ae" true false
      

      project [s6 = Nothing] should be project [s6 = fillEmpty (Nothing, null)]. We can't do project [s6 = null] because EConstant does not have a method to examine its value.

      This is a bug in $group SBE stage builder and so backport to v6.0 is necessary.

            Assignee:
            yoonsoo.kim@mongodb.com Yoon Soo Kim
            Reporter:
            yoonsoo.kim@mongodb.com Yoon Soo Kim
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: