This is an automated email from the ASF dual-hosted git repository.

morrysnow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new a859a93b22 [fix](Nereids) should not push down project to the nullable 
side of outer join (#21999)
a859a93b22 is described below

commit a859a93b22662a9524ec872464ec92e94218a746
Author: morrySnow <[email protected]>
AuthorDate: Thu Jul 20 11:10:11 2023 +0800

    [fix](Nereids) should not push down project to the nullable side of outer 
join (#21999)
---
 .../join/PushdownProjectThroughInnerOuterJoin.java          | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/join/PushdownProjectThroughInnerOuterJoin.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/join/PushdownProjectThroughInnerOuterJoin.java
index 6d01078cdc..8a480c67dd 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/join/PushdownProjectThroughInnerOuterJoin.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/join/PushdownProjectThroughInnerOuterJoin.java
@@ -57,8 +57,8 @@ public class PushdownProjectThroughInnerOuterJoin implements 
ExplorationRuleFact
     public List<Rule> buildRules() {
         return ImmutableList.of(
                 logicalJoin(logicalProject(logicalJoin()), group())
-                        .when(j -> 
j.left().child().getJoinType().isOuterJoin() || j.left().child().getJoinType()
-                                .isInnerJoin())
+                        .when(j -> j.left().child().getJoinType().isOuterJoin()
+                                || 
j.left().child().getJoinType().isInnerJoin())
                         // Just pushdown project with non-column expr like 
(t.id + 1)
                         .whenNot(j -> j.left().isAllSlots())
                         .whenNot(j -> j.left().child().hasJoinHint())
@@ -71,8 +71,8 @@ public class PushdownProjectThroughInnerOuterJoin implements 
ExplorationRuleFact
                             return topJoin.withChildren(newLeft, 
topJoin.right());
                         
}).toRule(RuleType.PUSH_DOWN_PROJECT_THROUGH_INNER_OUTER_JOIN),
                 logicalJoin(group(), logicalProject(logicalJoin()))
-                        .when(j -> 
j.right().child().getJoinType().isOuterJoin() || j.right().child().getJoinType()
-                                .isInnerJoin())
+                        .when(j -> 
j.right().child().getJoinType().isOuterJoin()
+                                || 
j.right().child().getJoinType().isInnerJoin())
                         // Just pushdown project with non-column expr like 
(t.id + 1)
                         .whenNot(j -> j.right().isAllSlots())
                         .whenNot(j -> j.right().child().hasJoinHint())
@@ -135,6 +135,11 @@ public class PushdownProjectThroughInnerOuterJoin 
implements ExplorationRuleFact
         if (!leftContains) {
             return null;
         }
+        // we could not push nullable side project
+        if ((join.getJoinType().isLeftOuterJoin() && rightContains)
+                || (join.getJoinType().isRightOuterJoin() && leftContains)) {
+            return null;
+        }
 
         Builder<NamedExpression> newAProject = 
ImmutableList.<NamedExpression>builder().addAll(aProjects);
         Set<Slot> aConditionSlots = CBOUtils.joinChildConditionSlots(join, 
true);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to