[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:
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
Reference in New Issue
Block a user