ClickHouse: Support unparenthesized IN right-hand side#2385
Open
dinmukhamedm wants to merge 3 commits into
Open
ClickHouse: Support unparenthesized IN right-hand side#2385dinmukhamedm wants to merge 3 commits into
dinmukhamedm wants to merge 3 commits into
Conversation
iffyio
reviewed
Jun 20, 2026
| #[test] | ||
| fn parse_in_unparenthesized_placeholder() { | ||
| // ClickHouse `{name:Type}` query-parameter placeholder as the IN RHS, without parens. | ||
| match clickhouse().expr_parses_to("x IN {ids:Array(UInt64)}", "x IN ({ids: Array(UInt64)})") { |
Contributor
There was a problem hiding this comment.
lets rewrite these tests to use all_dialects_where and verified_stmt, we can remove the test for dialects that donts support the feature
Author
There was a problem hiding this comment.
would you like me to move the tests to the common file?
Otherwise, I should have used the function clickhouse() at the bottom of this file that only returns the clickhouse dialect. This will be more consistent with the rest of the tests in this file.
Edit: did both for consistency with the rest of the tests
Comment on lines
+1853
to
+1858
| Expr::InList { list, negated, .. } => { | ||
| assert!(!negated); | ||
| assert_eq!(list.len(), 1); | ||
| assert!(matches!(list[0], Expr::Dictionary(_))); | ||
| } | ||
| other => panic!("expected InList, got {other:?}"), |
Contributor
There was a problem hiding this comment.
we can probably drop the ast assertions, I think the funcationality is simple enough to rely only on roundtrip tests
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.
Fixes #2384
Note: The fix is a little broader than just the parameterized ClickHouse queries, e.g.
WHERE id IN {ids: Array(UUID)}.After opening the issue, I experimented a little more with ClickHouse, and found that it wraps in parenthesis anything on the RHS of
IN, even for singular values, e.g.