Uh oh!
There was an error while loading. Please reload this page.
[fix](be) Normalize SNII prefix syntax before analysis - #66874
Conversation
### What problem does this PR solve? Issue Number: None Related PR: apache#66052 Problem Summary: SEARCH PREFIX values retain the trailing DSL `*` marker in FE. SNII classifies custom keyword analyzers as analyzed, but those analyzers preserve the marker as a literal byte, so phrase-prefix queries searched for `fail*` instead of the indexed prefix `fail` and returned no rows. Strip exactly the trailing DSL marker before SNII phrase-prefix analysis while preserving the existing wildcard path for non-analyzed fields and V3. ### Release note Fix SEARCH PREFIX queries on SNII indexes that use a custom keyword analyzer. ### Check List (For Author) - Test: Unit Test - Added a real custom keyword analyzer reproduction and verified the red-green transition - Ran all 98 FunctionSearch tests - Ran `./build.sh --be -j 192` with ASAN - Behavior changed: Yes. SNII phrase-prefix queries no longer pass the DSL `*` marker to analyzed readers. - Does this need documentation: No
hello-stephen
commented
Aug 18, 2026
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
airborne12
commented
Aug 18, 2026
run buildall |
hello-stephen
commented
Aug 18, 2026
TPC-H: Total hot run time: 17055 ms |
hello-stephen
commented
Aug 18, 2026
TPC-DS: Total hot run time: 81239 ms |
hello-stephen
commented
Aug 18, 2026
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
airborne12
commented
Aug 24, 2026
/review |
There was a problem hiding this comment.
Automated code review summary
Overall conclusion: no blocking correctness issue or other substantiated review finding was identified. The change is focused and the reviewed behavior is consistent across the relevant SEARCH and inverted-index paths.
Critical checkpoints:
- Goal and proof: the patch removes exactly the trailing PREFIX DSL syntax marker before analyzed SNII phrase-prefix processing. The added unit test uses a real custom keyword tokenizer/analyzer to prove that
fail*otherwise remains a literal token, then verifies thatbuild_leaf_querysendsfailwithMATCH_PHRASE_PREFIX_QUERYand returns the expected bitmap. The existing non-analyzed keyword PREFIX test continues to prove the WILDCARD route keeps*. - Scope and clarity: only the SNII-native value normalization/logging and its targeted FunctionSearch test change. The implementation reuses the existing query-type split and keeps the V3/CLucene and direct-reader paths untouched.
- Concurrency and lifecycle: production changes use request-local state and add no locks or shared mutable state. The test-scoped
IndexPolicyMgris restored withDEFERbefore the stack manager is destroyed, matching the established test pattern; policy cleanup is explicit. - Conditions and parallel paths: FE standard and Lucene parser modes are the only production PREFIX producers, standalone
*becomes MATCH_ALL_DOCS, thrift serialization preserves the suffix, and escaped literal-star forms retain literal data when the single syntax byte is removed. Non-analyzed PREFIX is rerouted to WILDCARD before normalization; ordinary WILDCARD, null-bitmap handling, and V3 behavior remain unchanged. - Analyzer, cache, and execution semantics: the stripped logical prefix is used consistently for SNII analysis, raw-query/cache and single-flight identity, CommonGrams planning, prefix expansion and max-expansions handling, and optional scoring. No analyzer needs the DSL marker as indexed content.
- Compatibility and persistence: this is query-only. It adds no configuration, FE-BE field, symbol/storage-format change, write path, transaction state, or persisted metadata, so no index rebuild or replay/rolling-format compatibility path is required.
- Error handling and observability: existing Status propagation is preserved; the new
DORIS_CHECKs encode the verified FE/serialization invariant. Debug logging retains the original caller value whenever normalization changes it. - Performance: the existing per-leaf string copy remains, with only a constant-time suffix check and removal; no hot-path scan, allocation class, or I/O behavior is added.
- Test and CI evidence: targeted BE unit coverage is present. Relevant live checks for this head are green, including BE UT, macOS BE UT, compile, clang formatting, P0/nonconcurrent/external regression, dependency review, and coverage. Per the runner review instructions, no local build was run during this review.
- User focus: no additional user-provided focus was specified.
Review convergence: two complementary full-review agents and one dedicated PREFIX/analyzer risk agent all returned NO_NEW_VALUABLE_FINDINGS in round 1. The main-agent final changed-file and unresolved-candidate sweep also found no remaining suspicious point. No inline comments are proposed.
Uh oh!
There was an error while loading. Please reload this page.
What problem does this PR solve?
Issue Number: None
Related PR: #66052
Problem Summary:
SEARCH ... PREFIXvalues retain their trailing DSL*marker in FE. SNII classifies a custom keyword analyzer as analyzed, but that analyzer preserves the marker as a literal byte. Consequently, a predicate such asfail*sentfail*to the phrase-prefix reader instead of the indexed prefixfailand returned no rows, while V3 matched the expected documents.This PR strips exactly the trailing DSL marker before SNII phrase-prefix analysis. Non-analyzed keyword fields continue to use
WILDCARD_QUERYwith the marker intact, ordinary WILDCARD clauses are unchanged, and the V3 path is unchanged. The change is query-only: it does not alter index writes or the on-disk format, so existing SNII indexes are fixed after upgrade without rebuilding.TDD evidence:
fail*;FunctionSearch::build_leaf_querysentfail*and produced an empty bitmap instead of{0, 2}.fail, retainsMATCH_PHRASE_PREFIX_QUERY, and produces{0, 2}.FunctionSearchTestcases pass../build.sh --be -j 192passes with ASAN.build-support/check-format.shpasses.Release note
Fix SEARCH PREFIX queries on SNII indexes that use a custom keyword analyzer.
Check List (For Author)
Test
Behavior changed:
*syntax marker to analyzed readers.Does this need documentation?
Check List (For Reviewer who merge this PR)