This is an automated email from the ASF dual-hosted git repository.

jakevin 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 781fa17993 [fix](Nereids) round function return type should be double 
(#15502)
781fa17993 is described below

commit 781fa17993716b7441af1cdd91f85e1c3163cfaf
Author: morrySnow <[email protected]>
AuthorDate: Fri Dec 30 23:36:15 2022 +0800

    [fix](Nereids) round function return type should be double (#15502)
---
 .../nereids/trees/expressions/functions/scalar/Round.java    |  3 +--
 .../trees/expressions/functions/scalar/RoundBankers.java     |  3 +--
 .../query_p0/sql_functions/math_functions/test_round.out     | 12 ++++++++++++
 .../query_p0/sql_functions/math_functions/test_round.groovy  | 10 ++++++++++
 4 files changed, 24 insertions(+), 4 deletions(-)

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 0f03c7dcea..1267ae92ff 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
@@ -22,7 +22,6 @@ import org.apache.doris.nereids.trees.expressions.Expression;
 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.visitor.ExpressionVisitor;
-import org.apache.doris.nereids.types.BigIntType;
 import org.apache.doris.nereids.types.DoubleType;
 import org.apache.doris.nereids.types.IntegerType;
 
@@ -38,7 +37,7 @@ public class Round extends ScalarFunction
         implements ExplicitlyCastableSignature, PropagateNullable {
 
     public static final List<FunctionSignature> SIGNATURES = ImmutableList.of(
-            
FunctionSignature.ret(BigIntType.INSTANCE).args(DoubleType.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 2ea0401bc3..efe4eca6eb 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
@@ -22,7 +22,6 @@ import org.apache.doris.nereids.trees.expressions.Expression;
 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.visitor.ExpressionVisitor;
-import org.apache.doris.nereids.types.BigIntType;
 import org.apache.doris.nereids.types.DoubleType;
 import org.apache.doris.nereids.types.IntegerType;
 
@@ -38,7 +37,7 @@ public class RoundBankers extends ScalarFunction
         implements ExplicitlyCastableSignature, PropagateNullable {
 
     public static final List<FunctionSignature> SIGNATURES = ImmutableList.of(
-            
FunctionSignature.ret(BigIntType.INSTANCE).args(DoubleType.INSTANCE),
+            
FunctionSignature.ret(DoubleType.INSTANCE).args(DoubleType.INSTANCE),
             
FunctionSignature.ret(DoubleType.INSTANCE).args(DoubleType.INSTANCE, 
IntegerType.INSTANCE)
     );
 
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 5f7a55cf92..aff17c5dd0 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
@@ -26,3 +26,15 @@
 -- !select --
 16.020 16.02000        16.02000
 
+-- !nereids_round_arg1 --
+10.0
+
+-- !nereids_round_arg2 --
+10.12
+
+-- !nereids_round_bankers_arg1 --
+10.0
+
+-- !nereids_round_bankers_arg2 --
+10.12
+
diff --git 
a/regression-test/suites/query_p0/sql_functions/math_functions/test_round.groovy
 
b/regression-test/suites/query_p0/sql_functions/math_functions/test_round.groovy
index 0fec9dce5f..9d6892a40e 100644
--- 
a/regression-test/suites/query_p0/sql_functions/math_functions/test_round.groovy
+++ 
b/regression-test/suites/query_p0/sql_functions/math_functions/test_round.groovy
@@ -37,4 +37,14 @@ suite("test_round") {
     qt_select """ SELECT truncate(col1, 2), truncate(col2, 2), truncate(col3, 
2) FROM `${tableName}`; """
     qt_select """ SELECT round_bankers(col1, 2), round_bankers(col2, 2), 
round_bankers(col3, 2) FROM `${tableName}`; """
     sql """ DROP TABLE IF EXISTS `${tableName}` """
+
+    sql "SET enable_nereids_planner=true"
+    sql "SET enable_vectorized_engine=true"
+    sql "SET enable_fallback_to_original_planner=false"
+
+    qt_nereids_round_arg1 "SELECT round(10.12345)"
+    qt_nereids_round_arg2 "SELECT round(10.12345, 2)"
+    qt_nereids_round_bankers_arg1 "SELECT round_bankers(10.12345)"
+    qt_nereids_round_bankers_arg2 "SELECT round_bankers(10.12345, 2)"
+
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to