[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
This commit is contained in:
Kikyou1997
2022-09-07 13:09:08 +08:00
committed by GitHub
parent 46776af2a3
commit 0bb06a1fa7
3 changed files with 11 additions and 2 deletions

View File

@ -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;
}
}

View File

@ -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

View File

@ -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