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 SETTINGS pairs for ClickHouse dialect #1327

Merged

Conversation

git-hulk
Copy link
Member

SETTINGS in query is supported by ClickHouse, for example:

SELECT * FROM t SETTINGS max_threads = 1, max_block_size = 10000

For more information, please refer to:

https://clickhouse.com/docs/en/sql-reference/statements/select#settings-in-select-query

SETTINGS in query is supported by ClickHouse, for example:

```
SELECT * FROM t SETTINGS max_threads = 1, max_block_size = 10000
```

For more information, please refer to:

https://clickhouse.com/docs/en/sql-reference/statements/select#settings-in-select-query
@git-hulk git-hulk force-pushed the supports-settings-in-query-for-clickhosue branch from 5297864 to cdba898 Compare June 30, 2024 13:33
@coveralls
Copy link

coveralls commented Jun 30, 2024

Pull Request Test Coverage Report for Build 9732400921

Details

  • 64 of 65 (98.46%) changed or added relevant lines in 7 files are covered.
  • 14 unchanged lines in 4 files lost coverage.
  • Overall coverage increased (+0.04%) to 89.141%

Changes Missing Coverage Covered Lines Changed/Added Lines %
tests/sqlparser_postgres.rs 5 6 83.33%
Files with Coverage Reduction New Missed Lines %
tests/sqlparser_mssql.rs 1 92.86%
src/parser/mod.rs 3 93.27%
tests/sqlparser_postgres.rs 4 87.88%
tests/sqlparser_common.rs 6 89.61%
Totals Coverage Status
Change from base Build 9731662350: 0.04%
Covered Lines: 26514
Relevant Lines: 29744

💛 - Coveralls

@coveralls
Copy link

coveralls commented Jun 30, 2024

Pull Request Test Coverage Report for Build 9732425080

Details

  • 65 of 65 (100.0%) changed or added relevant lines in 7 files are covered.
  • 14 unchanged lines in 4 files lost coverage.
  • Overall coverage increased (+0.04%) to 89.141%

Files with Coverage Reduction New Missed Lines %
tests/sqlparser_mssql.rs 1 92.86%
src/parser/mod.rs 3 93.27%
tests/sqlparser_postgres.rs 4 87.88%
tests/sqlparser_common.rs 6 89.61%
Totals Coverage Status
Change from base Build 9731662350: 0.04%
Covered Lines: 26514
Relevant Lines: 29744

💛 - Coveralls

@git-hulk git-hulk changed the title Add the support of SETTINGS pairs in ClickHouse Add the support of SETTINGS pairs for ClickHouse dialect Jun 30, 2024
Comment on lines 7936 to 7946
let mut key_values: Vec<Setting> = vec![];
loop {
let key = self.parse_identifier(false)?;
self.expect_token(&Token::Eq)?;
let value = self.parse_value()?;
key_values.push(Setting { key, value });
if !self.consume_token(&Token::Comma) {
break;
}
}
Some(key_values)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we might be able to reuse the parse_comma_separated functionality here, could you take a look at that function to see if it works for this 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 Good point, it's done now.

@git-hulk git-hulk requested a review from iffyio July 5, 2024 10:41
@coveralls
Copy link

coveralls commented Jul 5, 2024

Pull Request Test Coverage Report for Build 9807053567

Details

  • 65 of 65 (100.0%) changed or added relevant lines in 7 files are covered.
  • 14 unchanged lines in 4 files lost coverage.
  • Overall coverage increased (+0.04%) to 89.141%

Files with Coverage Reduction New Missed Lines %
tests/sqlparser_mssql.rs 1 92.86%
src/parser/mod.rs 3 93.27%
tests/sqlparser_postgres.rs 4 87.88%
tests/sqlparser_common.rs 6 89.61%
Totals Coverage Status
Change from base Build 9731662350: 0.04%
Covered Lines: 26514
Relevant Lines: 29744

💛 - Coveralls

src/parser/mod.rs Outdated Show resolved Hide resolved
Co-authored-by: Ifeanyi Ubah <ify1992@yahoo.com>
@coveralls
Copy link

coveralls commented Jul 5, 2024

Pull Request Test Coverage Report for Build 9808889487

Details

  • 62 of 62 (100.0%) changed or added relevant lines in 7 files are covered.
  • 14 unchanged lines in 4 files lost coverage.
  • Overall coverage increased (+0.04%) to 89.14%

Files with Coverage Reduction New Missed Lines %
tests/sqlparser_mssql.rs 1 92.86%
src/parser/mod.rs 3 93.27%
tests/sqlparser_postgres.rs 4 87.88%
tests/sqlparser_common.rs 6 89.61%
Totals Coverage Status
Change from base Build 9731662350: 0.04%
Covered Lines: 26511
Relevant Lines: 29741

💛 - Coveralls

@git-hulk git-hulk requested a review from iffyio July 5, 2024 13:21
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 the support of SETTINGS pairs for ClickHouse dialect Support SETTINGS pairs for ClickHouse dialect Jul 7, 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 for the review

@alamb alamb merged commit 700bd03 into apache:main Jul 7, 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