Skip to content

with: computed (non-aggregate) WITH key is now a GROUP BY key (+2 TCK)#92

Merged
dylanbstorey merged 1 commit into
mainfrom
i0049-groupby-expr
Jun 3, 2026
Merged

with: computed (non-aggregate) WITH key is now a GROUP BY key (+2 TCK)#92
dylanbstorey merged 1 commit into
mainfrom
i0049-groupby-expr

Conversation

@dylanbstorey

Copy link
Copy Markdown
Contributor

Summary

WITH a.num2 % 3 AS mod, sum(a.num + a.num2) AS sum collapsed all rows into a single group — the implicit GROUP BY omitted the computed key a.num2 % 3.

The catch-all expression-projection branch in transform_with.c emitted the column but never added it to GROUP BY; only simple identifier and property keys were grouped. So an aggregating WITH with a computed grouping key summed across the entire table instead of per-group.

Now the catch-all branch appends the (non-aggregate) transformed expression to GROUP BY, mirroring the identifier/property branches. Aggregate projections remain excluded.

Verification

  • Rigorous full TCK pass-set diff: zero regressions, +2 (3786 → 3788)
  • Fixes WithOrderBy4 [12] ("Sort by an aliased aggregate projection") and Pattern2 [8] ("Use a pattern comprehension in WITH")
  • Unit: 944/944; functional: clean

Windows CI is a known flake (timestamp tests) and is allowed to fail.

WITH a.num2 % 3 AS mod, sum(...) AS sum collapsed all rows into one group:
the catch-all expression-projection branch emitted the column but never
added the computed key to GROUP BY (only identifier/property keys were
grouped). Now appends the non-aggregate transformed expression to GROUP BY.

Fixes WithOrderBy4 [12] and Pattern2 [8]. Verified: rigorous full TCK
pass-set diff zero regressions, 3786 to 3788; unit 944/944; functional clean.
@dylanbstorey dylanbstorey merged commit 4161d2e into main Jun 3, 2026
16 of 17 checks passed
@dylanbstorey dylanbstorey deleted the i0049-groupby-expr branch June 3, 2026 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant