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 0bb06a1fa7 [feature](Nereids) let nullable of Year, WeekOfYear and 
Divide be the same as implementation in BE (#12374)
0bb06a1fa7 is described below

commit 0bb06a1fa75933648359258491d5b95ad2d5bc07
Author: Kikyou1997 <33112463+kikyou1...@users.noreply.github.com>
AuthorDate: Wed Sep 7 13:09:08 2022 +0800

    [feature](Nereids) let nullable of Year, WeekOfYear and Divide be the same 
as implementation in BE (#12374)
    
    These function/expression should always be nullable, so just return true in 
the overwrite method.
    - Year
    - WeekOfYear
    - Divide
---
 .../java/org/apache/doris/nereids/trees/expressions/Divide.java    | 7 +++++++
 .../doris/nereids/trees/expressions/functions/WeekOfYear.java      | 3 ++-
 .../org/apache/doris/nereids/trees/expressions/functions/Year.java | 3 ++-
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/Divide.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/Divide.java
index 9f4d676214..03782fb35a 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/Divide.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/Divide.java
@@ -18,6 +18,7 @@
 package org.apache.doris.nereids.trees.expressions;
 
 import org.apache.doris.analysis.ArithmeticExpr.Operator;
+import org.apache.doris.nereids.exceptions.UnboundException;
 import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor;
 import org.apache.doris.nereids.types.coercion.AbstractDataType;
 import org.apache.doris.nereids.types.coercion.NumericType;
@@ -50,4 +51,10 @@ public class Divide extends BinaryArithmetic {
     public AbstractDataType inputType() {
         return NumericType.INSTANCE;
     }
+
+    // Divide is implemented as a scalar function which return type is always 
nullable.
+    @Override
+    public boolean nullable() throws UnboundException {
+        return true;
+    }
 }
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/WeekOfYear.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/WeekOfYear.java
index acdd92e6f4..8660b72492 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/WeekOfYear.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/WeekOfYear.java
@@ -49,9 +49,10 @@ public class WeekOfYear extends BoundFunction implements 
UnaryExpression, Implic
         return IntegerType.INSTANCE;
     }
 
+    // Follow the return type of origin definition in the FunctionSet.
     @Override
     public boolean nullable() {
-        return child().nullable();
+        return true;
     }
 
     @Override
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/Year.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/Year.java
index 7271696864..454ea937db 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/Year.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/Year.java
@@ -51,9 +51,10 @@ public class Year extends BoundFunction implements 
UnaryExpression, ImplicitCast
         return IntegerType.INSTANCE;
     }
 
+    // Follow the return type of origin definition in the FunctionSet.
     @Override
     public boolean nullable() {
-        return child().nullable();
+        return true;
     }
 
     @Override


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to