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

kxiao pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new c0a6d542e39 [fix](Nereids): slot set in condition can be empty 
(#32169) (#32176)
c0a6d542e39 is described below

commit c0a6d542e39bcbd88f9e88983c70ab43f08645be
Author: jakevin <[email protected]>
AuthorDate: Wed Mar 13 23:12:44 2024 +0800

    [fix](Nereids): slot set in condition can be empty (#32169) (#32176)
---
 .../nereids/rules/exploration/join/InnerJoinLAsscom.java      |  6 +++---
 .../nereids/rules/rewrite/TransposeSemiJoinLogicalJoin.java   |  2 +-
 .../rules/rewrite/TransposeSemiJoinLogicalJoinProject.java    | 11 +++++------
 3 files changed, 9 insertions(+), 10 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/join/InnerJoinLAsscom.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/join/InnerJoinLAsscom.java
index d7d81e3461c..9b86458634a 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/join/InnerJoinLAsscom.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/join/InnerJoinLAsscom.java
@@ -70,10 +70,10 @@ public class InnerJoinLAsscom extends 
OneExplorationRuleFactory {
                     List<Expression> newBottomHashConjuncts = 
splitHashConjuncts.get(false);
 
                     // split OtherJoinConjuncts.
-                    Map<Boolean, List<Expression>> splitOtherConjunts = 
splitConjuncts(topJoin.getOtherJoinConjuncts(),
+                    Map<Boolean, List<Expression>> splitOtherConjuncts = 
splitConjuncts(topJoin.getOtherJoinConjuncts(),
                             bottomJoin, bottomJoin.getOtherJoinConjuncts());
-                    List<Expression> newTopOtherConjuncts = 
splitOtherConjunts.get(true);
-                    List<Expression> newBottomOtherConjuncts = 
splitOtherConjunts.get(false);
+                    List<Expression> newTopOtherConjuncts = 
splitOtherConjuncts.get(true);
+                    List<Expression> newBottomOtherConjuncts = 
splitOtherConjuncts.get(false);
 
                     if (newBottomHashConjuncts.isEmpty() && 
newBottomOtherConjuncts.isEmpty()) {
                         return null;
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/TransposeSemiJoinLogicalJoin.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/TransposeSemiJoinLogicalJoin.java
index 7d4d639f745..fe31b2f7947 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/TransposeSemiJoinLogicalJoin.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/TransposeSemiJoinLogicalJoin.java
@@ -54,7 +54,7 @@ public class TransposeSemiJoinLogicalJoin extends 
OneRewriteRuleFactory {
                     Set<ExprId> conjunctsIds = 
topSemiJoin.getConditionExprId();
                     ContainsType containsType = 
TransposeSemiJoinLogicalJoinProject.containsChildren(conjunctsIds,
                             a.getOutputExprIdSet(), b.getOutputExprIdSet());
-                    if (containsType == ContainsType.ALL) {
+                    if (containsType == ContainsType.ALL || containsType == 
ContainsType.NONE) {
                         return null;
                     }
                     if (containsType == ContainsType.LEFT) {
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/TransposeSemiJoinLogicalJoinProject.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/TransposeSemiJoinLogicalJoinProject.java
index 8408c23d50c..b82dc880f5f 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/TransposeSemiJoinLogicalJoinProject.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/TransposeSemiJoinLogicalJoinProject.java
@@ -28,8 +28,6 @@ import 
org.apache.doris.nereids.trees.plans.logical.LogicalProject;
 import org.apache.doris.nereids.util.Utils;
 import org.apache.doris.qe.ConnectContext;
 
-import com.google.common.base.Preconditions;
-
 import java.util.Set;
 
 /**
@@ -61,7 +59,7 @@ public class TransposeSemiJoinLogicalJoinProject extends 
OneRewriteRuleFactory {
                     Set<ExprId> conjunctsIds = 
topSemiJoin.getConditionExprId();
                     ContainsType containsType = containsChildren(conjunctsIds, 
a.getOutputExprIdSet(),
                             b.getOutputExprIdSet());
-                    if (containsType == ContainsType.ALL) {
+                    if (containsType == ContainsType.ALL || containsType == 
ContainsType.NONE) {
                         return null;
                     }
 
@@ -110,7 +108,7 @@ public class TransposeSemiJoinLogicalJoinProject extends 
OneRewriteRuleFactory {
     }
 
     enum ContainsType {
-        LEFT, RIGHT, ALL
+        LEFT, RIGHT, ALL, NONE
     }
 
     /**
@@ -119,13 +117,14 @@ public class TransposeSemiJoinLogicalJoinProject extends 
OneRewriteRuleFactory {
     public static ContainsType containsChildren(Set<ExprId> 
conjunctsExprIdSet, Set<ExprId> left, Set<ExprId> right) {
         boolean containsLeft = Utils.isIntersecting(conjunctsExprIdSet, left);
         boolean containsRight = Utils.isIntersecting(conjunctsExprIdSet, 
right);
-        Preconditions.checkState(containsLeft || containsRight, "join output 
must contain child");
         if (containsLeft && containsRight) {
             return ContainsType.ALL;
         } else if (containsLeft) {
             return ContainsType.LEFT;
-        } else {
+        } else if (containsRight) {
             return ContainsType.RIGHT;
+        } else {
+            return ContainsType.NONE;
         }
     }
 }


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

Reply via email to