-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Group By All #7622
Group By All #7622
Conversation
} else { | ||
// 'group by all' groups wrt. all select expressions except 'AggregateFunction's. | ||
// Filter and collect non-aggregate select expressions | ||
select_exprs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 very nice explanation and code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM -- thank you @berkaysynnada
I think this is a pretty small code change so I am just going to merge it in. Thanks again @berkaysynnada |
* group by all is resolved * restore the removed tests * tests extended * fix after merge
Which issue does this PR close?
Closes #.
Closes #7619
Rationale for this change
There exists a GROUP BY usage with ALL keyword in some platforms (https://docs.snowflake.com/en/sql-reference/constructs/group-by#label-group-by-all-columns, https://duckdb.org/docs/sql/query_syntax/groupby.html).
It groups together all the columns in the SELECT statement that aren't enclosed within aggregate functions. This streamlines the syntax by keeping the list of columns in one place and helps avoid errors by ensuring that the level of detail in your SELECT matches the grouping in your GROUP BY clause.
sqlparser part supports it now with the 0.38.0 release.
What changes are included in this PR?
sqlparser is updated from 0.37.0 to 0.38.0.
select_to_plan()
can handle ALL option ofGroupByExpr
, by grouping all select expressions except aggregate functions..slt tests added.
Are these changes tested?
Yes, with groupby.slt tests extended.
Are there any user-facing changes?
Users can make use of GROUP BY ALL syntax for large grouping sets.