-
Notifications
You must be signed in to change notification settings - Fork 573
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
Support GROUP BY WITH MODIFIER
for ClickHouse
#1323
Conversation
Pull Request Test Coverage Report for Build 9663460728Details
💛 - Coveralls |
@iffyio Thanks for your great review and improvements. All of them are resolved, pls retake a look. |
121cb81
to
38867ab
Compare
Pull Request Test Coverage Report for Build 9708636908Details
💛 - Coveralls |
Pull Request Test Coverage Report for Build 9708654389Details
💛 - Coveralls |
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.
@git-hulk left some minor comments, the PR looks good overall thanks!
src/ast/query.rs
Outdated
if col_names.is_empty() { | ||
return Ok(()); | ||
} |
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.
would it make sense to skip this check instead? if I'm understanding correctly, it seems to change the current behavior - if the list of expressions is empty, the current behavior looks like it will display GROUP BY
, but this new behavior won't display anything. Not sure if we can end up with an empty list today but I imagine if we suceeded in parsing an empty list then we would want the display to include the GROUP BY
that it parsed so the current behavior seems reasonable in any case?
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.
@iffyio The old behavior also checks if the expressions is empty in Select's display: https://github.com/sqlparser-rs/sqlparser-rs/blob/main/src/ast/query.rs#L304. So I think GroupBy should be omitted if the expressions is empty and move the check to GroupBy itself.
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.
Ah got it, thanks for clarifying! Yeah give that was the previous select behavior omits it then makes sense to preserve it
Co-authored-by: Ifeanyi Ubah <[email protected]>
Co-authored-by: Ifeanyi Ubah <[email protected]>
Pull Request Test Coverage Report for Build 9720586492Details
💛 - Coveralls |
Pull Request Test Coverage Report for Build 9720588280Details
💛 - Coveralls |
@iffyio Thanks for your review, the left comments are resolved. Please take a review while you get time. |
Pull Request Test Coverage Report for Build 9720763225Details
💛 - Coveralls |
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! cc @alamb
GROUP BY WITH MODIFIER
for ClickHouse
GROUP BY WITH MODIFIER
for ClickHouseGROUP BY WITH MODIFIER
for ClickHouse
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.
} | ||
|
||
// invalid cases | ||
let invalid_cases = [ |
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.
💯 for negative cases
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.
This should be credited to the guidance of @iffyio, thank you!
For the syntax, please refer to:
https://clickhouse.com/docs/en/sql-reference/statements/select/group-by#rollup-modifier