morrySnow opened a new pull request, #59877:
URL: https://github.com/apache/doris/pull/59877
### What problem does this PR solve?
Issue Number: close #xxx
Related PR: #xxx
Problem Summary:
This pull request refactors how `GroupPlan` instances are created and
accessed throughout the codebase. Instead of creating new `GroupPlan` objects
from a `Group`, the code now consistently uses a single `GroupPlan` instance
per `Group` via a new `getGroupPlan()` method. This improves memory efficiency,
code clarity, and ensures consistency across the planner and matcher logic.
### Core API and Data Model Changes
* Added a private `GroupPlan` field to the `Group` class and initialized it
in constructors; exposed it via a new `getGroupPlan()` method. This ensures
each `Group` has a unique, reusable `GroupPlan` instance.
[[1]](diffhunk://#diff-dc5e6a82ea2e54bd9bcf8da1b1b65d59758b5104ecf25221b6f839c8e427df99R64)
[[2]](diffhunk://#diff-dc5e6a82ea2e54bd9bcf8da1b1b65d59758b5104ecf25221b6f839c8e427df99R94)
[[3]](diffhunk://#diff-dc5e6a82ea2e54bd9bcf8da1b1b65d59758b5104ecf25221b6f839c8e427df99R105)
[[4]](diffhunk://#diff-dc5e6a82ea2e54bd9bcf8da1b1b65d59758b5104ecf25221b6f839c8e427df99R180-R183)
### Refactoring: Use of GroupPlan
* Refactored all usages where a new `GroupPlan` was constructed from a
`Group` to instead use the `getGroupPlan()` method, including planner logic,
memoization, and pattern matching. This change appears in files such as
`HyperGraph.java`, `PlanReceiver.java`, `Memo.java`,
`GroupExpressionMatching.java`, `GroupMatching.java`, `DistributionSpec.java`,
and `OrderSpec.java`.
[[1]](diffhunk://#diff-a583cc64e3dacdc4f5fd7445414c9d48cd94f5fb0d9eaa7d1a3a6bc69e7e347bL403-R405)
[[2]](diffhunk://#diff-4155b70e30cabf577ca7a18b53f766032da352e3b9acd98c16f286914e60f637L105-R106)
[[3]](diffhunk://#diff-4155b70e30cabf577ca7a18b53f766032da352e3b9acd98c16f286914e60f637L208-R208)
[[4]](diffhunk://#diff-6356d1436a9d19acaceecf79d32bf1f019c7f633ab0c470fcc255658c6c1dfdbL749-R749)
[[5]](diffhunk://#diff-3b4089396e40458dc54492577936ce188647b9adbeedbc074035a03f9291e33cL114-R113)
[[6]](diffhunk://#diff-03ca03179036b9059c752f23ce675b979ee53159683200c7e7b8b3d622be03dcL38-R38)
[[7]](diffhunk://#diff-242ee2c60ac7
e4b4dc3e395a5a46cca2186251c3ba99146105a20beae4b30ba3L47-R47)
[[8]](diffhunk://#diff-486239be77f8aea72f636d2c4e38ff0c3c83e747cdc3390a5836624f8240f5a5L70-R69)
[[9]](diffhunk://#diff-486239be77f8aea72f636d2c4e38ff0c3c83e747cdc3390a5836624f8240f5a5L81-R80)
### Imports Cleanup
* Removed unused imports of `GroupPlan` in files where direct instantiation
is no longer needed, improving code cleanliness.
[[1]](diffhunk://#diff-3b4089396e40458dc54492577936ce188647b9adbeedbc074035a03f9291e33cL23)
[[2]](diffhunk://#diff-486239be77f8aea72f636d2c4e38ff0c3c83e747cdc3390a5836624f8240f5a5L22)
These changes collectively improve the consistency and efficiency of plan
representation in the query optimizer.
### 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:
- [ ] 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]