Skip to content

branch-4.0: [fix](inverted index) Make select_best_reader deterministic for multi-index columns #61596 - #61637

Closed
github-actions[bot] wants to merge 1 commit into
branch-4.0from
auto-pick-61596-branch-4.0
Closed

branch-4.0: [fix](inverted index) Make select_best_reader deterministic for multi-index columns #61596#61637
github-actions[bot] wants to merge 1 commit into
branch-4.0from
auto-pick-61596-branch-4.0

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Cherry-picked from #61596

…-index columns (#61596)
### What problem does this PR solve?
Issue Number: close #DORIS-24685
Related PR: N/A
Problem Summary:
When multiple inverted indexes with different analyzers exist on the
same column, `select_best_reader()` returns the first matching candidate
based on iteration order of `_reader_entries`. Since `_reader_entries`
ordering depends on the rowset schema's index ordering, and different
segments can have different orderings (e.g. after sequential `BUILD
INDEX` operations), the same query selects different indexes for
different segments, producing inconsistent results.
Fix: Replace all order-dependent candidate selection in
`select_for_text()`, `select_for_numeric()`, and `select_best_reader()`
with deterministic selection by smallest `index_id` via
`pick_preferred()` and `pick_smallest_index_id()` helpers. This ensures
consistent index selection regardless of schema ordering across
segments.
@Thearas

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@Thearas

Copy link
Copy Markdown
Contributor

run buildall

@morrySnow
morrySnow deleted the auto-pick-61596-branch-4.0 branch August 31, 2026 06:58
Sign up for freeto 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.

4 participants

@Thearas@yiguolei@dataroaring@airborne12