eldenmoon opened a new pull request, #69214:
URL: https://github.com/apache/doris/pull/69214

   ### What problem does this PR solve?
   
   Issue Number: DORIS-29489
   
   Problem Summary:
   
   `SEARCH` with `score()` over a VARIANT sub-column fails on this branch with
   
   ```
   ERROR 1105 (HY000): errCode = 2, detailMessage = Index statistics collection 
failed:
   Not such column 2.v.content
   ```
   
   `SearchPredicateCollector::collect_from_leaf` resolved the clause's field 
name only through `tablet_schema->field_index(field_name)`. A VARIANT path such 
as `v.content` is not a tablet-schema column while the path is not 
materialized, so the clause returned early and the collection statistics were 
gathered for no field at all. The read side then asks the statistics for the 
same path (`<parent uid>.<parent>.<path>`, the Lucene field the index files 
were written with) and throws `INVERTED_INDEX_CLUCENE_ERROR` as `Not such 
column`.
   
   `MatchPredicateCollector` already resolves the same shapes from schema: 
materialized/typed paths, `field_pattern` templates, and a plain parent index 
inherited by the dynamic VARIANT placeholder. This PR moves that resolution 
into one helper (`resolve_scoring_index_candidates`) and uses it from the 
SEARCH collector too. When the clause field is not a tablet-schema column, the 
collector now builds the same synthetic VARIANT column the scan uses for a 
dynamic path (parent unique id + full path) and resolves it through the parent 
index, keeping the cloned index metadata alive through 
`CollectInfo::owned_index_meta`. Unresolvable names keep the previous skip, so 
only VARIANT paths gain collection.
   
   The regression suite reproduces the reported query (the same table as 
DORIS-29489) and also covers phrase scoring and a `field_pattern` VARIANT index.
   
   ### Release note
   
   `score()` now works over `SEARCH` on VARIANT sub-columns served by a parent 
VARIANT inverted index.
   
   ### Check List (For Author)
   
   - Test <!-- At least one of them must be included. -->
       - [x] Unit Test
         
`CollectionStatisticsTest.ExtractSearchCollectInfoForVariantParentIndexWithoutTemplate`
 covers the collector resolution (`run-be-ut.sh`).
       - [x] Regression test
         
`regression-test/suites/search/test_search_variant_subcolumn_bm25.groovy`.
       - [ ] Manual test (add detailed scripts or steps below)
       - [ ] No need to test or manual test. Explain why below to give a good 
reason
   - Behavior changed: Yes (SEARCH + score() on VARIANT sub-columns returns 
scored rows instead of failing with `Not such column`)
   - Does this need documentation: No
   


-- 
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