with: computed (non-aggregate) WITH key is now a GROUP BY key (+2 TCK)#92
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
WITH a.num2 % 3 AS mod, sum(a.num + a.num2) AS sumcollapsed all rows into a single group — the implicit GROUP BY omitted the computed keya.num2 % 3.The catch-all expression-projection branch in
transform_with.cemitted 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
Windows CI is a known flake (timestamp tests) and is allowed to fail.