[fix](Nereids): fix NPE InferPredicates (#29978)

PredicatePropagation shouldn't add null into List.
This commit is contained in:
jakevin
2024-01-16 10:09:25 +08:00
committed by yiguolei
parent fd5d986239
commit f7e12605a2
2 changed files with 6 additions and 3 deletions

View File

@ -122,8 +122,8 @@ public class InferPredicates extends DefaultPlanRewriter<JobContext> implements
private Plan inferNewPredicate(Plan plan, Set<Expression> expressions) {
Set<Expression> predicates = expressions.stream()
.filter(c -> !c.getInputSlots().isEmpty() && plan.getOutputSet().containsAll(
c.getInputSlots())).collect(Collectors.toSet());
.filter(c -> !c.getInputSlots().isEmpty() && plan.getOutputSet().containsAll(c.getInputSlots()))
.collect(Collectors.toSet());
predicates.removeAll(plan.accept(pollUpPredicates, null));
return PlanUtils.filterOrSelf(predicates, plan);
}

View File

@ -95,7 +95,10 @@ public class PredicatePropagation {
slotPredicates.forEach((left, exprs) -> {
for (Slot right : equalSet.calEqualSet(left)) {
for (Expression expr : exprs) {
inferred.add(doInferPredicate(left, right, expr));
Expression inferPredicate = doInferPredicate(left, right, expr);
if (inferPredicate != null) {
inferred.add(inferPredicate);
}
}
}
});