-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
Fully Compatible
-
ALL
-
QE 2021-09-20, QE 2021-10-04
The following tree is generated
[3] mkbson s13 [_id = s6, x = s12, y = s9] true false [3] project [s12 = if (! exists (s9) || typeMatch (s9, 0x00000440), null, doubleDoubleSumFinalize (s8) / s9)] [3] group [s6] [s8 = aggDoubleDoubleSum (s7), s9 = sum (let [l1.0 = s7] if (! exists (l1.0) || typeMatch (l1.0, 0x00000440) || ! isNumber (l1.0), Nothing, 1)), s11 = addToSet (s10)] [3] project [s10 = getField (s5, "b")] [3] project [s7 = getField (s5, "b")] [3] project [s6 = null] [2] mkbson s5 s3 [b] keep [] true false [1] scan s3 s4 none none none none [] @\"a83a82a5-a6d9-40fb-99e7-07e73544fb48\" true false "
The following tree SHOULD be generated
[3] mkbson s13 [_id = s6, x = s12, y = s11] true false [3] project [s12 = if (! exists (s9) || typeMatch (s9, 0x00000440), null, doubleDoubleSumFinalize (s8) / s9)] [3] group [s6] [s8 = aggDoubleDoubleSum (s7), s9 = sum (let [l1.0 = s7] if (! exists (l1.0) || typeMatch (l1.0, 0x00000440) || ! isNumber (l1.0), Nothing, 1)), s11 = addToSet (s10)] [3] project [s10 = getField (s5, "b")] [3] project [s7 = getField (s5, "b")] [3] project [s6 = null] [2] mkbson s5 s3 [b] keep [] true false [1] scan s3 s4 none none none none [] @\"a83a82a5-a6d9-40fb-99e7-07e73544fb48\" true false "
This issue happens when the first accumulator generates multiple expressions and the second accumulator skips the finalization step.
Found an incompatibility with the classic engine. Here's a repro.
const tc = db.getCollection("testColl"); tc.insert({a: 1}); tc.aggregate([{$group: {_id: "$item", x: {$count: {}}}}]).toArray(); [ { "_id" : null, "x" : 1 } ] db.adminCommand({setParameter: 1, internalQueryEnableSlotBasedExecutionEngine: true}); tc.aggregate([{$group: {_id: "$item", x: {$count: {}}}}]).toArray(); [ { "x" : 1 } ]
- is depended on by
-
SERVER-59889 Add compatibility tests for $group pushdown behavior
- Closed