Skip to content

branch-4.2: [improvement](be) Skip dictionary entry bodies of non-matching terms in SNII term expansion #69600 - #69638

Merged
yiguolei merged 1 commit into
branch-4.2from
auto-pick-69600-branch-4.2
Oct 27, 2026
Merged

yiguolei merged 1 commit into
branch-4.2from
auto-pick-69600-branch-4.2

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Cherry-picked from #69600

…in SNII term expansion (#69600)

### What problem does this PR solve?

Issue Number: None

Related PR: None

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. Result counts
are identical to V3 for regexp, leading-wildcard regexp and
phrase-prefix queries. Patterns with
a literal prefix (for example '^transi.*') seek into the dictionary and
are unchanged: SNII and
V3 are level at about 100 ms before and after. Gdb sampling showed 58%
of the time in
decode_dict_entry_rest before and about 5% after.
@github-actions
github-actions Bot requested a review from yiguolei as a code owner October 26, 2026 10:53
@hello-stephen

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?

@hello-stephen

Copy link
Copy Markdown
Contributor

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100.00% (10/10) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 76.24% (34488/45234)
Line Coverage 61.13% (389703/637506)
Region Coverage 57.76% (327389/566794)
Branch Coverage 58.90% (151438/257103)

@yiguolei
yiguolei merged commit 627eb86 into branch-4.2 Oct 27, 2026
35 of 36 checks passed
@github-actions

Copy link
Copy Markdown
Contributor Author

PR approved by anyone and no changes requested.

@github-actions github-actions Bot added the approved Indicates a PR has been approved by one committer. label Oct 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor Author

PR approved by at least one committer and no changes requested.

@airborne12
airborne12 deleted the auto-pick-69600-branch-4.2 branch October 27, 2026 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants