diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/FunctionBinder.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/FunctionBinder.java index 30e36c273f..ba39266da9 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/FunctionBinder.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/FunctionBinder.java @@ -270,12 +270,7 @@ public class FunctionBinder extends AbstractExpressionRewriteRule { @Override public Expression visitNot(Not not, ExpressionRewriteContext context) { Expression child = not.child().accept(this, context); - if (!child.getDataType().isBooleanType() && !child.getDataType().isNullType()) { - throw new AnalysisException(String.format( - "Operand '%s' part of predicate " + "'%s' should return type 'BOOLEAN' but " - + "returns type '%s'.", - child.toSql(), not.toSql(), child.getDataType())); - } + child = TypeCoercionUtils.castIfNotSameType(child, BooleanType.INSTANCE); return not.withChildren(child); }