Repository navigation
branch-4.2: [improvement](be) Skip dictionary entry bodies of non-matching terms in SNII term expansion #69600 - #69637
Merged
Conversation
…in SNII term expansion ### What problem does this PR solve? Issue Number: None Related PR: apache#69600 Problem Summary: MATCH_REGEXP, wildcard, suffix and contains patterns without a literal prefix make SniiIndexSource::expand_terms enumerate the whole dictionary of every segment. LogicalIndexReader::visit_prefix_terms always passed an empty accept_key to DictBlockReader::visit_prefix_range, so the body of every dictionary entry was decoded (decode_dict_entry_rest) and the caller then rejected almost all of them with the required-text test and the pattern match. DictBlockReader already supports a key-only accept_key that skips the body of a rejected term. visit_prefix_terms now takes an optional accept_key, and expand_terms passes its term test (required text, then pattern match) as that predicate. Terms are tested exactly as before, only earlier, and the visitor still sees only accepted terms, so max_expansions and early stop count the same terms. Other callers keep the default (accept all). Measured on 99M AgentLogs rows (722 segments, tenant and status filters, token regexp 'transi.*', hot median): SNII 6028 ms -> 945 ms, V3 unchanged at about 590 ms. Patterns with a literal prefix (for example '^transi.*') seek into the dictionary and are unchanged. ### Release note Faster MATCH_REGEXP / wildcard term expansion on SNII inverted indexes. ### Check List (For Author) - Test: Unit Test (SniiRegexpQueryTest.AcceptKeySkipsBodiesOfRejectedTerms, SniiRegexpQueryTest.UnanchoredRegexpDecodesOnlyMatchedBodies) - Behavior changed: No - Does this need documentation: No Source-PR: apache#69600 Source-Head: 6979f7f Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Member
Author
|
run buildall |
Contributor
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
yiguolei
approved these changes
Oct 27, 2026
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.
What problem does this PR solve?
Issue Number: None
Related PR: #69600
Problem Summary: Backport of #69600 to branch-4.2. MATCH_REGEXP, wildcard, suffix and contains patterns without a literal prefix make
SniiIndexSource::expand_termsenumerate the whole dictionary of every segment.LogicalIndexReader::visit_prefix_termspassed an emptyaccept_key, so the body of every dictionary entry was decoded before the caller rejected almost all of them.visit_prefix_termsnow takes an optionalaccept_key, andexpand_termspasses its term test as that predicate, so a rejected term is skipped before its body is decoded. Terms are tested exactly as before, only earlier.Measured on master's parent line (99M AgentLogs rows, 722 segments): token regexp
transi.*on SNII 6028 ms -> 945 ms, V3 about 590 ms.Branch adaptations
None.
git cherry-pick -x 6979f7fa1eapplied cleanly to the current branch-4.2 and touches the same four files as the original:logical_index_reader.{h,cpp},snii_index_source.cppandsnii_query_test.cpp.Validation
logical_index_reader.h) was built and run on an earlier branch-4.2 base (ecbc5feab9):SniiB2T07Dict*andSniiRegexpQueryTest*, 31 tests passed, including the two new tests.Snii*passed (1373 tests) and the master CI passed all checks.Release note
Faster MATCH_REGEXP / wildcard term expansion on SNII inverted indexes.
Check List (For Author)
🤖 Generated with Claude Code