Repository navigation
fix(plan): use hash anti join for filtered NOT EXISTS - #26798
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep review completed — no blocking findings.
I traced the full path from correlated-subquery flattening through MARK filter pushdown, equality detection, and physical join compilation. The rewrite is semantically sound: once the marker is consumed directly or through NOT and the join is lowered to SEMI/ANTI, only TRUE matches matter, so ISTRUE(equal) and equal define the same match set. Projected MARK joins remain untouched, preserving three-valued semantics. The cross-input guard also correctly retains wrappers for same-side, mixed-side, non-equality, and outer-scope conditions.
Validation at head bdcada5:
- The exact witness fails on base 08770e1 because ANTI does not expose a hash equality, then passes on this head.
- Counterexample planner matrix covered EXISTS/NOT EXISTS, commuted and composite nullable equalities, equality plus nullable residual, projected MARK, and mixed/outer/same-side controls.
- Physical compilation matrix confirmed eligible SEMI/ANTI plans use HashJoin, residual predicates remain residuals, and ineligible mixed-side equality stays on LoopJoin.
- go build, go vet, and full CGo-controlled tests for ./pkg/sql/plan and ./pkg/sql/compile passed.
- GitHub CI is green.
Non-blocking follow-up: retain a SQL-level result regression for filtered nullable NOT EXISTS. The committed typed planner/compiler tests prove the transformation and physical selection well; a public result oracle would make the NULL-semantics contract durable too.
…6798) ## Summary - unwrap only strict cross-input `ISTRUE(equal)` predicates when a MARK join is lowered to SEMI/ANTI - preserve projected MARK join three-valued semantics - add planner and compiler regression tests - fixes matrixorigin#26797 ## Validation - `.agents/skills/mo-dev/scripts/mo-cgo-test ./pkg/sql/plan ./pkg/sql/compile` - `make build` - fixed single-node service with 6GB memory cache: full `NOT EXISTS` returned 199500 in 599ms and used RIGHT ANTI hashOnPK; the old plan was LoopJoin and exceeded 180s - complex correctness: 26/26 - indexed-table DML checks: 0 failures - index combinations: 0 failures; predicate-order/index-order/function equivalences preserved - concurrent harness: 630 queries, 0 errors/timeouts - partition scenarios intentionally excluded
…6798) ## Summary - unwrap only strict cross-input `ISTRUE(equal)` predicates when a MARK join is lowered to SEMI/ANTI - preserve projected MARK join three-valued semantics - add planner and compiler regression tests - fixes matrixorigin#26797 ## Validation - `.agents/skills/mo-dev/scripts/mo-cgo-test ./pkg/sql/plan ./pkg/sql/compile` - `make build` - fixed single-node service with 6GB memory cache: full `NOT EXISTS` returned 199500 in 599ms and used RIGHT ANTI hashOnPK; the old plan was LoopJoin and exceeded 180s - complex correctness: 26/26 - indexed-table DML checks: 0 failures - index combinations: 0 failures; predicate-order/index-order/function equivalences preserved - concurrent harness: 630 queries, 0 errors/timeouts - partition scenarios intentionally excluded
…6798) ## Summary - unwrap only strict cross-input `ISTRUE(equal)` predicates when a MARK join is lowered to SEMI/ANTI - preserve projected MARK join three-valued semantics - add planner and compiler regression tests - fixes matrixorigin#26797 ## Validation - `.agents/skills/mo-dev/scripts/mo-cgo-test ./pkg/sql/plan ./pkg/sql/compile` - `make build` - fixed single-node service with 6GB memory cache: full `NOT EXISTS` returned 199500 in 599ms and used RIGHT ANTI hashOnPK; the old plan was LoopJoin and exceeded 180s - complex correctness: 26/26 - indexed-table DML checks: 0 failures - index combinations: 0 failures; predicate-order/index-order/function equivalences preserved - concurrent harness: 630 queries, 0 errors/timeouts - partition scenarios intentionally excluded
Summary
ISTRUE(equal)predicates when a MARK join is lowered to SEMI/ANTIValidation
.agents/skills/mo-dev/scripts/mo-cgo-test ./pkg/sql/plan ./pkg/sql/compilemake buildNOT EXISTSreturned 199500 in 599ms and used RIGHT ANTI hashOnPK; the old plan was LoopJoin and exceeded 180s