[core] Optimize vector refine raw reads#8528
Merged
JingsongLi merged 1 commit intoJul 9, 2026
Merged
Conversation
leaves12138
approved these changes
Jul 9, 2026
leaves12138
left a comment
Contributor
There was a problem hiding this comment.
Looks good to me. I reviewed the vector refine raw-read optimization and the Java/Python/Spark consistency, and the targeted tests passed.
acc56b2 to
c8e6255
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.
Summary
Optimize vector raw refine by keeping candidate bitmaps as the internal source of truth, reading only the columns needed for refine, and maintaining bounded topK state while scoring. Batch vector refine now unions candidates across queries and reads raw vectors once before scoring each query's own candidate set.
Changes
Testing
mvn -pl paimon-core -Pfast-build -DwildcardSuites=none -Dtest=VectorSearchBuilderTest#testRawCandidateSearchScoresOnlyCandidateBitmap+testBatchRefineReadsUnionCandidatesOnceAndScoresPerQuery+testVectorSearchRefineFactorReranksIndexCandidates+testRawRefineReadTypeContainsOnlyVectorAndRowId testpython -m pytest paimon-python/pypaimon/tests/vector_search_filter_test.py -k "raw_candidate_search_scores_only_candidate_bitmap or batch_refine_factor_reranks_each_query or refine_factor_reranks_index_candidates_with_raw_vectors or refine_factor_one_reranks_without_expanding_candidates or raw_search_uses_partition_filter_and_index_type_metric"mvn -pl paimon-spark/paimon-spark-common -am -Pfast-build -Pspark3 -DfailIfNoTests=false -DwildcardSuites=none -Dtest=SparkVectorReadImplTest#testDistributedIndexRefinesAfterGlobalMerge testgit diff --checkNotes
The deprecated Java refine overload is kept for compatibility, but internal refine calls now use the bitmap-first path.