Mryange opened a new pull request, #63902:
URL: https://github.com/apache/doris/pull/63902
### What problem does this PR solve?
Problem Summary:
For TopN queries with computed order keys, such as `SELECT
MURMUR_HASH3_32(number) AS n FROM numbers_20m ORDER BY n LIMIT 65535`, Doris
created a TopN runtime predicate but could not push it down to storage because
the target was an expression instead of a slot/key column. However, heap sort
treated the existence of any runtime predicate as a reason to disable its local
TopN pruning, so this path lost local pruning without gaining effective
scan-side pruning.
This PR narrows that condition. Heap sort now disables local TopN pruning
only when the runtime predicate targets are all slots. Expression order keys
keep the local heap filter, which restores early row pruning in the sorter.
In local reproduction of `function_order_by_number_limit_big`, Doris
improved from about 2.3s to 2.8s down to about 0.53s to 0.69s, and the new
profile shows `TopNFilterRows: 19.555616M` instead of `0`.
### Release note
None
### Check List (For Author)
- Test <!-- At least one of them must be included. -->
- [ ] 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:
- [ ] No.
- [ ] Yes. <!-- Explain the behavior change -->
- Does this need documentation?
- [ ] 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]