This is an automated email from the ASF dual-hosted git repository.

morrysnow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new baec2657dd3 [fix](Nereids) should cast NOT's child to boolean when 
analyze (#29433)
baec2657dd3 is described below

commit baec2657dd380d84e40ccc1865b3e1a2a459924b
Author: morrySnow <[email protected]>
AuthorDate: Fri Jan 5 11:20:39 2024 +0800

    [fix](Nereids) should cast NOT's child to boolean when analyze (#29433)
---
 .../doris/nereids/rules/expression/rules/FunctionBinder.java       | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

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 30e36c273fe..ba39266da93 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);
     }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to