[fix](fe) Reject score on non-scoring SNII indexes - #66872
Conversation
### What problem does this PR solve? Issue Number: None Related PR: apache#66052 Problem Summary: FE admitted score() plans for every phrase-enabled SNII inverted index, but built-in analyzers and ordinary custom analyzers write only the docs-and-positions tier. They do not persist norms or semantic scoring metadata, so the BE later failed while opening scoring statistics. Reject those plans at the selected-index admission gate and admit SNII scoring only for indexes created with a CommonGrams analyzer, which writes the scoring tier. Existing V3 behavior is unchanged. ### Release note Reject score() queries on SNII indexes that do not persist scoring data instead of failing later in the BE. ### Check List (For Author) - Test: Unit Test - Added end-to-end score pushdown cases for built-in, plain custom, and CommonGrams SNII analyzers - Ran CheckScoreUsageTest: 20 tests passed - Ran the full FE build with 192-way parallelism - Behavior changed: Yes, score() plans for non-scoring SNII indexes now fail during FE analysis; index writes and the storage format are unchanged - Does this need documentation: No
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
|
run buildall |
TPC-H: Total hot run time: 17020 ms |
TPC-DS: Total hot run time: 81500 ms |
FE Regression Coverage ReportIncrement line coverage |
|
/review |
There was a problem hiding this comment.
Requesting changes: the new SNII score admission has three P1 correctness gaps. It uses current analyzer policy as a proxy for persisted segment capability, applies capability checks to predicates that do not contribute BM25, and validates a generic SEARCH index that can differ from the runtime index for EXACT.
Critical checkpoint conclusions:
- Goal and proof: The narrow mocked built-in/plain cases are covered, but the claimed end-to-end rejection is not established; CommonGrams data can still fail later, while valid mixed filters can now be rejected.
- Scope and clarity: The diff is small, but the helper conflates policy identity, score-contributor classification, physical-index routing, and persisted capability.
- Concurrency: No new threads or mutable shared state are introduced. Existing IndexPolicyMgr read locking is sound; no race, lock-order, or deadlock issue was found.
- Lifecycle: Policy drop/replay is protected, but legacy, build-disabled, mixed, rolling-upgrade, and replica-divergent segments outlive the current analyzer classification (inline issue).
- Configuration: No configuration is added. Existing dynamic enable_common_grams_index_build is snapshotted per writer and invalidates analyzer-only admission.
- Compatibility: No protocol or storage-format change is added and V3 behavior is structurally unchanged, but old/pre-metadata SNII segments are not conservatively handled.
- Parallel and conditional paths: MATCH and SEARCH were both traced. Non-scoring SEARCH/direct-MATCH leaves and EXACT multi-index routing are the two path-specific inline issues; other supported score-bearing routes align.
- Tests and results: The new JUnit cases are deterministic but mock policy results and miss persisted missing/mixed segments, contributor mixtures, and EXACT multi-index selection. CI FE UT, CheckStyle, compile, and regression checks observed during review were green; no local build or tests were run because this review environment forbids them.
- Observability and errors: Error conversion/context is adequate; no additional metric or logging issue was found.
- Transactions, persistence, writes, and FE/BE variables: No transaction, edit-log, data-write, or new protocol-variable path is modified.
- Performance and resource safety: Planning-time lookups are bounded; no material CPU, memory, nullability, or resource issue was found.
- Other/final sweep: All three review rounds converged with no unresolved candidate beyond the three inline findings.
User focus: no additional focus was provided.
FE Regression Coverage ReportIncrement line coverage |
|
(Edited: the original wording of this note was wrong about the outcome. See the follow-up comment for the decision and the reasoning behind it.) #67134 decouples SNII BM25 scoring from CommonGrams, which invalidates the premise this PR's new rejections rest on. CommonGrams is a phrase-query performance optimization; scoring was coupled to it only because the semantic collection statistics BM25 needs were introduced inside the CommonGrams segment metadata. V1/V2/V3 rank an ordinary So the two rejections this PR adds would refuse queries that now work, and need to be narrowed to what remains true: an SNII index that is not analyzed at all (no parser, no analyzer) still has no scoring data, exactly as on V1/V2/V3. Status of the three review findings:
Thanks for the review — right on all three counts. |
|
Closing. The decision comes down to a behaviour comparison with V1/V2/V3, which I should have run before opening this. What V1/V2/V3 do when
An unscoreable index is a field that contributes no relevance, not an error. That matches every mainstream engine — Elasticsearch's With #67134 in, SNII lines up with that contract almost exactly:
Adding an FE rejection for SNII would make the first two rows diverge, not converge: the same SQL would return rows on a V3 table and fail at analysis time on an SNII one. That is the opposite of what this PR set out to achieve. The one genuine divergence left is the third row, and it is a BE issue, not an FE one: Also carrying forward, independent of scoring: the FE/BE index-resolution divergence from the third review thread. Thanks for the review — all three findings were correct, and two of them are what showed this rule belonged one layer down. |
What problem does this PR solve?
Issue Number: None
Related PR: #66052
Problem Summary: FE admitted score() plans for every phrase-enabled SNII inverted index, but built-in analyzers and ordinary custom analyzers write only the docs-and-positions tier. They do not persist norms or semantic scoring metadata, so the BE later failed while opening scoring statistics. This PR rejects those plans at the selected-index admission gate and admits SNII scoring only for indexes created with a CommonGrams analyzer, which writes the scoring tier. Existing V3 behavior is unchanged. The change is query admission only and does not modify index writes or the storage format.
Release note
Reject score() queries on SNII indexes that do not persist scoring data instead of failing later in the BE.
Check List (For Author)
Test
Added end-to-end score pushdown cases for built-in, plain custom, and CommonGrams SNII analyzers. CheckScoreUsageTest passes all 20 tests. The full FE build passes with Checkstyle reporting zero violations.
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)