Uh oh!
There was an error while loading. Please reload this page.
[pick](branch-4.0)[fix](inverted index) Make select_best_reader deterministic for multi-index columns #61596 - #61692
Merged
Conversation
…-index columns (apache#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
commented
Mar 25, 2026
Contributor
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
airborne12
commented
Mar 25, 2026
MemberAuthor
run buildall |
airborne12
commented
Mar 25, 2026
MemberAuthor
run buildall |
hello-stephen
commented
Mar 25, 2026
Contributor
BE UT Coverage ReportIncrement line coverage Increment coverage report
|
hello-stephen
commented
Mar 25, 2026
Contributor
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
yiguolei
approved these changes
Mar 25, 2026
Contributor
PR approved by at least one committer and no changes requested. |
Contributor
PR approved by anyone and no changes requested. |
hello-stephen
commented
Mar 25, 2026
Contributor
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
Uh oh!
There was an error while loading. Please reload this page.
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 freeto 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.
What problem does this PR solve?
Issue Number: close #xxx
Related PR: #61596
Problem Summary:
Pick #61596 to branch-4.0.
When a column has multiple inverted indexes (e.g., different analyzers), select_best_reader could return different readers depending on std::unordered_map iteration order, causing non-deterministic behavior. This fix sorts candidate readers by index_id to ensure deterministic selection.
Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)