[fix](planner)only allow null safe equal when both children are nullable (#29470)

This commit is contained in:
starocean999
2024-01-09 19:53:52 +08:00
committed by yiguolei
parent 94ebf9d7f6
commit 2c44951543
3 changed files with 225 additions and 1 deletions

View File

@ -277,7 +277,17 @@ public class HashJoinNode extends JoinNodeBase {
ExprSubstitutionMap combinedChildSmap = getCombinedChildWithoutTupleIsNullSmap();
List<Expr> newEqJoinConjuncts = Expr.substituteList(eqJoinConjuncts, combinedChildSmap, analyzer, false);
eqJoinConjuncts =
newEqJoinConjuncts.stream().map(entity -> (BinaryPredicate) entity).collect(Collectors.toList());
newEqJoinConjuncts.stream().map(entity -> {
BinaryPredicate predicate = (BinaryPredicate) entity;
if (predicate.getOp().equals(BinaryPredicate.Operator.EQ_FOR_NULL)) {
Preconditions.checkArgument(predicate.getChildren().size() == 2);
if (!predicate.getChild(0).isNullable() || !predicate.getChild(1).isNullable()) {
predicate.setOp(BinaryPredicate.Operator.EQ);
}
}
return predicate;
}
).collect(Collectors.toList());
otherJoinConjuncts = Expr.substituteList(otherJoinConjuncts, combinedChildSmap, analyzer, false);
computeOutputTuple(analyzer);