morrySnow opened a new pull request, #58964:
URL: https://github.com/apache/doris/pull/58964
### What problem does this PR solve?
Related PR: #21412
Problem Summary:
This pull request improves the handling of distribution properties
(specifically "must shuffle") for `PhysicalProject` and `PhysicalFilter` nodes
in the query planner, and adds comprehensive unit tests to ensure correctness.
The main logic ensures that when certain child nodes require shuffling, the
planner correctly adjusts the distribution requirements, especially in the
presence of `Project`, `Filter`, and `Limit` nodes.
Key changes include:
**Distribution Property Handling Enhancements:**
* Added logic in `ChildrenPropertiesRegulator` to check if a child node
under a `PhysicalProject` or `PhysicalFilter` requires a "must shuffle"
distribution, and to adjust the children’s properties accordingly. This is done
via the new `mustShuffleUnderProjectOrFilter` method.
[[1]](diffhunk://#diff-79d8abdb9d7855b95a985ffa9b4ddbe1c646b58245fc2d0c02bef33374743777R281-R288)
[[2]](diffhunk://#diff-79d8abdb9d7855b95a985ffa9b4ddbe1c646b58245fc2d0c02bef33374743777R605-R612)
[[3]](diffhunk://#diff-79d8abdb9d7855b95a985ffa9b4ddbe1c646b58245fc2d0c02bef33374743777R320-R338)
* Included `PhysicalLimit` in the set of nodes that can trigger a shuffle
requirement, by updating imports and logic.
[[1]](diffhunk://#diff-79d8abdb9d7855b95a985ffa9b4ddbe1c646b58245fc2d0c02bef33374743777R40)
[[2]](diffhunk://#diff-79d8abdb9d7855b95a985ffa9b4ddbe1c646b58245fc2d0c02bef33374743777R320-R338)
**Testing Improvements:**
* Added a new test class `ChildrenPropertiesRegulatorTest.java` with
detailed unit tests for the handling of "must shuffle" properties under
`Project`, `Filter`, and `Limit` nodes. These tests use mocks to simulate
various plan trees and assert correct distribution specification propagation.
**Regression Test Coverage:**
* Added a new regression test in `cte.groovy` to verify correct behavior
when multiple `Project` nodes are present on a CTE consumer, ensuring the
planner handles such cases as expected.
These changes collectively make the planner more robust in handling complex
plan trees with respect to distribution requirements, and ensure correctness
through thorough testing.
### Release note
None
### Check List (For Author)
- Test <!-- At least one of them must be included. -->
- [x] Regression test
- [x] 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]