This is an automated email from the ASF dual-hosted git repository.
englefly pushed a commit to branch tpc_preview
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/tpc_preview by this push:
new 78e79148d6d PushDownJoinOnAssertNumRows rule (#58221)
78e79148d6d is described below
commit 78e79148d6d9cf302da94a86942cab41a1b207f1
Author: minghong <[email protected]>
AuthorDate: Fri Nov 21 14:17:59 2025 +0800
PushDownJoinOnAssertNumRows rule (#58221)
### What problem does this PR solve?
Issue Number: close #xxx
Related PR: #xxx
Problem Summary:
### 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 -->
---
.../rules/rewrite/PushDownJoinOnAssertNumRows.java | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PushDownJoinOnAssertNumRows.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PushDownJoinOnAssertNumRows.java
index 3300bce5447..ef696d1f3bc 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PushDownJoinOnAssertNumRows.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PushDownJoinOnAssertNumRows.java
@@ -216,8 +216,21 @@ public class PushDownJoinOnAssertNumRows extends
OneRewriteRuleFactory {
@VisibleForTesting
LogicalProject<? extends Plan> projectAliasOnPlan(List<Alias> projections,
Plan child) {
- List<NamedExpression> newProjections =
Lists.newArrayList(child.getOutput());
- newProjections.addAll(projections);
- return new LogicalProject<>(newProjections, child);
+ if (child instanceof LogicalProject) {
+ LogicalProject<? extends Plan> project = (LogicalProject<? extends
Plan>) child;
+ List<NamedExpression> newProjections =
+ Lists.newArrayList(project.getProjects());
+ for (Alias alias : projections) {
+ if (!project.getOutput().contains(alias.toSlot())) {
+ NamedExpression expr = (NamedExpression)
project.pushDownExpressionPastProject(alias);
+ newProjections.add(expr);
+ }
+ }
+ return project.withProjects(newProjections);
+ } else {
+ List<NamedExpression> newProjections =
Lists.newArrayList(child.getOutput());
+ newProjections.addAll(projections);
+ return new LogicalProject<>(newProjections, child);
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]