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

   ### What problem does this PR solve?
   
   Issue Number: N/A
   
   Related PR: #65821 (master), picked from commit 
2b6a45e7e2cb12d091ce0253366e50fca4efd5d3
   
   Problem Summary:
   
   Backport of #65821 to branch-4.1. Search score TopN pushdown may return 
incorrect results when the search predicate is combined with additional 
predicates, because the pushed TopN limit can be applied before the remaining 
predicates are evaluated. This change disables the pushed search TopN limit in 
those cases while preserving the virtual score column pushdown, and adds 
regression coverage (search + equality / range / match / score range / multiple 
search predicates, plus limit+offset overflow).
   
   **Hunk audit (source diff → this PR):**
   
   | Source hunk | Status |
   |---|---|
   | `PushDownScoreTopNIntoOlapScan.java` `@@ -194,17 +194,22 @@` (overflow 
guard rework + pushedScoreLimit) | **Adapted ×2**: ① branch-4.1 never had the 
#64633 overflow-guard block, so the hunk's removed lines have no counterpart 
here; ② `Utils.addOverflows` does not exist on 4.1 (#64633 not backported) — 
inlined the equivalent check `topN.getLimit() > Long.MAX_VALUE - 
topN.getOffset()` (identical to the master helper's implementation). |
   | `PushDownScoreTopNIntoOlapScan.java` `@@ -243,6 +248,19 @@` 
(`shouldDisableSearchTopN` helper) | Ported |
   | `test_search_score_topn_predicates.out` (new) | Ported (verbatim) |
   | `test_search_score_topn_predicates.groovy` (new) | **Adapted**: dropped 
`set enable_segment_limit_pushdown = true` — the variable comes from #62222 
which is not on 4.1; it defaults to true on master and only controls a BE-side 
segment limit optimization, unrelated to this FE-plan-level fix. |
   
   **Local verification on this branch:** full ASAN BE+FE build green; 
`run-regression-test.sh -d inverted_index_p0 -s 
test_search_score_topn_predicates` → 1 suite, 0 failed against a local 1FE+1BE 
cluster built from this PR. No FE UT exists for this rule on 4.1 and the source 
PR added none (its coverage is the regression suite above).
   
   ### Release note
   
   None
   
   ### Check List (For Author)
   
   - Test <!-- At least one of them must be included. -->
       - [x] Regression test
       - [ ] Unit Test
       - [ ] Manual test (add detailed scripts or steps below)
       - [ ] No need to test or manual test. Explain why:
           - [ ] This is a refactor/code format and no logic has been changed.
           - [ ] Previous test can cover this change.
           - [ ] No code files have been changed.
           - [ ] Other reason <!-- Add your reason?  -->
   
   - Behavior changed:
       - [x] No.
       - [ ] Yes. <!-- Explain the behavior change -->
   
   - Does this need documentation?
       - [x] No.
       - [ ] Yes. <!-- Add document PR link here. eg: 
https://github.com/apache/doris-website/pull/1214 -->
   
   ### Check List (For Reviewer who merge this PR)
   
   - [ ] Confirm the release note
   - [ ] Confirm test cases
   - [ ] Confirm document
   - [ ] Add branch pick label <!-- Add branch pick label that this PR should 
merge into -->


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