Skip to content
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

Merged
merged 6 commits into from
Jun 30, 2024

Conversation

git-hulk
Copy link
Member

@coveralls
Copy link

coveralls commented Jun 25, 2024

Pull Request Test Coverage Report for Build 9663460728

Details

  • 94 of 112 (83.93%) changed or added relevant lines in 8 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.03%) to 88.974%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/parser/mod.rs 14 16 87.5%
tests/sqlparser_common.rs 24 27 88.89%
tests/sqlparser_postgres.rs 25 28 89.29%
src/ast/query.rs 10 20 50.0%
Files with Coverage Reduction New Missed Lines %
src/parser/mod.rs 1 93.18%
Totals Coverage Status
Change from base Build 9633122504: -0.03%
Covered Lines: 26314
Relevant Lines: 29575

💛 - Coveralls

src/ast/query.rs Outdated Show resolved Hide resolved
src/ast/query.rs Outdated Show resolved Hide resolved
src/ast/query.rs Outdated Show resolved Hide resolved
src/ast/query.rs Outdated Show resolved Hide resolved
tests/sqlparser_clickhouse.rs Outdated Show resolved Hide resolved
src/parser/mod.rs Outdated Show resolved Hide resolved
src/parser/mod.rs Outdated Show resolved Hide resolved
@git-hulk
Copy link
Member Author

@iffyio Thanks for your great review and improvements. All of them are resolved, pls retake a look.

@git-hulk git-hulk force-pushed the feature/group-by-with-modifiers branch from 121cb81 to 38867ab Compare June 28, 2024 06:46
@coveralls
Copy link

coveralls commented Jun 28, 2024

Pull Request Test Coverage Report for Build 9708636908

Details

  • 117 of 124 (94.35%) changed or added relevant lines in 8 files are covered.
  • 153 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.06%) to 89.1%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/parser/mod.rs 12 13 92.31%
tests/sqlparser_common.rs 24 27 88.89%
tests/sqlparser_postgres.rs 25 28 89.29%
Files with Coverage Reduction New Missed Lines %
src/parser/mod.rs 1 93.21%
src/lib.rs 152 13.01%
Totals Coverage Status
Change from base Build 9696109634: 0.06%
Covered Lines: 26444
Relevant Lines: 29679

💛 - Coveralls

@coveralls
Copy link

coveralls commented Jun 28, 2024

Pull Request Test Coverage Report for Build 9708654389

Details

  • 117 of 124 (94.35%) changed or added relevant lines in 8 files are covered.
  • 153 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.06%) to 89.1%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/parser/mod.rs 12 13 92.31%
tests/sqlparser_common.rs 24 27 88.89%
tests/sqlparser_postgres.rs 25 28 89.29%
Files with Coverage Reduction New Missed Lines %
src/parser/mod.rs 1 93.21%
src/lib.rs 152 13.01%
Totals Coverage Status
Change from base Build 9696109634: 0.06%
Covered Lines: 26444
Relevant Lines: 29679

💛 - Coveralls

@git-hulk git-hulk requested a review from iffyio June 28, 2024 06:55
Copy link
Contributor

@iffyio iffyio left a 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 Show resolved Hide resolved
src/ast/query.rs Outdated Show resolved Hide resolved
src/ast/query.rs Outdated
Comment on lines 1914 to 1916
if col_names.is_empty() {
return Ok(());
}
Copy link
Contributor

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?

Copy link
Member Author

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.

Copy link
Contributor

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

src/parser/mod.rs Outdated Show resolved Hide resolved
git-hulk and others added 2 commits June 29, 2024 09:41
Co-authored-by: Ifeanyi Ubah <[email protected]>
Co-authored-by: Ifeanyi Ubah <[email protected]>
@coveralls
Copy link

coveralls commented Jun 29, 2024

Pull Request Test Coverage Report for Build 9720586492

Details

  • 117 of 124 (94.35%) changed or added relevant lines in 8 files are covered.
  • 153 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.06%) to 89.1%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/parser/mod.rs 12 13 92.31%
tests/sqlparser_common.rs 24 27 88.89%
tests/sqlparser_postgres.rs 25 28 89.29%
Files with Coverage Reduction New Missed Lines %
src/parser/mod.rs 1 93.21%
src/lib.rs 152 13.01%
Totals Coverage Status
Change from base Build 9696109634: 0.06%
Covered Lines: 26444
Relevant Lines: 29679

💛 - Coveralls

@coveralls
Copy link

coveralls commented Jun 29, 2024

Pull Request Test Coverage Report for Build 9720588280

Details

  • 117 of 124 (94.35%) changed or added relevant lines in 8 files are covered.
  • 153 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.06%) to 89.1%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/parser/mod.rs 12 13 92.31%
tests/sqlparser_common.rs 24 27 88.89%
tests/sqlparser_postgres.rs 25 28 89.29%
Files with Coverage Reduction New Missed Lines %
src/parser/mod.rs 1 93.21%
src/lib.rs 152 13.01%
Totals Coverage Status
Change from base Build 9696109634: 0.06%
Covered Lines: 26444
Relevant Lines: 29679

💛 - Coveralls

@git-hulk
Copy link
Member Author

@iffyio Thanks for your review, the left comments are resolved. Please take a review while you get time.

@git-hulk git-hulk requested a review from iffyio June 29, 2024 02:09
@coveralls
Copy link

coveralls commented Jun 29, 2024

Pull Request Test Coverage Report for Build 9720763225

Details

  • 118 of 125 (94.4%) changed or added relevant lines in 8 files are covered.
  • 153 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.06%) to 89.101%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/parser/mod.rs 14 15 93.33%
tests/sqlparser_common.rs 24 27 88.89%
tests/sqlparser_postgres.rs 25 28 89.29%
Files with Coverage Reduction New Missed Lines %
src/parser/mod.rs 1 93.21%
src/lib.rs 152 13.01%
Totals Coverage Status
Change from base Build 9696109634: 0.06%
Covered Lines: 26446
Relevant Lines: 29681

💛 - Coveralls

Copy link
Contributor

@iffyio iffyio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! cc @alamb

@alamb alamb changed the title Add support of GROUB BY WITH MODIFIER for ClickHouse Support of GROUP BY WITH MODIFIER for ClickHouse Jun 30, 2024
@alamb alamb changed the title Support of GROUP BY WITH MODIFIER for ClickHouse Support GROUP BY WITH MODIFIER for ClickHouse Jun 30, 2024
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @git-hulk and @iffyio

}

// invalid cases
let invalid_cases = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯 for negative cases

Copy link
Member Author

@git-hulk git-hulk Jun 30, 2024

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!

@alamb alamb merged commit 44d7a20 into apache:main Jun 30, 2024
10 checks passed
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.

4 participants