diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Truncate.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Truncate.java index beb3a53db6df0d..696bf1a997f0d4 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Truncate.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Truncate.java @@ -41,9 +41,17 @@ public class Truncate extends ScalarFunction public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(DecimalV3Type.WILDCARD).args(DecimalV3Type.WILDCARD, IntegerType.INSTANCE), - FunctionSignature.ret(DoubleType.INSTANCE).args(DoubleType.INSTANCE, IntegerType.INSTANCE) + FunctionSignature.ret(DoubleType.INSTANCE).args(DoubleType.INSTANCE, IntegerType.INSTANCE), + FunctionSignature.ret(DoubleType.INSTANCE).args(DoubleType.INSTANCE) ); + /** + * constructor with 1 argument. + */ + public Truncate(Expression arg0) { + super("truncate", arg0); + } + /** * constructor with 2 arguments. */ @@ -56,8 +64,12 @@ public Truncate(Expression arg0, Expression arg1) { */ @Override public Truncate withChildren(List children) { - Preconditions.checkArgument(children.size() == 2); - return new Truncate(children.get(0), children.get(1)); + Preconditions.checkArgument(children.size() == 1 || children.size() == 2); + if (children.size() == 1) { + return new Truncate(children.get(0)); + } else { + return new Truncate(children.get(0), children.get(1)); + } } @Override