This is an automated email from the ASF dual-hosted git repository.
morrysnow pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new 29f0856342d [fix](Nereids) add one arg truncate (#35876)
29f0856342d is described below
commit 29f0856342dbba22a2c005d09ba937bef6efa826
Author: morrySnow <[email protected]>
AuthorDate: Tue Jun 4 20:57:40 2024 +0800
[fix](Nereids) add one arg truncate (#35876)
pick from #29864
---
.../trees/expressions/functions/scalar/Truncate.java | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
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 beb3a53db6d..696bf1a997f 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<FunctionSignature> 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 class Truncate extends ScalarFunction
*/
@Override
public Truncate withChildren(List<Expression> 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
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]