morrySnow opened a new pull request, #67541:
URL: https://github.com/apache/doris/pull/67541
### What problem does this PR solve?
Issue Number: None
Related PR: None
Problem Summary:
`AddProjectForJoin` inserts a `LogicalProject` above every Join before
classic Cascades exploration. Most of these Projects contain only Slots, but
the standalone `PushDownProjectThroughSemiJoin` and
`PushDownProjectThroughInnerOuterJoin` exploration rules still expand child
groups and assemble temporary Plans before their predicates reject the match.
This creates substantial CPU and allocation overhead as the Memo grows.
This change:
- extracts the existing Project normalization logic into a shared helper;
- invokes that helper only when a Project-aware Join reorder rule is ready
to produce an alternative;
- covers inner associate/asscom/exchange, outer associate/asscom, and
semi-join transpose paths;
- removes the two standalone PushDown rule factories from classic
`OTHER_REORDER_RULES`;
- keeps the standalone rules and their `AFTER_DPHYP_REORDER_RULES`
registration unchanged for DPHyp.
Local FE-only validation:
- 24 targeted FE unit tests passed, including helper edge cases, all
Project-aware reorder families, the existing standalone rule tests, and a
complete `AddProjectForJoin -> classic optimizer` path.
- TPC-H 22, TPC-DS 99, and one DPHyp smoke query produced identical
optimizer mode, physical Plan fingerprint, root cost, and limit state between
the registered baseline and candidate.
- The candidate removed 162 redundant Memo expressions across six workload
queries without changing the selected Plan.
- Across 12 STAR/DENSE × SLOT/COMPLEX × 3/8/16-table JMH pairs, candidate
mean planning time and allocation/op were lower in every configuration. The
geometric baseline/candidate ratios were 1.066x/1.114x for Slot Projects and
1.698x/1.617x for Complex Projects.
- In a 9-table JFR workload, candidate main-thread allocation fell 16.2%,
matcher allocation 34.4%, Plan-assembly allocation 39.4%, and
`withGroupExprLogicalPropChildren` allocation 40.7%.
All temporary instrumentation, JMH/JFR harnesses, and local analysis
documents were removed from this commit.
### Release note
Reduce Nereids classic Cascades planning overhead for queries with multiple
joins.
### Check List (For Author)
- Test
- [ ] 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
- Behavior changed:
- [ ] No.
- [x] Yes. Classic Cascades now normalizes Complex Projects while
producing Join reorder alternatives instead of through standalone exploration
rules. DPHyp behavior is unchanged.
- Does this need documentation?
- [x] No.
- [ ] Yes.
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label
--
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]