Commit 506ec0e
Dylan Bobby Storey
fix(transform): WITH detects nested aggregates for implicit GROUP BY
Companion to the iter-33 transform_return.c fix. The WITH clause has
its own aggregate-detection at line ~419 that only set has_aggregate
when the projection item's TOP-LEVEL expression was a function call.
Aggregates buried in binary ops, list/map literals, or subscripts
were missed.
Symptom (With6 [6]):
MATCH ... WITH me.age AS age, you
WITH age, age + count(you.age) AS agg
RETURN *
-- Empty-input result was 1 all-null row (no GROUP BY → ungrouped agg).
-- Spec: 0 rows.
Two changes:
1. Extended find_aggregating_call() to walk MAP and SUBSCRIPT nodes
in addition to FUNCTION_CALL/BINARY_OP/NOT/PROPERTY/NULL_CHECK/LIST.
2. The else-branch (BINARY_OP / map / etc.) now calls
find_aggregating_call() after the projection emits and sets
has_aggregate = true if any aggregate is found nested inside —
this triggers the existing GROUP BY emission on the non-aggregate
columns.
TCK delta: pass=3456 -> 3458 (+2), fails -2. With6 [6]/[7].
944/944 unit, functional clean.1 parent 22197bd commit 506ec0e
1 file changed
Lines changed: 24 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
80 | 96 | | |
81 | 97 | | |
82 | 98 | | |
| |||
464 | 480 | | |
465 | 481 | | |
466 | 482 | | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
467 | 491 | | |
468 | 492 | | |
469 | 493 | | |
| |||
0 commit comments