Skip to content

Support streaming SQL IN and NOT IN subqueries - #2504

Open
cjc0013 wants to merge 1 commit into
getdozer:mainfrom
cjc0013:bounty-1659-in-subquery
Open

Support streaming SQL IN and NOT IN subqueries#2504
cjc0013 wants to merge 1 commit into
getdozer:mainfrom
cjc0013:bounty-1659-in-subquery

Conversation

@cjc0013

@cjc0013 cjc0013 commented Jun 30, 2026

Copy link
Copy Markdown

/claim #1659

Summary

Adds streaming support for IN (SELECT ...) and NOT IN (SELECT ...) predicates by lowering top-level subquery membership checks into a dedicated two-input selection processor.

  • Splits IN / NOT IN subquery predicates out of WHERE clauses while preserving residual AND filters.
  • Chains multiple subquery membership predicates without changing the left-side output schema.
  • Tracks right-side membership with counts, so duplicate subquery rows only change visibility on 0 -> 1 and 1 -> 0 transitions.
  • Supports left and right inserts, deletes, updates, and batch inserts.
  • Handles SQL NULL semantics: IN ignores NULL membership keys, left NULL keys never match, and right-side NULLs suppress NOT IN output until the last NULL is removed.
  • Rejects multi-column and wildcard subquery projections, because membership predicates require one projected value.

Validation

  • cargo test -p dozer-sql in_subquery --no-default-features
  • cargo test -p dozer-sql builder::tests --no-default-features
  • cargo test -p dozer-sql --no-default-features
  • rustfmt --edition 2021 --check dozer-sql/src/builder/mod.rs dozer-sql/src/builder/tests.rs dozer-sql/src/selection/in_subquery.rs dozer-sql/src/selection/mod.rs dozer-sql/src/tests/builder_test.rs
  • git diff --check

@CLAassistant

CLAassistant commented Jun 30, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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.

2 participants