github-actions[bot] commented on code in PR #69790:
URL: https://github.com/apache/doris/pull/69790#discussion_r4420225595


##########
be/src/storage/index/inverted/reader/collection_statistics.cpp:
##########
@@ -73,6 +73,15 @@ Result<std::shared_ptr<lucene::search::IndexSearcher>> 
open_optional_clucene_sta
         }
         return ResultError(status);
     }
+    // A segment can index a field with BKD although the tablet schema calls 
it text: a VARIANT
+    // path is typed per segment, so CAST(v['n'] AS STRING) MATCH '1' collects 
statistics for v.n,
+    // which a segment holding numbers indexed as BKD. That index has no terms 
and no segments file
+    // to open, so it adds no statistics, as a segment without the path does; 
its rows match
+    // without the index and score nothing.
+    if (compound.value()->fileExists(
+                
InvertedIndexDescriptor::get_temporary_bkd_index_data_file_name())) {
+        return std::shared_ptr<lucene::search::IndexSearcher> {};
+    }

Review Comment:
   [P1] Treat missing SNII dynamic paths as absent during statistics 
collection. For an untyped VARIANT path, the collector clones the parent index 
for every segment. If a segment has no `(index_id, suffix)` entry, 
`is_snii_bkd_index()` returns false here, so `open_snii_index()` below returns 
`INVERTED_INDEX_SNII_NOT_FOUND`; `process_segment()` then aborts the whole 
score collection with `INVERTED_INDEX_NOT_SUPPORTED`. A path can legitimately 
exist only in some segments, and the V2/V3 helper already skips missing 
indexes, so `CAST(v['present'] AS STRING) MATCH ...` with `score()` fails on 
SNII when another segment lacks that path. Treat a missing logical index as an 
absent field for this dynamic fallback while preserving corruption errors, and 
add a sparse-path regression.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to