Skip to content

Refactoring: Merge the IN expression variants into Expr::In - #2679

Open
LucaCappelletti94 wants to merge 2 commits into
mainfrom
in-expr-refactor
Open

LucaCappelletti94 wants to merge 2 commits into
mainfrom
in-expr-refactor

Conversation

@LucaCappelletti94

Copy link
Copy Markdown
Contributor

Expr had three variants for the IN predicate, InList, InSubquery and InUnnest, each repeating the left-hand expression and the NOT flag, two of them repeating ClickHouse's GLOBAL flag, and each with its own copy of the Display, Spanned and parser code. Supporting another right-hand side, such as SQLite's IN table_name, meant a fourth copy.

They are now one Expr::In { expr, target, negated, global }, where target is an InTarget: List, Subquery or Unnest. The SQL that parses and the text printed back are unchanged, GLOBAL is still only accepted before a list or subquery, and size_of::<Expr>() stays at 328 bytes. This is a breaking change for code that builds or matches Expr::InList, Expr::InSubquery or Expr::InUnnest, which now match Expr::In with the corresponding InTarget.

@codecov-commenter

codecov-commenter commented Oct 18, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 78.57143% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.30%. Comparing base (d32825d) to head (a16fbaf).

Files with missing lines Patch % Lines
src/ast/spans.rs 0.00% 6 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2679   +/-   ##
=======================================
  Coverage   81.29%   81.30%           
=======================================
  Files          42       42           
  Lines       33950    33944    -6     
  Branches    33950    33944    -6     
=======================================
- Hits        27601    27598    -3     
+ Misses       2785     2782    -3     
  Partials     3564     3564           

☔ 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants