[Vector Upsert 3/5] Never materialize nested vector subtrees as metadata filters - #19299
Open
xiangfu0 wants to merge 3 commits into
Open
[Vector Upsert 3/5] Never materialize nested vector subtrees as metadata filters#19299xiangfu0 wants to merge 3 commits into
xiangfu0 wants to merge 3 commits into
Conversation
This was referenced Aug 19, 2026
[Vector Upsert 4/5] Apply the query's visible-document set before vector candidate generation
#19300
Open
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #19299 +/- ##
============================================
+ Coverage 67.20% 67.23% +0.03%
Complexity 1424 1424
============================================
Files 3462 3463 +1
Lines 220361 220407 +46
Branches 35147 35164 +17
============================================
+ Hits 148087 148187 +100
+ Misses 60467 60386 -81
- Partials 11807 11834 +27
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…r scan Extract a shared computeExactMatches helper that unifies the exact top-K and threshold scan paths and can restrict scoring to an allowed-document bitmap. Introduce VectorCandidateScope, an immutable set of document IDs a vector predicate is allowed to consider as candidates. Vector top-K is not monotonic, so unlike an ordinary predicate -- which is correct to intersect with the result afterwards -- a document set that defines what the query may see has to be applied before candidate generation. The type carries that contract and says nothing about where the restriction came from; callers decide that. ExactVectorScanFilterOperator accepts one via a new constructor overload, and no production caller passes one yet. Also let the operator record its own exact-scan search and fallback metrics, which were previously invisible to VectorSearchMetrics, and report the applied candidate-filter cardinality in explain output. Add filtered-reader coverage for HnswVectorIndexReader.
… param cleanup Only record a vector search metric when a search actually executed, and guarantee backend search parameters are cleared even when configuration fails partway or the explain-context refresh throws. Previously a failure inside configureBackendParams still recorded a search that never ran, and an exception from refreshExplainContext could skip clearBackendParams entirely.
…ata filters FilterPlanNode treated any non-leaf AND sibling as a metadata filter when wiring pre-filter bitmaps for filter-aware ANN. A nested subtree containing a VECTOR_SIMILARITY predicate (e.g. AND(vector, AND(vector2, metadata)) or AND(vector, NOT(vector2))) was eagerly materialized into a bitmap, executing top-K candidate generation out of its boolean context and pushing its results into the sibling vector search as a pre-filter. Track the retained child FilterContexts alongside their operators so wirePreFilterForVectorOperators can pair them, and only treat subtrees with no vector predicate as metadata. Adaptive pre-filter selection for plain metadata siblings is unchanged.
xiangfu0
force-pushed
the
xiangfu0/upsert-vector-3-nested-vector-guard
branch
from
August 19, 2026 01:38
aa7de76 to
8abc05f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part 3/5 of the split of #19287 (Fix FULL-upsert vector candidate generation).
Summary
FilterPlanNodetreated any non-leaf AND sibling as a metadata filter when wiringpre-filter bitmaps for filter-aware ANN. A nested subtree containing a
VECTOR_SIMILARITYpredicate — e.g.AND(vector, AND(vector2, metadata))orAND(vector, NOT(vector2))— was eagerly materialized into a bitmap, executing top-Kcandidate generation out of its boolean context and pushing its results into the sibling
vector search as a pre-filter.
FilterContexts alongside their operators sowirePreFilterForVectorOperatorscan pair them.(
containsVectorPredicate/hasSafeMetadataSibling).Validation
FilterPlanNodeTest: 13 tests passed. The newtestNestedVectorSimilaritySubtreeIsNeverMaterializedAsMetadatafails all 3 booleanshapes against master's planner and passes with this change.
Stack