Larborator opened a new pull request, #63851:
URL: https://github.com/apache/doris/pull/63851
### What problem does this PR solve?
#53403 short-circuited distributionPrune to return the entire
nereidsPrunedTabletIds set when running under Nereids. However, the caller
computeTabletInfo invokes distributionPrune inside a per-partition loop and
then iterates the returned ids, calling MaterializedIndex.getTablet(id) on
each. When nereidsPrunedTabletIds contains tablets across many
partitions, every per-partition iteration walks the entire global set and
does a getTablet hash lookup on ids that belong to other partitions (which are
then filtered out by the null check), yielding O(partitionNum *
globalPrunedSize) lookups. The short-circuit also copies the full HashSet into
a new ArrayList once per partition.
Filter the global set down to the current partition's tablet ids
(tabletIdsInOrder, already prepared by the caller) before returning. The result
is identical to what the caller's null-check would have produced, so behavior
is unchanged; only the redundant lookups and copies are eliminated. The
non-Nereids path, the sampleTabletIds path and the empty-set
fallback are untouched.
Issue Number: close #xxx
Related PR: #53403
Problem Summary:
Plan time of OlapScan queries with many partitions and many globally pruned
tablets degrades quadratically due to redundant per-partition iterations over
the global pruned tablet set in OlapScanNode.distributionPrune. Restore
per-partition complexity by filtering the global set down to the current
partition's tablets before returning.
### 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)
- [x] No need to test or manual test. Explain why:
- [ ] This is a refactor/code format and no logic has been changed.
- [x] 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]