diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/SimplifyComparisonPredicate.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/SimplifyComparisonPredicate.java index 55174618b27e616..08bae737951ca72 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/SimplifyComparisonPredicate.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/SimplifyComparisonPredicate.java @@ -341,14 +341,14 @@ private static Expression processTypeRangeLimitComparison(ComparisonPredicate cp } } else if (cp instanceof GreaterThan) { if (cmpMin < 0) { - return ExpressionUtils.trueOfNull(left); + return ExpressionUtils.trueOrNull(left); } if (cmpMax >= 0) { return ExpressionUtils.falseOrNull(left); } } else if (cp instanceof GreaterThanEqual) { if (cmpMin <= 0) { - return ExpressionUtils.trueOfNull(left); + return ExpressionUtils.trueOrNull(left); } if (cmpMax == 0) { return new EqualTo(cp.left(), cp.right()); @@ -361,7 +361,7 @@ private static Expression processTypeRangeLimitComparison(ComparisonPredicate cp return ExpressionUtils.falseOrNull(left); } if (cmpMax > 0) { - return ExpressionUtils.trueOfNull(left); + return ExpressionUtils.trueOrNull(left); } } else if (cp instanceof LessThanEqual) { if (cmpMin < 0) { @@ -371,7 +371,7 @@ private static Expression processTypeRangeLimitComparison(ComparisonPredicate cp return new EqualTo(cp.left(), cp.right()); } if (cmpMax >= 0) { - return ExpressionUtils.trueOfNull(left); + return ExpressionUtils.trueOrNull(left); } } return cp; diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/util/ExpressionUtils.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/util/ExpressionUtils.java index 3dd2cd668a9ff75..a3ccf01517847da 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/util/ExpressionUtils.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/util/ExpressionUtils.java @@ -215,7 +215,7 @@ public static Expression falseOrNull(Expression expression) { } } - public static Expression trueOfNull(Expression expression) { + public static Expression trueOrNull(Expression expression) { if (expression.nullable()) { return new Or(new Not(new IsNull(expression)), new NullLiteral(BooleanType.INSTANCE)); } else { diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/expression/rules/SimplifyComparisonPredicateTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/expression/rules/SimplifyComparisonPredicateTest.java index 61316a94ccf66b6..ea46312bd13f549 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/expression/rules/SimplifyComparisonPredicateTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/expression/rules/SimplifyComparisonPredicateTest.java @@ -511,7 +511,7 @@ void checkTypeRangeLimitWithComparison(DataType dataType, ComparisonPredicate cp switch (result) { case TRUE: expectExpr = cp instanceof NullSafeEqual ? BooleanLiteral.TRUE - : ExpressionUtils.trueOfNull(slot); + : ExpressionUtils.trueOrNull(slot); break; case FALSE: expectExpr = cp instanceof NullSafeEqual ? BooleanLiteral.FALSE