diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/InferPredicates.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/InferPredicates.java index 36236c3db8dcc7..bafbc45cae39de 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/InferPredicates.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/InferPredicates.java @@ -122,8 +122,8 @@ private Set pullUpPredicates(Plan plan) { private Plan inferNewPredicate(Plan plan, Set expressions) { Set 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); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PredicatePropagation.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PredicatePropagation.java index 5d11a1fa542c77..d1eba6cce36157 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PredicatePropagation.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PredicatePropagation.java @@ -95,7 +95,10 @@ public static Set infer(Set 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); + } } } });