airborne12 commented on code in PR #67180:
URL: https://github.com/apache/doris/pull/67180#discussion_r4094280174


##########
be/src/storage/index/inverted/inverted_index_reader.cpp:
##########
@@ -477,7 +481,13 @@ Status FullTextIndexReader::query(const 
IndexQueryContextPtr& context,
             RETURN_IF_ERROR(match_index_search(context, query_type, 
query_info, *searcher_ptr,
                                                term_match_bitmap));
             term_match_bitmap->runOptimize();
-            cache->insert(cache_key, term_match_bitmap, &cache_handler);
+            // Only a bitmap whose query actually joined the candidate set is
+            // partial and must stay out of the cache; a non-consuming query
+            // (MATCH_ANY/ALL, term, regexp, single-term phrase) computed the
+            // full-segment result even while candidate_rows was published.
+            if (!context->candidate_rows_consumed) {
+                cache->insert(cache_key, term_match_bitmap, &cache_handler);

Review Comment:
   Confirmed and fixed in `cf18d345a26`. A new CLucene test runs a fulltext 
phrase and a string equality query with the result cache disabled, then enables 
the cache for the same keys. Before the fix, both second queries hit entries 
written by the disabled runs; after routing both full-result insertions through 
`insert_query_cache(...)`, both correctly miss and insert. The selected ASAN BE 
suite passed 29/29 after the follow-up.
   
   I reran `PhraseCandidatePushdownBench` on a 1,000,000-row RELEASE build 
three times with 10 samples per point. The PR table now uses those symmetric 
runs; the previous V2 `rare_exact` speedup fell from about 1.8x to near 1x once 
the disabled-cache insertion was removed. The rerun also exposed an SNII 
sparse-prefix slowdown, fixed in `bbf689f5e41` with a red/green profile test 
and included in the updated table.
   



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