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

jakevin 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 b93e553958 [enhance](Nereids): allow empty hash condition (#17699)
b93e553958 is described below

commit b93e553958a356651e24575f57aa87869bcb2337
Author: jakevin <jakevin...@gmail.com>
AuthorDate: Sun Mar 12 18:51:22 2023 +0800

    [enhance](Nereids): allow empty hash condition (#17699)
---
 .../nereids/rules/exploration/join/InnerJoinLAsscom.java    | 11 ++++-------
 .../rules/exploration/join/InnerJoinLAsscomProject.java     | 13 +++++--------
 2 files changed, 9 insertions(+), 15 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 a6f3a5ab26..fa90adf630 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
@@ -27,8 +27,6 @@ import org.apache.doris.nereids.trees.plans.Plan;
 import org.apache.doris.nereids.trees.plans.logical.LogicalJoin;
 import org.apache.doris.nereids.util.Utils;
 
-import com.google.common.base.Preconditions;
-
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -64,11 +62,6 @@ public class InnerJoinLAsscom extends 
OneExplorationRuleFactory {
                             bottomJoin, bottomJoin.getHashJoinConjuncts());
                     List<Expression> newTopHashConjuncts = 
splitHashConjuncts.get(true);
                     List<Expression> newBottomHashConjuncts = 
splitHashConjuncts.get(false);
-                    Preconditions.checkState(!newTopHashConjuncts.isEmpty(),
-                            "LAsscom newTopHashJoinConjuncts join can't 
empty");
-                    if (newBottomHashConjuncts.size() == 0) {
-                        return null;
-                    }
 
                     // split OtherJoinConjuncts.
                     Map<Boolean, List<Expression>> splitOtherConjunts = 
splitConjuncts(topJoin.getOtherJoinConjuncts(),
@@ -76,6 +69,10 @@ public class InnerJoinLAsscom extends 
OneExplorationRuleFactory {
                     List<Expression> newTopOtherConjuncts = 
splitOtherConjunts.get(true);
                     List<Expression> newBottomOtherConjuncts = 
splitOtherConjunts.get(false);
 
+                    if (newBottomHashConjuncts.isEmpty() && 
newBottomOtherConjuncts.isEmpty()) {
+                        return null;
+                    }
+
                     LogicalJoin<Plan, Plan> newBottomJoin = 
topJoin.withConjunctsChildren(newBottomHashConjuncts,
                             newBottomOtherConjuncts, a, c);
                     
newBottomJoin.getJoinReorderContext().copyFrom(bottomJoin.getJoinReorderContext());
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/join/InnerJoinLAsscomProject.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/join/InnerJoinLAsscomProject.java
index c23dfd5572..4a64610fab 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/join/InnerJoinLAsscomProject.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/join/InnerJoinLAsscomProject.java
@@ -29,8 +29,6 @@ import org.apache.doris.nereids.trees.plans.Plan;
 import org.apache.doris.nereids.trees.plans.logical.LogicalJoin;
 import org.apache.doris.nereids.util.Utils;
 
-import com.google.common.base.Preconditions;
-
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
@@ -83,18 +81,17 @@ public class InnerJoinLAsscomProject extends 
OneExplorationRuleFactory {
                             topJoin.getHashJoinConjuncts(), 
bottomJoin.getHashJoinConjuncts(), bExprIdSet);
                     List<Expression> newTopHashConjuncts = 
splitHashConjuncts.get(true);
                     List<Expression> newBottomHashConjuncts = 
splitHashConjuncts.get(false);
-                    Preconditions.checkState(!newTopHashConjuncts.isEmpty(), 
"newTopHashConjuncts is empty");
-                    if (newBottomHashConjuncts.size() == 0) {
-                        return null;
-                    }
 
                     /* ********** split OtherConjuncts ********** */
                     Map<Boolean, List<Expression>> splitOtherConjuncts = 
splitConjunctsWithAlias(
-                            topJoin.getOtherJoinConjuncts(), 
bottomJoin.getOtherJoinConjuncts(),
-                            bExprIdSet);
+                            topJoin.getOtherJoinConjuncts(), 
bottomJoin.getOtherJoinConjuncts(), bExprIdSet);
                     List<Expression> newTopOtherConjuncts = 
splitOtherConjuncts.get(true);
                     List<Expression> newBottomOtherConjuncts = 
splitOtherConjuncts.get(false);
 
+                    if (newBottomOtherConjuncts.isEmpty() && 
newBottomHashConjuncts.isEmpty()) {
+                        return null;
+                    }
+
                     // Add all slots used by OnCondition when projects not 
empty.
                     Set<ExprId> aExprIdSet = 
JoinReorderUtils.combineProjectAndChildExprId(a, aProjects);
                     Map<Boolean, Set<Slot>> abOnUsedSlots = Stream.concat(


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to