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

   ### What problem does this PR solve?
   
   Issue Number: None
   Related PR: #70678
   PR Type: Improvement
   
   Problem Summary:
   
   Backport of #70678 to branch-4.1. It is not a cherry-pick: branch-4.1's 
SEARCH engine has neither the row listing nor the scan's candidate pushdown 
that #70678 builds on, so the same change is written against 4.1's collector 
and scan.
   
   A SEARCH next to a selective filter outside it, such as `account_id = X AND 
search(...)`, evaluated the SEARCH over the whole segment and intersected the 
account's rows only afterwards.
   
   - A SEARCH that is a whole filtering conjunct now gets the rows the scan 
still holds (after the column index filters, key ranges, zone maps and the 
delete bitmap) through `IndexQueryContext::search_root_candidates`. Its result 
is intersected into those rows as before.
   - An unscored SEARCH collects its root only within those rows. When there 
are few, it seeks the scorer to each one; when there are many, it reads the 
scorer through and keeps the ones in the set.
   - A result read this way is partial, so it never goes into the DSL cache.
   - Scored SEARCH, and SEARCH used as a projection or inside a compound 
predicate, are unchanged.
   
   ### Numbers on branch-4.1
   
   2M rows, 3 BEs, inverted index on `account_id`, caches off, median of 12 
runs alternating the two builds. Rows are identical on all 19 queries.
   
   | query | before | after |
   |---|---|---|
   | ranking query of 16 SEARCH scans, account with 681 rows | 1342 ms, 8.4 s 
CPU | 1003 ms, 6.0 s CPU |
   | same, account with 50K rows (2.5%) | 1958 ms, 11.2 s CPU | 1846 ms, 11.0 s 
CPU |
   | single SEARCH, `score()` and top-k queries | | unchanged |
   
   ### Release note
   
   None
   
   ### Check List (For Author)
   
   - Test
       - [x] Regression test
           - `search/test_search_outer_filter_candidates`, from #70678. The 
`.out` was generated on branch-4.1 without this change, and it is identical to 
the one on master. The suite passes with and without this change.
           - All 42 `search/` suites pass on a local branch-4.1 cluster, with 
and without this change.
       - [x] Unit Test: 
`MultiSegmentCollectorTest.CollectionWithinCandidatesKeepsTheirMatches` (a few 
rows are seeked to, many are read through, and both keep the same matches) and 
`MultiSegmentCollectorTest.CollectionWithinCandidatesAcrossSegments` (an index 
of several CLucene segments).
   - Behavior changed: No. Rows and scores are the same.
   - 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