This is an automated email from the ASF dual-hosted git repository.
panxiaolei 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 ae5e39ad26 [opt](Nereids) add double signature back for round like
function (#22284)
ae5e39ad26 is described below
commit ae5e39ad26d8a2d90e53200f55d0266af7af1e8f
Author: morrySnow <[email protected]>
AuthorDate: Thu Jul 27 19:10:43 2023 +0800
[opt](Nereids) add double signature back for round like function (#22284)
add double signature back for round like function
---
.../functions/SearchSignatureForRound.java | 43 +++++
.../trees/expressions/functions/scalar/Ceil.java | 10 +-
.../trees/expressions/functions/scalar/Dceil.java | 10 +-
.../trees/expressions/functions/scalar/Dfloor.java | 10 +-
.../trees/expressions/functions/scalar/Dround.java | 9 +-
.../trees/expressions/functions/scalar/Floor.java | 10 +-
.../trees/expressions/functions/scalar/Round.java | 9 +-
.../expressions/functions/scalar/RoundBankers.java | 9 +-
.../expressions/functions/scalar/Truncate.java | 8 +-
.../doris/nereids/trees/expressions/UdfTest.java | 9 +-
.../data/nereids_function_p0/scalar_function/D.out | 192 ++++++++++-----------
.../data/nereids_function_p0/scalar_function/R.out | 192 ++++++++++-----------
.../sql_functions/math_functions/test_round.out | 6 +-
13 files changed, 289 insertions(+), 228 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/SearchSignatureForRound.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/SearchSignatureForRound.java
new file mode 100644
index 0000000000..ae94823d31
--- /dev/null
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/SearchSignatureForRound.java
@@ -0,0 +1,43 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.nereids.trees.expressions.functions;
+
+import org.apache.doris.catalog.FunctionSignature;
+import org.apache.doris.nereids.trees.expressions.Expression;
+import org.apache.doris.nereids.types.DoubleType;
+import org.apache.doris.nereids.types.IntegerType;
+
+import java.util.List;
+
+/**
+ * if argument 0 is float or double, we should return double signature for
round like function.
+ */
+public interface SearchSignatureForRound extends ExplicitlyCastableSignature {
+ @Override
+ default FunctionSignature searchSignature(List<FunctionSignature>
signatures) {
+ List<Expression> arguments = getArguments();
+ if (arguments.get(0).getDataType().isFloatLikeType()) {
+ if (arguments.size() == 1) {
+ return
FunctionSignature.ret(DoubleType.INSTANCE).args(DoubleType.INSTANCE);
+ } else if (arguments.size() == 2) {
+ return
FunctionSignature.ret(DoubleType.INSTANCE).args(DoubleType.INSTANCE,
IntegerType.INSTANCE);
+ }
+ }
+ return ExplicitlyCastableSignature.super.searchSignature(signatures);
+ }
+}
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Ceil.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Ceil.java
index 4be7f7a454..2ba3c5502b 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Ceil.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Ceil.java
@@ -20,11 +20,11 @@ package
org.apache.doris.nereids.trees.expressions.functions.scalar;
import org.apache.doris.catalog.FunctionSignature;
import org.apache.doris.nereids.trees.expressions.Expression;
import
org.apache.doris.nereids.trees.expressions.functions.ComputePrecisionForRound;
-import
org.apache.doris.nereids.trees.expressions.functions.ExplicitlyCastableSignature;
import org.apache.doris.nereids.trees.expressions.functions.PropagateNullable;
-import org.apache.doris.nereids.trees.expressions.shape.UnaryExpression;
+import
org.apache.doris.nereids.trees.expressions.functions.SearchSignatureForRound;
import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor;
import org.apache.doris.nereids.types.DecimalV3Type;
+import org.apache.doris.nereids.types.DoubleType;
import org.apache.doris.nereids.types.IntegerType;
import com.google.common.base.Preconditions;
@@ -36,11 +36,13 @@ import java.util.List;
* ScalarFunction 'ceil'. This class is generated by GenerateFunction.
*/
public class Ceil extends ScalarFunction
- implements UnaryExpression, ExplicitlyCastableSignature,
PropagateNullable, ComputePrecisionForRound {
+ implements SearchSignatureForRound, PropagateNullable,
ComputePrecisionForRound {
public static final List<FunctionSignature> SIGNATURES = ImmutableList.of(
FunctionSignature.ret(DecimalV3Type.WILDCARD).args(DecimalV3Type.WILDCARD),
-
FunctionSignature.ret(DecimalV3Type.WILDCARD).args(DecimalV3Type.WILDCARD,
IntegerType.INSTANCE)
+
FunctionSignature.ret(DecimalV3Type.WILDCARD).args(DecimalV3Type.WILDCARD,
IntegerType.INSTANCE),
+
FunctionSignature.ret(DoubleType.INSTANCE).args(DoubleType.INSTANCE),
+
FunctionSignature.ret(DoubleType.INSTANCE).args(DoubleType.INSTANCE,
IntegerType.INSTANCE)
);
/**
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Dceil.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Dceil.java
index 7102cb948d..84ee031ba7 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Dceil.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Dceil.java
@@ -20,11 +20,11 @@ package
org.apache.doris.nereids.trees.expressions.functions.scalar;
import org.apache.doris.catalog.FunctionSignature;
import org.apache.doris.nereids.trees.expressions.Expression;
import
org.apache.doris.nereids.trees.expressions.functions.ComputePrecisionForRound;
-import
org.apache.doris.nereids.trees.expressions.functions.ExplicitlyCastableSignature;
import org.apache.doris.nereids.trees.expressions.functions.PropagateNullable;
-import org.apache.doris.nereids.trees.expressions.shape.UnaryExpression;
+import
org.apache.doris.nereids.trees.expressions.functions.SearchSignatureForRound;
import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor;
import org.apache.doris.nereids.types.DecimalV3Type;
+import org.apache.doris.nereids.types.DoubleType;
import org.apache.doris.nereids.types.IntegerType;
import com.google.common.base.Preconditions;
@@ -36,11 +36,13 @@ import java.util.List;
* ScalarFunction 'dceil'. This class is generated by GenerateFunction.
*/
public class Dceil extends ScalarFunction
- implements UnaryExpression, ExplicitlyCastableSignature,
PropagateNullable, ComputePrecisionForRound {
+ implements SearchSignatureForRound, PropagateNullable,
ComputePrecisionForRound {
public static final List<FunctionSignature> SIGNATURES = ImmutableList.of(
FunctionSignature.ret(DecimalV3Type.WILDCARD).args(DecimalV3Type.WILDCARD),
-
FunctionSignature.ret(DecimalV3Type.WILDCARD).args(DecimalV3Type.WILDCARD,
IntegerType.INSTANCE)
+
FunctionSignature.ret(DecimalV3Type.WILDCARD).args(DecimalV3Type.WILDCARD,
IntegerType.INSTANCE),
+
FunctionSignature.ret(DoubleType.INSTANCE).args(DoubleType.INSTANCE),
+
FunctionSignature.ret(DoubleType.INSTANCE).args(DoubleType.INSTANCE,
IntegerType.INSTANCE)
);
/**
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Dfloor.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Dfloor.java
index df9f7bbb93..90c611fd36 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Dfloor.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Dfloor.java
@@ -20,11 +20,11 @@ package
org.apache.doris.nereids.trees.expressions.functions.scalar;
import org.apache.doris.catalog.FunctionSignature;
import org.apache.doris.nereids.trees.expressions.Expression;
import
org.apache.doris.nereids.trees.expressions.functions.ComputePrecisionForRound;
-import
org.apache.doris.nereids.trees.expressions.functions.ExplicitlyCastableSignature;
import org.apache.doris.nereids.trees.expressions.functions.PropagateNullable;
-import org.apache.doris.nereids.trees.expressions.shape.UnaryExpression;
+import
org.apache.doris.nereids.trees.expressions.functions.SearchSignatureForRound;
import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor;
import org.apache.doris.nereids.types.DecimalV3Type;
+import org.apache.doris.nereids.types.DoubleType;
import org.apache.doris.nereids.types.IntegerType;
import com.google.common.base.Preconditions;
@@ -36,11 +36,13 @@ import java.util.List;
* ScalarFunction 'dfloor'. This class is generated by GenerateFunction.
*/
public class Dfloor extends ScalarFunction
- implements UnaryExpression, ExplicitlyCastableSignature,
PropagateNullable, ComputePrecisionForRound {
+ implements SearchSignatureForRound, PropagateNullable,
ComputePrecisionForRound {
public static final List<FunctionSignature> SIGNATURES = ImmutableList.of(
FunctionSignature.ret(DecimalV3Type.WILDCARD).args(DecimalV3Type.WILDCARD),
-
FunctionSignature.ret(DecimalV3Type.WILDCARD).args(DecimalV3Type.WILDCARD,
IntegerType.INSTANCE)
+
FunctionSignature.ret(DecimalV3Type.WILDCARD).args(DecimalV3Type.WILDCARD,
IntegerType.INSTANCE),
+
FunctionSignature.ret(DoubleType.INSTANCE).args(DoubleType.INSTANCE),
+
FunctionSignature.ret(DoubleType.INSTANCE).args(DoubleType.INSTANCE,
IntegerType.INSTANCE)
);
/**
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Dround.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Dround.java
index 29fe1516fb..420991d49b 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Dround.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Dround.java
@@ -20,10 +20,11 @@ package
org.apache.doris.nereids.trees.expressions.functions.scalar;
import org.apache.doris.catalog.FunctionSignature;
import org.apache.doris.nereids.trees.expressions.Expression;
import
org.apache.doris.nereids.trees.expressions.functions.ComputePrecisionForRound;
-import
org.apache.doris.nereids.trees.expressions.functions.ExplicitlyCastableSignature;
import org.apache.doris.nereids.trees.expressions.functions.PropagateNullable;
+import
org.apache.doris.nereids.trees.expressions.functions.SearchSignatureForRound;
import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor;
import org.apache.doris.nereids.types.DecimalV3Type;
+import org.apache.doris.nereids.types.DoubleType;
import org.apache.doris.nereids.types.IntegerType;
import com.google.common.base.Preconditions;
@@ -35,11 +36,13 @@ import java.util.List;
* ScalarFunction 'dround'. This class is generated by GenerateFunction.
*/
public class Dround extends ScalarFunction
- implements ExplicitlyCastableSignature, PropagateNullable,
ComputePrecisionForRound {
+ implements SearchSignatureForRound, PropagateNullable,
ComputePrecisionForRound {
public static final List<FunctionSignature> SIGNATURES = ImmutableList.of(
FunctionSignature.ret(DecimalV3Type.WILDCARD).args(DecimalV3Type.WILDCARD),
-
FunctionSignature.ret(DecimalV3Type.WILDCARD).args(DecimalV3Type.WILDCARD,
IntegerType.INSTANCE)
+
FunctionSignature.ret(DecimalV3Type.WILDCARD).args(DecimalV3Type.WILDCARD,
IntegerType.INSTANCE),
+
FunctionSignature.ret(DoubleType.INSTANCE).args(DoubleType.INSTANCE),
+
FunctionSignature.ret(DoubleType.INSTANCE).args(DoubleType.INSTANCE,
IntegerType.INSTANCE)
);
/**
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Floor.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Floor.java
index e6b60cb791..29f0280368 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Floor.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Floor.java
@@ -20,11 +20,11 @@ package
org.apache.doris.nereids.trees.expressions.functions.scalar;
import org.apache.doris.catalog.FunctionSignature;
import org.apache.doris.nereids.trees.expressions.Expression;
import
org.apache.doris.nereids.trees.expressions.functions.ComputePrecisionForRound;
-import
org.apache.doris.nereids.trees.expressions.functions.ExplicitlyCastableSignature;
import org.apache.doris.nereids.trees.expressions.functions.PropagateNullable;
-import org.apache.doris.nereids.trees.expressions.shape.UnaryExpression;
+import
org.apache.doris.nereids.trees.expressions.functions.SearchSignatureForRound;
import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor;
import org.apache.doris.nereids.types.DecimalV3Type;
+import org.apache.doris.nereids.types.DoubleType;
import org.apache.doris.nereids.types.IntegerType;
import com.google.common.base.Preconditions;
@@ -36,11 +36,13 @@ import java.util.List;
* ScalarFunction 'floor'. This class is generated by GenerateFunction.
*/
public class Floor extends ScalarFunction
- implements UnaryExpression, ExplicitlyCastableSignature,
PropagateNullable, ComputePrecisionForRound {
+ implements SearchSignatureForRound, PropagateNullable,
ComputePrecisionForRound {
public static final List<FunctionSignature> SIGNATURES = ImmutableList.of(
FunctionSignature.ret(DecimalV3Type.WILDCARD).args(DecimalV3Type.WILDCARD),
-
FunctionSignature.ret(DecimalV3Type.WILDCARD).args(DecimalV3Type.WILDCARD,
IntegerType.INSTANCE)
+
FunctionSignature.ret(DecimalV3Type.WILDCARD).args(DecimalV3Type.WILDCARD,
IntegerType.INSTANCE),
+
FunctionSignature.ret(DoubleType.INSTANCE).args(DoubleType.INSTANCE),
+
FunctionSignature.ret(DoubleType.INSTANCE).args(DoubleType.INSTANCE,
IntegerType.INSTANCE)
);
/**
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Round.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Round.java
index ac7afc7774..b4e6a9dc54 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Round.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Round.java
@@ -20,10 +20,11 @@ package
org.apache.doris.nereids.trees.expressions.functions.scalar;
import org.apache.doris.catalog.FunctionSignature;
import org.apache.doris.nereids.trees.expressions.Expression;
import
org.apache.doris.nereids.trees.expressions.functions.ComputePrecisionForRound;
-import
org.apache.doris.nereids.trees.expressions.functions.ExplicitlyCastableSignature;
import org.apache.doris.nereids.trees.expressions.functions.PropagateNullable;
+import
org.apache.doris.nereids.trees.expressions.functions.SearchSignatureForRound;
import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor;
import org.apache.doris.nereids.types.DecimalV3Type;
+import org.apache.doris.nereids.types.DoubleType;
import org.apache.doris.nereids.types.IntegerType;
import com.google.common.base.Preconditions;
@@ -35,11 +36,13 @@ import java.util.List;
* ScalarFunction 'round'. This class is generated by GenerateFunction.
*/
public class Round extends ScalarFunction
- implements ExplicitlyCastableSignature, PropagateNullable,
ComputePrecisionForRound {
+ implements SearchSignatureForRound, PropagateNullable,
ComputePrecisionForRound {
public static final List<FunctionSignature> SIGNATURES = ImmutableList.of(
FunctionSignature.ret(DecimalV3Type.WILDCARD).args(DecimalV3Type.WILDCARD),
-
FunctionSignature.ret(DecimalV3Type.WILDCARD).args(DecimalV3Type.WILDCARD,
IntegerType.INSTANCE)
+
FunctionSignature.ret(DecimalV3Type.WILDCARD).args(DecimalV3Type.WILDCARD,
IntegerType.INSTANCE),
+
FunctionSignature.ret(DoubleType.INSTANCE).args(DoubleType.INSTANCE),
+
FunctionSignature.ret(DoubleType.INSTANCE).args(DoubleType.INSTANCE,
IntegerType.INSTANCE)
);
/**
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/RoundBankers.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/RoundBankers.java
index a7b0f50e8b..5ed41ae60e 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/RoundBankers.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/RoundBankers.java
@@ -20,10 +20,11 @@ package
org.apache.doris.nereids.trees.expressions.functions.scalar;
import org.apache.doris.catalog.FunctionSignature;
import org.apache.doris.nereids.trees.expressions.Expression;
import
org.apache.doris.nereids.trees.expressions.functions.ComputePrecisionForRound;
-import
org.apache.doris.nereids.trees.expressions.functions.ExplicitlyCastableSignature;
import org.apache.doris.nereids.trees.expressions.functions.PropagateNullable;
+import
org.apache.doris.nereids.trees.expressions.functions.SearchSignatureForRound;
import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor;
import org.apache.doris.nereids.types.DecimalV3Type;
+import org.apache.doris.nereids.types.DoubleType;
import org.apache.doris.nereids.types.IntegerType;
import com.google.common.base.Preconditions;
@@ -35,11 +36,13 @@ import java.util.List;
* ScalarFunction 'round_bankers'. This class is generated by GenerateFunction.
*/
public class RoundBankers extends ScalarFunction
- implements ExplicitlyCastableSignature, PropagateNullable,
ComputePrecisionForRound {
+ implements SearchSignatureForRound, PropagateNullable,
ComputePrecisionForRound {
public static final List<FunctionSignature> SIGNATURES = ImmutableList.of(
FunctionSignature.ret(DecimalV3Type.WILDCARD).args(DecimalV3Type.WILDCARD),
-
FunctionSignature.ret(DecimalV3Type.WILDCARD).args(DecimalV3Type.WILDCARD,
IntegerType.INSTANCE)
+
FunctionSignature.ret(DecimalV3Type.WILDCARD).args(DecimalV3Type.WILDCARD,
IntegerType.INSTANCE),
+
FunctionSignature.ret(DoubleType.INSTANCE).args(DoubleType.INSTANCE),
+
FunctionSignature.ret(DoubleType.INSTANCE).args(DoubleType.INSTANCE,
IntegerType.INSTANCE)
);
/**
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 fbf3a59b29..beb3a53db6 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
@@ -20,11 +20,12 @@ package
org.apache.doris.nereids.trees.expressions.functions.scalar;
import org.apache.doris.catalog.FunctionSignature;
import org.apache.doris.nereids.trees.expressions.Expression;
import
org.apache.doris.nereids.trees.expressions.functions.ComputePrecisionForRound;
-import
org.apache.doris.nereids.trees.expressions.functions.ExplicitlyCastableSignature;
import org.apache.doris.nereids.trees.expressions.functions.PropagateNullable;
+import
org.apache.doris.nereids.trees.expressions.functions.SearchSignatureForRound;
import org.apache.doris.nereids.trees.expressions.shape.BinaryExpression;
import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor;
import org.apache.doris.nereids.types.DecimalV3Type;
+import org.apache.doris.nereids.types.DoubleType;
import org.apache.doris.nereids.types.IntegerType;
import com.google.common.base.Preconditions;
@@ -36,10 +37,11 @@ import java.util.List;
* ScalarFunction 'truncate'. This class is generated by GenerateFunction.
*/
public class Truncate extends ScalarFunction
- implements BinaryExpression, ExplicitlyCastableSignature,
PropagateNullable, ComputePrecisionForRound {
+ implements BinaryExpression, SearchSignatureForRound,
PropagateNullable, ComputePrecisionForRound {
public static final List<FunctionSignature> SIGNATURES = ImmutableList.of(
-
FunctionSignature.ret(DecimalV3Type.WILDCARD).args(DecimalV3Type.WILDCARD,
IntegerType.INSTANCE)
+
FunctionSignature.ret(DecimalV3Type.WILDCARD).args(DecimalV3Type.WILDCARD,
IntegerType.INSTANCE),
+
FunctionSignature.ret(DoubleType.INSTANCE).args(DoubleType.INSTANCE,
IntegerType.INSTANCE)
);
/**
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/UdfTest.java
b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/UdfTest.java
index d068bb6c17..35cb8ba14d 100644
---
a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/UdfTest.java
+++
b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/UdfTest.java
@@ -34,7 +34,6 @@ import
org.apache.doris.nereids.trees.expressions.literal.TinyIntLiteral;
import org.apache.doris.nereids.trees.expressions.literal.VarcharLiteral;
import org.apache.doris.nereids.types.DateTimeV2Type;
import org.apache.doris.nereids.types.DateV2Type;
-import org.apache.doris.nereids.types.DecimalV3Type;
import org.apache.doris.nereids.types.DoubleType;
import org.apache.doris.nereids.types.IntegerType;
import org.apache.doris.nereids.util.PlanChecker;
@@ -146,7 +145,7 @@ public class UdfTest extends TestWithFeService implements
PlanPatternMatchSuppor
new VarcharLiteral("day")),
new Cast(new Add(
new Multiply(
- new Floor(new Cast(new Divide(
+ new Floor(new Divide(
new Cast(
new Hour(new Cast(new
VarcharLiteral("2023-05-20 12:23:45"), DateTimeV2Type.SYSTEM_DEFAULT)),
DoubleType.INSTANCE
@@ -154,11 +153,11 @@ public class UdfTest extends TestWithFeService implements
PlanPatternMatchSuppor
new Divide(
new Cast(new
TinyIntLiteral(((byte) 24)), DoubleType.INSTANCE),
new Cast(new
IntegerLiteral(((byte) 3)), DoubleType.INSTANCE)
- )),
DecimalV3Type.createDecimalV3Type(30, 15))
+ ))
),
- new Cast(new TinyIntLiteral(((byte)
1)), DecimalV3Type.createDecimalV3Type(3, 0))
+ new Cast(new TinyIntLiteral(((byte)
1)), DoubleType.INSTANCE)
),
- new Cast(new TinyIntLiteral(((byte) 1)),
DecimalV3Type.createDecimalV3Type(33, 0))
+ new Cast(new TinyIntLiteral(((byte) 1)),
DoubleType.INSTANCE)
), IntegerType.INSTANCE)
),
new VarcharLiteral("%Y%m%d:%H")
diff --git a/regression-test/data/nereids_function_p0/scalar_function/D.out
b/regression-test/data/nereids_function_p0/scalar_function/D.out
index cbf4d8f532..d18b99ba8a 100644
--- a/regression-test/data/nereids_function_p0/scalar_function/D.out
+++ b/regression-test/data/nereids_function_p0/scalar_function/D.out
@@ -2234,32 +2234,32 @@ Monday
-- !sql_dceil_Double --
\N
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-2
-2
+1.0
+1.0
+1.0
+1.0
+1.0
+1.0
+1.0
+1.0
+1.0
+1.0
+2.0
+2.0
-- !sql_dceil_Double_notnull --
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-2
-2
+1.0
+1.0
+1.0
+1.0
+1.0
+1.0
+1.0
+1.0
+1.0
+1.0
+2.0
+2.0
-- !sql_dceil_DecimalV3S1 --
\N
@@ -2495,32 +2495,32 @@ Monday
-- !sql_dfloor_Double --
\N
-0
-0
-0
-0
-0
-0
-0
-0
-0
-1
-1
-1
+0.0
+0.0
+0.0
+0.0
+0.0
+0.0
+0.0
+0.0
+0.0
+1.0
+1.0
+1.0
-- !sql_dfloor_Double_notnull --
-0
-0
-0
-0
-0
-0
-0
-0
-0
-1
-1
-1
+0.0
+0.0
+0.0
+0.0
+0.0
+0.0
+0.0
+0.0
+0.0
+1.0
+1.0
+1.0
-- !sql_dfloor_DecimalV3S1 --
\N
@@ -2872,61 +2872,61 @@ Monday
-- !sql_dround_Double --
\N
-0
-0
-0
-0
-1
-1
-1
-1
-1
-1
-1
-1
+0.0
+0.0
+0.0
+0.0
+0.0
+1.0
+1.0
+1.0
+1.0
+1.0
+1.0
+1.0
-- !sql_dround_Double_notnull --
-0
-0
-0
-0
-1
-1
-1
-1
-1
-1
-1
-1
+0.0
+0.0
+0.0
+0.0
+0.0
+1.0
+1.0
+1.0
+1.0
+1.0
+1.0
+1.0
-- !sql_dround_Double_Integer --
\N
-0.10
-0.20
-0.30
-0.40
-0.50
-0.60
-0.70
-0.80
-0.90
-1.00
-1.10
-1.20
+0.1
+0.2
+0.3
+0.4
+0.5
+0.6
+0.7
+0.8
+0.9
+1.0
+1.1
+1.2
-- !sql_dround_Double_Integer_notnull --
-0.10
-0.20
-0.30
-0.40
-0.50
-0.60
-0.70
-0.80
-0.90
-1.00
-1.10
-1.20
+0.1
+0.2
+0.3
+0.4
+0.5
+0.6
+0.7
+0.8
+0.9
+1.0
+1.1
+1.2
-- !sql_dround_DecimalV3S1 --
\N
diff --git a/regression-test/data/nereids_function_p0/scalar_function/R.out
b/regression-test/data/nereids_function_p0/scalar_function/R.out
index 9c7be851d5..3145c2c6dc 100644
--- a/regression-test/data/nereids_function_p0/scalar_function/R.out
+++ b/regression-test/data/nereids_function_p0/scalar_function/R.out
@@ -436,61 +436,61 @@ string3
-- !sql_round_Double --
\N
-0
-0
-0
-0
-1
-1
-1
-1
-1
-1
-1
-1
+0.0
+0.0
+0.0
+0.0
+0.0
+1.0
+1.0
+1.0
+1.0
+1.0
+1.0
+1.0
-- !sql_round_Double_notnull --
-0
-0
-0
-0
-1
-1
-1
-1
-1
-1
-1
-1
+0.0
+0.0
+0.0
+0.0
+0.0
+1.0
+1.0
+1.0
+1.0
+1.0
+1.0
+1.0
-- !sql_round_Double_Integer --
\N
-0.10
-0.20
-0.30
-0.40
-0.50
-0.60
-0.70
-0.80
-0.90
-1.00
-1.10
-1.20
+0.1
+0.2
+0.3
+0.4
+0.5
+0.6
+0.7
+0.8
+0.9
+1.0
+1.1
+1.2
-- !sql_round_Double_Integer_notnull --
-0.10
-0.20
-0.30
-0.40
-0.50
-0.60
-0.70
-0.80
-0.90
-1.00
-1.10
-1.20
+0.1
+0.2
+0.3
+0.4
+0.5
+0.6
+0.7
+0.8
+0.9
+1.0
+1.1
+1.2
-- !sql_round_DecimalV3S1 --
\N
@@ -668,61 +668,61 @@ string3
-- !sql_round_bankers_Double --
\N
-0
-0
-0
-0
-0
-1
-1
-1
-1
-1
-1
-1
+0.0
+0.0
+0.0
+0.0
+0.0
+1.0
+1.0
+1.0
+1.0
+1.0
+1.0
+1.0
-- !sql_round_bankers_Double_notnull --
-0
-0
-0
-0
-0
-1
-1
-1
-1
-1
-1
-1
+0.0
+0.0
+0.0
+0.0
+0.0
+1.0
+1.0
+1.0
+1.0
+1.0
+1.0
+1.0
-- !sql_round_bankers_Double_Integer --
\N
-0.10
-0.20
-0.30
-0.40
-0.50
-0.60
-0.70
-0.80
-0.90
-1.00
-1.10
-1.20
+0.1
+0.2
+0.3
+0.4
+0.5
+0.6
+0.7
+0.8
+0.9
+1.0
+1.1
+1.2
-- !sql_round_bankers_Double_Integer_notnull --
-0.10
-0.20
-0.30
-0.40
-0.50
-0.60
-0.70
-0.80
-0.90
-1.00
-1.10
-1.20
+0.1
+0.2
+0.3
+0.4
+0.5
+0.6
+0.7
+0.8
+0.9
+1.0
+1.1
+1.2
-- !sql_round_bankers_DecimalV3S1 --
\N
diff --git
a/regression-test/data/query_p0/sql_functions/math_functions/test_round.out
b/regression-test/data/query_p0/sql_functions/math_functions/test_round.out
index 09f7105980..92b8def44b 100644
--- a/regression-test/data/query_p0/sql_functions/math_functions/test_round.out
+++ b/regression-test/data/query_p0/sql_functions/math_functions/test_round.out
@@ -12,9 +12,9 @@
10.12
-- !truncate --
-1.0 1989.0 1001.0 123.1 0.1 6.3
-2.0 1986.0 1001.0 1243.5 20.2 789.2
-3.0 1989.0 1002.0 24453.3 78945.0 3654.0
+1 1989 1001 123.1 0.1 6.3
+2 1986 1001 1243.5 20.2 789.2
+3 1989 1002 24453.3 78945.0 3654.0
-- !select --
16 16 16
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]