Skip to content

Add rerank to primary-key vector search#8591

Merged
JingsongLi merged 1 commit into
apache:masterfrom
JingsongLi:codex/primary-key-vector-rerank
Jul 13, 2026
Merged

Add rerank to primary-key vector search#8591
JingsongLi merged 1 commit into
apache:masterfrom
JingsongLi:codex/primary-key-vector-rerank

Conversation

@JingsongLi

Copy link
Copy Markdown
Contributor

Summary

Add exact reranking to primary-key vector search so approximate ANN candidates can be reordered
with the original vectors stored in Paimon. The implementation reuses the Data Evolution refine
configuration semantics and supports both local and distributed Spark execution.

Changes

  • Share refine/rerank option resolution between Data Evolution and primary-key vector reads,
    including aliases, prefix precedence, query-over-table precedence, factor validation, and
    overflow-safe candidate limits.
  • Keep ANN candidates separate from exact fallback candidates, over-fetch only the ANN stream,
    reread selected rows by snapshot-scoped physical position, and recompute exact distances before
    the final global Top-K merge.
  • Propagate bounded ANN and exact candidate streams through Spark tasks, then merge and rerank the
    global ANN candidates on the driver without starting a second Spark job.
  • Document the shared configuration behavior, recall limitation, and latency/I/O trade-off.

Testing

  • Core focused tests: 49 passed, including configuration precedence, aliases, factor 1,
    overflow, candidate-stream isolation, and end-to-end reranking.
  • Spark 3 PrimaryKeyVectorSearchTest: 8 passed, including distributed driver-side reranking.
  • Compiled changed production modules without the fast-build profile.
  • Ran Spotless checks and git diff --check.

Notes

  • Reranking is disabled when no refine option is configured.
  • A refine factor of 1 recomputes exact scores without over-fetching.
  • This change does not modify table, index, or result formats.

@JingsongLi JingsongLi marked this pull request as ready for review July 13, 2026 05:56

@leaves12138 leaves12138 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the Core and Spark rerank paths, including candidate merging, snapshot-scoped physical rereads, deletion-vector handling, metric conversion, and refine option compatibility. Focused Core and Spark 3 tests passed locally.

@JingsongLi JingsongLi merged commit 7e396cf into apache:master Jul 13, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants