[core] Stream primary-key vector exact fallback one batch at a time#559
Merged
JingsongLi merged 1 commit intoJul 21, 2026
Merged
Conversation
…time Replace the whole-column preload of an uncovered data file's vector column with a per-file search that streams the column one Arrow batch at a time into per-query bounded heaps, so peak memory is one batch plus the top-k heap rather than the full column. The per-file exact-fallback factory becomes a search closure (Fn + Send + Sync) returning one bounded best-first list per query; the streaming loop lives in the table layer while the bucket search only calls the closure and merges its results. Queries are validated before any file stream is opened, and the drained row count is checked against the file metadata in both directions.
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.
Purpose
Part of #514, and the first of three PRs split out of the original combined change on the primary-key vector
execute_readpath. This PR adds streaming exact fallback: it bounds peak memory of the per-file exact rerank to one Arrow batch instead of the whole vector column. Single-query output stays byte-identical.Brief change log
perf(table): the per-file exact fallback no longer preloads the whole vector column. It becomes a search closure (Fn + Send + Sync) that streams the column one Arrow batch at a time into per-query bounded top-k heaps, so peak memory is one batch plus the heaps. The streaming loop lives in the table layer; the bucket search only calls the closure and merges its bounded results. Queries are validated before any stream is opened, and the drained row count is checked against the file metadata in both directions.Tests
cargo test -p paimongreen;cargo clippy -p paimon --all-targets -D warningsandcargo fmt --checkclean.API and Format
No on-disk format change, no new result columns, no public API change. Single-query output is byte-identical.
Documentation
Code comments only; no user-facing docs change.