ClickHouse: Support GLOBAL IN / GLOBAL NOT IN - #2598
Open
s5dsn-eqee wants to merge 4 commits into
Open
s5dsn-eqee wants to merge 4 commits into
s5dsn-eqee wants to merge 4 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2598 +/- ##
==========================================
+ Coverage 81.14% 81.15% +0.01%
==========================================
Files 42 42
Lines 33736 33762 +26
Branches 33736 33762 +26
==========================================
+ Hits 27376 27401 +25
Misses 2797 2797
- Partials 3563 3564 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
LucaCappelletti94
requested changes
Oct 1, 2026
LucaCappelletti94
left a comment
Contributor
There was a problem hiding this comment.
Will review later today, but please in the meantime add a couple of examples for the fuzzer corpus.
# Conflicts: # src/parser/mod.rs
LucaCappelletti94
requested changes
Oct 3, 2026
| @@ -4468,6 +4478,7 @@ impl<'a> Parser<'a> { | |||
| expr: Box::new(expr), | |||
| list: vec![self.parse_expr()?], | |||
Contributor
There was a problem hiding this comment.
ClickHouse groups x GLOBAL IN t2 AND y = 2 as (x GLOBAL IN t2) AND y = 2, but this path renders x GLOBAL IN (t2 AND y = 2).
Suggested change
| list: vec![self.parse_expr()?], | |
| list: vec![self.parse_subexpr(self.dialect.prec_value(Precedence::Eq))?], |
| .parse_sql_statements("SELECT * FROM t WHERE x GLOBAL IN (1)") | ||
| .is_err()); | ||
| } | ||
| } |
Contributor
There was a problem hiding this comment.
Some red tests
Suggested change
| } | |
| } | |
| #[test] | |
| fn global_in_bare_table_binds_before_and() { | |
| let expr = | |
| clickhouse().expr_parses_to("x GLOBAL IN t2 AND y = 2", "x GLOBAL IN (t2) AND y = 2"); | |
| assert!(matches!( | |
| expr, | |
| BinaryOp { | |
| left, | |
| op: BinaryOperator::And, | |
| .. | |
| } if matches!(*left, Expr::InList { global: true, .. }) | |
| )); | |
| } | |
| #[test] | |
| fn global_in_bare_table_binds_before_equality() { | |
| let expr = clickhouse().expr_parses_to("x GLOBAL IN t2 = 1", "x GLOBAL IN (t2) = 1"); | |
| assert!(matches!( | |
| expr, | |
| BinaryOp { | |
| left, | |
| op: BinaryOperator::Eq, | |
| .. | |
| } if matches!(*left, Expr::InList { global: true, .. }) | |
| )); | |
| } |
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.
Closes: #2597
Dialects: ClickHouse