Repository navigation
[Bug] Fix IVFFLAT BIT primary-key membership - #29282
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? |
bcaca22 to
53212c5
Compare
53212c5 to
f78099d
Compare
XuPeng-SH
left a comment
There was a problem hiding this comment.
Reviewed current head f78099d. The added BIT/BIT IN and NOT IN overloads use the existing fixed-width uint64 implementation, preserving NULL and three-valued semantics. Planner tests cover widths 1/8/16/64 and no implicit cast; direct evaluator tests cover high-bit, max-value, NULL-list, and NOT IN cases. The IVFFLAT retry BVT adds a FORCE control and verifies PRE/AUTO/INCLUDE against the filter case where POST yields no candidates. Current-head UT, SCA, and multi-CN BVT checks pass. No blocking findings.
Merge Queue Status
This pull request spent 12 seconds in the queue, including 1 second running CI. Required conditions to merge
|
## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: - #29077 #29047 was already addressed by merged upstream PR #29282 and is included here only as related context. ## What this PR does / why we need it: IVFFLAT can leave an unrecognized distance predicate, such as `BETWEEN`, on the base scan while truncating the vector-index candidate stream to Top-K. Qualifying rows outside that prefix are then lost. This change detects residual predicates on the indexed distance expression before building PRE, POST, INCLUDE, or AUTO rewrites and falls back to the exact plan. The check covers exact and lossy entries, preserves SQL three-valued logic, validates the scan relation binding, and keeps canonical range pushdown unchanged. The regression case covers literal and prepared `BETWEEN` queries across force, PRE, POST, and AUTO modes. The issue should be verified by the reporter after the PR is merged. ## Validation - `GOWORK=off .agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=300s ./pkg/sql/plan` - `GOWORK=off go vet -mod=readonly ./pkg/sql/plan` - Go 1.27.1-built `golangci-lint v2.14.0 --new-from-rev origin/main ./pkg/sql/plan` (`0 issues`) - Task-owned mo-service with `vector_ivf_prepare_dist_range.sql`: normal comparison passed 84/84 twice on the same instance after reviewing generated result output. ## Performance and compatibility Canonical recognized distance ranges retain the existing vector-index pushdown. Queries with residual distance predicates now use the exact scan to preserve correctness; this is a deliberate conservative tradeoff for unsupported predicate shapes and lossy scores. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #29047
What this PR does / why we need it:
IVFFLAT runtime membership keeps the primary-key type when building an
INpredicate. The genericINandNOT INregistries lacked BIT overloads, so PRE binding failed for BIT primary keys and AUTO's correctness retry then failed as well.Append BIT overloads backed by the existing uint64 membership executor, preserving existing encoded overload positions. Add coverage for widths 1/8/16/64, uint64 boundaries, SQL NULL semantics, typed IVFFLAT lowering, and public PRE/AUTO results with FORCE, POST, and INCLUDE controls.
Validation:
pkg/sql/plan/functionCGo test package passed; focused IVFFLAT runtime-expression test passed.vector_ivf_retry.sqlBVT passed with 123/123 result comparisons; FORCE, PRE, AUTO, and INCLUDE returned keys 196–200, and POST returned empty.go vetandgolangci-lintpassed for both changed Go packages (0 issues).Performance: uses the existing uint64 map executor, with no extra runtime conversion or IVFFLAT scan work.
Remaining validation: the reported 2-CN topology was not run locally; standard CI remains pending.