Repository navigation
Conversation
… CUBE to close AlaSQL#3152 (a) parses as a UniOp without an operator, so the grouping set code did not see it as a column and the column outside the set kept its value instead of NULL. Take the bare expression first, as equals() does since AlaSQL#2721. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
(a)parses as aUniOpwith no operator, sodecartesandrollupinsrc/select/rollup.jsdidn't see aColumnand grouped it under the key(a). The SELECT columnathen wasn't matched to that key, so it read the first row of the group instead of NULL whenawas outside the set.The fix takes
bare()of each item inside GROUPING SETS, ROLLUP and CUBE first (the same unwrapequals()uses since #3088), soGROUPING SETS((a), (b)),ROLLUP((a), b)andCUBE((a), (b))give the same rows as without the parentheses.((a))works too.A plain
GROUP BY (a)is left as it is. Unwrapping there skips the nick thatcompileSelectGroup0gives top-level columns, andGROUP BY (t1.a), (t2.a)on a join would then mix up the twoacolumns. The last test case checks that.Tests: new
test/test3152.js(fails on main, passes here),yarn testpasses, and the dialect, run-state, binding and parity checks pass locally. Parity only shows differences for the new test.Not covered here: a composite set like
GROUPING SETS((a, b), a)and the empty set()still don't parse.Fixes #3152