Skip to content

[core] Stabilize scored global index top-k tie-breaking#8301

Open
QuakeWang wants to merge 1 commit into
apache:masterfrom
QuakeWang:fix-topk-ties
Open

[core] Stabilize scored global index top-k tie-breaking#8301
QuakeWang wants to merge 1 commit into
apache:masterfrom
QuakeWang:fix-topk-ties

Conversation

@QuakeWang

Copy link
Copy Markdown
Member

Purpose

ScoredGlobalIndexResult.topK used a min-heap ordered only by score, and replaced the heap head only when a new row had a strictly higher score. When rows tied around the top-k boundary, the retained row IDs could differ from the expected score desc, rowId asc ranking semantics.

This patch makes the heap head represent the weakest retained candidate by score asc, rowId desc, so tied boundary rows prefer smaller row IDs while keeping the existing O(n log k) algorithm.

Tests

  • mvn -pl paimon-common -Dtest=ScoredGlobalIndexResultTest,HybridSearchRankerTest test

Signed-off-by: QuakeWang <wangfuzheng0814@foxmail.com>
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.

1 participant