[fix](Nereids): slot set in condition can be empty (#32169)
This commit is contained in:
@ -69,10 +69,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;
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -29,7 +29,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 com.google.common.collect.ImmutableList;
|
||||
|
||||
import java.util.Set;
|
||||
@ -63,7 +62,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;
|
||||
}
|
||||
ImmutableList<NamedExpression> topProjects = topSemiJoin.getOutput().stream()
|
||||
@ -113,7 +112,7 @@ public class TransposeSemiJoinLogicalJoinProject extends OneRewriteRuleFactory {
|
||||
}
|
||||
|
||||
enum ContainsType {
|
||||
LEFT, RIGHT, ALL
|
||||
LEFT, RIGHT, ALL, NONE
|
||||
}
|
||||
|
||||
/**
|
||||
@ -122,13 +121,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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user