Skip to content

Commit

Permalink
[fix](Nereids): fix NPE InferPredicates (apache#29978)
Browse files Browse the repository at this point in the history
PredicatePropagation shouldn't add null into List.
  • Loading branch information
jackwener authored Jan 16, 2024
1 parent 3f22c79 commit 2555e78
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ private Set<Expression> pullUpPredicates(Plan plan) {

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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@ public static Set<Expression> infer(Set<Expression> predicates) {
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);
}
}
}
});
Expand Down

0 comments on commit 2555e78

Please sign in to comment.