Skip to content

[Vector Upsert 5/5] Add FULL-upsert vector integration coverage - #19301

Open
xiangfu0 wants to merge 5 commits into
apache:masterfrom
xiangfu0:xiangfu0/upsert-vector-5-integration-test
Open

[Vector Upsert 5/5] Add FULL-upsert vector integration coverage#19301
xiangfu0 wants to merge 5 commits into
apache:masterfrom
xiangfu0:xiangfu0/upsert-vector-5-integration-test

Conversation

@xiangfu0

@xiangfu0 xiangfu0 commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Part 5/5 of the split of #19287 (Fix FULL-upsert vector candidate generation).
Stacked on #19300.

Summary

Add VectorUpsertTableTest on CustomDataQueryClusterIntegrationTest: six physical
records collapse to four current records under FULL upsert, and vector top-K queries
must return exactly K current entities with scalar-distance equivalence.

Covers a single consuming segment and sealed-plus-consuming segments, both query
engines, two replicas, and a skipUpsert=true control proving the obsolete rows are
physically nearest.

The explain assertions also pin the planned execution path per segment type: consuming
segments use the exact scan operator because the mutable vector index cannot restrict
its search, while sealed segments use filtered ANN.

Validation

  • Both query-engine invocations passed against the stacked fix.
  • The test was also run against a pre-fix build and fails there with the reported symptom
    (0 of K rows returned), confirming it is a genuine regression test.

Stack

  1. [Vector Upsert 1/5] Support allowed-document filtering in exact vector scan #19297 — exact-scan allowed-document filtering
  2. [Vector Upsert 2/5] Harden vector search metric recording and backend param cleanup #19298 — backend param cleanup hardening
  3. [Vector Upsert 3/5] Never materialize nested vector subtrees as metadata filters #19299 — nested vector metadata guard
  4. [Vector Upsert 4/5] Apply the query's visible-document set before vector candidate generation #19300 — apply the visible-document set before candidate generation (core fix)
  5. [Vector Upsert 5/5] Add FULL-upsert vector integration coverage #19301 — integration coverage

@codecov-commenter

codecov-commenter commented Aug 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.95028% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.19%. Comparing base (f5fee8e) to head (25d6fb0).

Files with missing lines Patch % Lines
...operator/filter/ExactVectorScanFilterOperator.java 86.44% 5 Missing and 3 partials ⚠️
...perator/filter/VectorSimilarityFilterOperator.java 91.89% 1 Missing and 5 partials ⚠️
...ava/org/apache/pinot/core/plan/FilterPlanNode.java 87.50% 2 Missing and 3 partials ⚠️
...not/core/operator/filter/VectorCandidateScope.java 87.50% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #19301      +/-   ##
============================================
+ Coverage     67.12%   67.19%   +0.06%     
  Complexity     1424     1424              
============================================
  Files          3462     3463       +1     
  Lines        220677   220783     +106     
  Branches      35255    35287      +32     
============================================
+ Hits         148136   148355     +219     
+ Misses        60708    60586     -122     
- Partials      11833    11842       +9     
Flag Coverage Δ
integration 100.00% <ø> (ø)
integration1 100.00% <ø> (ø)
integration2 0.00% <ø> (?)
java-25 67.19% <88.95%> (+0.06%) ⬆️
lane-a 100.00% <ø> (ø)
lane-b 0.00% <ø> (ø)
temurin 67.19% <88.95%> (+0.06%) ⬆️
unittests 67.19% <88.95%> (+0.06%) ⬆️
unittests1 57.91% <88.95%> (+0.09%) ⬆️
unittests2 39.10% <2.20%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@xiangfu0
xiangfu0 force-pushed the xiangfu0/upsert-vector-5-integration-test branch from f4c05fb to 2d2830e Compare August 19, 2026 01:38
@xiangfu0 xiangfu0 added bug Something is not working as expected vector Related to vector similarity search upsert Related to upsert functionality data-integrity Related to correctness of data or query results testing Related to tests or test infrastructure query Related to query processing labels Aug 19, 2026
…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.
…tor candidate generation

FilterPlanNode constructed and executed VECTOR_SIMILARITY before adding
SegmentContext.getDocIdsSnapshot() as an outer AND. Obsolete physical versions
of upserted rows could therefore occupy per-segment ANN top-K slots and be
removed only afterward, producing fewer than K rows or omitting nearer current
rows.

Pass the snapshot to vector predicates as a required VectorCandidateScope so it
constrains candidate generation, while retaining the outer bitmap AND as defense
in depth. FilterPlanNode remains the only place that knows the scope comes from
the segment's queryable-document snapshot; the operators only see 'documents
this predicate may consider'.

Choose the execution path at plan time, where both the reader capability and
forward index availability are known:

- a filter-aware reader receives the scope and does filtered ANN;
- a reader that cannot restrict its search is bypassed for
  ExactVectorScanFilterOperator over the allowed documents, which reports it
  through fallbackReason;
- an empty scope needs no candidate generation and no reader capability at all,
  so it short-circuits to an empty operator;
- when neither path is available the query fails clearly.

Because the choice is made once, VectorSimilarityFilterOperator no longer needs
a runtime exact-scan branch, and it captures the reader capability once instead
of re-reading it per execution, so a plan built on one answer can never execute
against another. Required scopes stay separate from optimizer-selected metadata
filters and are intersected with them before candidate generation. Non-upsert
queries keep the adaptive metadata behavior, and non-vector plans do not copy
the snapshot.
Add VectorUpsertTableTest on CustomDataQueryClusterIntegrationTest: six
physical records collapse to four current records under FULL upsert, and vector
top-K queries must return exactly K current entities with scalar-distance
equivalence. Covers a single consuming segment and sealed-plus-consuming
segments, both query engines, two replicas, and a skipUpsert=true control
proving obsolete rows are physically nearest.

The explain assertions also pin the planned execution path per segment type:
consuming segments use the exact scan operator because the mutable vector index
cannot restrict its search, while sealed segments use filtered ANN.
@xiangfu0
xiangfu0 force-pushed the xiangfu0/upsert-vector-5-integration-test branch from 2d2830e to 25d6fb0 Compare August 20, 2026 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something is not working as expected data-integrity Related to correctness of data or query results query Related to query processing testing Related to tests or test infrastructure upsert Related to upsert functionality vector Related to vector similarity search

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants