Skip to content

Refuse a ClickHouse GLOBAL membership test - #201

Merged
LucaCappelletti94 merged 4 commits into
mainfrom
upstream/global-in
Oct 17, 2026
Merged

LucaCappelletti94 merged 4 commits into
mainfrom
upstream/global-in

Conversation

@LucaCappelletti94

@LucaCappelletti94 LucaCappelletti94 commented Oct 17, 2026 •

Copy link
Copy Markdown
Owner

apache/datafusion-sqlparser-rs#2598 added ClickHouse's GLOBAL IN and GLOBAL NOT IN, which put a global flag on Expr::InList and Expr::InSubquery. subql names every field of those variants in the compiler, the prefilter and the re-execution key predicate, so it stopped building against sqlparser main.

GLOBAL asks a distributed ClickHouse query to evaluate the right-hand side once on the initiator and broadcast it. None of subql's backends has that read, so the compiler refuses a GLOBAL list or subquery as it refuses any unsupported condition, the prefilter leaves it unknown, and the key predicate built for re-execution is never GLOBAL. Only ClickHouse parses the keyword, so the test compiles ClickHouse-parsed conditions directly.

The lockfiles follow sqlparser and sql-traits main in their own commits. The all-features, demo and fuzz builds stay red until LucaCappelletti94/pg2sqlite#122 merges, after which one more lock refresh lands here.

Adding global to sqlparser’s membership-expression variants broke compilation because the compiler, prefilter, and re-execution predicate did not account for the new field. The compiler now rejects GLOBAL IN and GLOBAL NOT IN because the backend does not support ClickHouse’s distributed-query behavior.

The prefilter treats global membership as unknown, and re-execution predicates remain non-global. ClickHouse-specific tests cover plain and global list and subquery membership conditions.

@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: LucaCappelletti94/coderabbit/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: f6e27df9-0c5e-4a32-9465-70b1f95e1eb9
📥 Commits

Reviewing files that changed from the base of the PR and between bd56fb7 and 673580d.

⛔ Files ignored due to path filters: 2
  • Cargo.lock is excluded by !**/*.lock
  • fuzz/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing: 5
  • CHANGELOG.md
  • src/compiler/parser/compilation_helpers.rs
  • src/compiler/parser/mod.rs
  • src/compiler/prefilter.rs
  • src/reexec/plan.rs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📝 Walkthrough

The compiler rejects ClickHouse GLOBAL IN membership lists and subqueries. Prefilter analysis treats global lists as unknown, and generated IN predicates explicitly set global to false. Tests cover supported and rejected conditions.

Changes: GLOBAL IN handling

Layer / File(s) Summary
Reject and validate GLOBAL IN conditions
src/compiler/parser/compilation_helpers.rs, src/compiler/prefilter.rs, src/reexec/plan.rs, src/compiler/parser/mod.rs, CHANGELOG.md
The compiler rejects global membership lists and subqueries. Prefilter analysis excludes global lists, and generated predicates set global to false. Tests verify that non-global IN and NOT IN compile, while their global forms return UnsupportedSql. The changelog records this behavior.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 67358

This change makes the compiler refuse ClickHouse GLOBAL IN membership tests and adapts related code to the new sqlparser field. No concrete merge-blocking risk was found in the supplied changes.

Caution

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

  • Ignore

Failed Failed checks: 1 error

Check name Status Explanation Resolution
Git Dependency Pin Stays Out Of Commits Error The PR modifies Cargo.lock and fuzz/Cargo.lock, while Cargo.toml, fuzz/Cargo.toml, and subql-demo/Cargo.toml declare git = dependencies without rev or tag (for example, Cargo.toml:26… Either revert the Cargo.lock and fuzz/Cargo.lock changes, or add an explicit rev or tag to every Git dependency in all repository manifests, then regenerate the lockfiles.
Passed Passed checks: 11 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title is an imperative, plain statement of the main change. It is 42 characters long, has no conventional-commit prefix or file path, and has no trailing period.
Docstring Coverage Passed Docstring coverage is 83.33% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 4 files. (1 skipped: 1 u…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
No Placeholder Implementations Passed No added line matches the specified placeholder or deferral markers. The new unsupported_expression(expr) path explicitly rejects GLOBAL membership as unsupported behavior; it is not a placeholder…
No Blanket Diagnostic Suppression Passed No added line matches a blanket diagnostic suppression. The Rust changes add explicit global matching, comments, and tests only; the lockfile and changelog additions contain no suppression directive…
Behavior Change Carries A Test Passed The pull request changes runtime behavior in src/compiler/parser/compilation_helpers.rs, src/compiler/prefilter.rs, and src/reexec/plan.rs. It also adds the #[test] item `a_global_membership_t…
Crate Readme Is The Crate Documentation Passed The check applies only when the pull request changes README.md or src/lib.rs. The authoritative diff changes neither file, although src/lib.rs exists.
Pre-Alpha Has No Deployments Passed No added line mentions a migration guide, migration SQL, upgrade path, existing deployments, version-bump coordination, flag day, rollout sequence, deprecation window, backward-compatibility shim, or …
Prose Punctuation Passed No added prose violates the punctuation rule. The changelog and Rust comments/doc comments contain no semicolons, em dashes, en dashes, curly quotes, or ellipses. The ASCII hyphens are list-marker or …
Full details: Docstring Coverage

Explanation

Docstring coverage is 83.33% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 4 files. (1 skipped: 1 unsupported.)

Full details: No Placeholder Implementations

Explanation

No added line matches the specified placeholder or deferral markers. The new unsupported_expression(expr) path explicitly rejects GLOBAL membership as unsupported behavior; it is not a placeholder implementation. The added comments and changelog contain no TODO, FIXME, HACK, or XXX markers.

Full details: No Blanket Diagnostic Suppression

Explanation

No added line matches a blanket diagnostic suppression. The Rust changes add explicit global matching, comments, and tests only; the lockfile and changelog additions contain no suppression directives.

Full details: Behavior Change Carries A Test

Explanation

The pull request changes runtime behavior in src/compiler/parser/compilation_helpers.rs, src/compiler/prefilter.rs, and src/reexec/plan.rs. It also adds the #[test] item a_global_membership_test_is_refused_where_the_plain_one_compiles in src/compiler/parser/mod.rs, covering plain and GLOBAL list and subquery membership cases.

Full details: Pre-Alpha Has No Deployments

Explanation

No added line mentions a migration guide, migration SQL, upgrade path, existing deployments, version-bump coordination, flag day, rollout sequence, deprecation window, backward-compatibility shim, or an alias for old clients. The package is version 0.1.0 and the README links its crates.io package.

Full details: Prose Punctuation

Explanation

No added prose violates the punctuation rule. The changelog and Rust comments/doc comments contain no semicolons, em dashes, en dashes, curly quotes, or ellipses. The ASCII hyphens are list-marker or compound-word uses such as right-hand and Bind-placeholder. Assert messages also comply.

Full details: Git Dependency Pin Stays Out Of Commits

Explanation

The PR modifies Cargo.lock and fuzz/Cargo.lock, while Cargo.toml, fuzz/Cargo.toml, and subql-demo/Cargo.toml declare git = dependencies without rev or tag (for example, Cargo.toml:26 and Cargo.toml:106). This breaks the invariant that changed lockfiles must not accompany bare Git dependencies.

Resolution

Either revert the Cargo.lock and fuzz/Cargo.lock changes, or add an explicit rev or tag to every Git dependency in all repository manifests, then regenerate the lockfiles.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pre-merge checks failed. Please resolve the failing checks before merging.

@sonarqubecloud

Copy link
Copy Markdown

@codecov

codecov Bot commented Oct 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.67442% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 87.46%. Comparing base (bd56fb7) to head (48a3c32).

Files with missing lines Patch % Lines
src/compiler/parser/mod.rs 97.56% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #201      +/-   ##
==========================================
+ Coverage   87.44%   87.46%   +0.01%     
==========================================
  Files         162      162              
  Lines       48883    48926      +43     
  Branches    48883    48926      +43     
==========================================
+ Hits        42744    42791      +47     
+ Misses       4949     4940       -9     
- Partials     1190     1195       +5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@LucaCappelletti94
LucaCappelletti94 merged commit 10757e7 into main Oct 17, 2026
36 checks passed
@LucaCappelletti94
LucaCappelletti94 deleted the upstream/global-in branch October 17, 2026 12:36
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.

1 participant