You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by ja...@apache.org on 2023/01/29 03:59:29 UTC

[doris] branch master updated: [fix](Nereids): fix dceil() dfloor() (#16174)

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 ce487e2b11 [fix](Nereids): fix dceil() dfloor() (#16174)
ce487e2b11 is described below

commit ce487e2b1132da579ca2e7e4ce90bb0abb47b834
Author: jakevin <ja...@gmail.com>
AuthorDate: Sun Jan 29 11:59:23 2023 +0800

    [fix](Nereids): fix dceil() dfloor() (#16174)
---
 .../trees/expressions/functions/scalar/Dceil.java  |  3 +-
 .../trees/expressions/functions/scalar/Dfloor.java |  4 +-
 .../nereids_function_p0/scalar_function/A-F.out    | 56 ++++++++++++++++------
 .../nereids_function_p0/scalar_function/A-F.groovy |  6 +--
 4 files changed, 47 insertions(+), 22 deletions(-)

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 7c070268b5..6a9b60c2e9 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
@@ -23,7 +23,6 @@ import org.apache.doris.nereids.trees.expressions.functions.ExplicitlyCastableSi
 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.visitor.ExpressionVisitor;
-import org.apache.doris.nereids.types.BigIntType;
 import org.apache.doris.nereids.types.DoubleType;
 
 import com.google.common.base.Preconditions;
@@ -38,7 +37,7 @@ public class Dceil extends ScalarFunction
         implements UnaryExpression, ExplicitlyCastableSignature, PropagateNullable {
 
     public static final List<FunctionSignature> SIGNATURES = ImmutableList.of(
-            FunctionSignature.ret(BigIntType.INSTANCE).args(DoubleType.INSTANCE)
+            FunctionSignature.ret(DoubleType.INSTANCE).args(DoubleType.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 203864ef31..6433d2978d 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
@@ -23,7 +23,6 @@ import org.apache.doris.nereids.trees.expressions.functions.ExplicitlyCastableSi
 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.visitor.ExpressionVisitor;
-import org.apache.doris.nereids.types.BigIntType;
 import org.apache.doris.nereids.types.DoubleType;
 
 import com.google.common.base.Preconditions;
@@ -38,7 +37,8 @@ public class Dfloor extends ScalarFunction
         implements UnaryExpression, ExplicitlyCastableSignature, PropagateNullable {
 
     public static final List<FunctionSignature> SIGNATURES = ImmutableList.of(
-            FunctionSignature.ret(BigIntType.INSTANCE).args(DoubleType.INSTANCE)
+            // TODO: decimal
+            FunctionSignature.ret(DoubleType.INSTANCE).args(DoubleType.INSTANCE)
     );
 
     /**
diff --git a/regression-test/data/nereids_function_p0/scalar_function/A-F.out b/regression-test/data/nereids_function_p0/scalar_function/A-F.out
index cd1d6bb27f..07c9ac1fbb 100644
--- a/regression-test/data/nereids_function_p0/scalar_function/A-F.out
+++ b/regression-test/data/nereids_function_p0/scalar_function/A-F.out
@@ -376,20 +376,18 @@
 
 -- !sql --
 \N
--35245.0
--5325.0
-64.0
-88.0
-524.0
-535.0
-4236.0
-5437.0
-7346.0
-7347.0
-7569.0
-23524.0
-77646.0
-534635.0
+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 --
 4
@@ -1471,6 +1469,21 @@ varchar13
 0
 0
 
+-- !sql --
+\N
+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 --
 \N
 5.729577951308232
@@ -1486,6 +1499,21 @@ varchar13
 63.02535746439057
 68.75493541569878
 
+-- !sql --
+\N
+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 --
 \N
 1****1
diff --git a/regression-test/suites/nereids_function_p0/scalar_function/A-F.groovy b/regression-test/suites/nereids_function_p0/scalar_function/A-F.groovy
index 3ca66dd4be..ed8aebf8d6 100644
--- a/regression-test/suites/nereids_function_p0/scalar_function/A-F.groovy
+++ b/regression-test/suites/nereids_function_p0/scalar_function/A-F.groovy
@@ -198,13 +198,11 @@ suite("nereids_scalar_fn_1") {
     // qt_sql "select days_sub(kdtmv2s1, kint) from fn_test order by kdtmv2s1, kint"
     // qt_sql "select days_sub(kdt, kint) from fn_test order by kdt, kint"
     // qt_sql "select days_sub(kdtv2, kint) from fn_test order by kdtv2, kint"
-    // core
-    // qt_sql "select dceil(kdbl) from fn_test order by kdbl"
+    qt_sql "select dceil(kdbl) from fn_test order by kdbl"
     qt_sql "select degrees(kdbl) from fn_test order by kdbl"
     // data out of double range
     // qt_sql "select dexp(kdbl) from fn_test order by kdbl"
-    // core
-    // qt_sql "select dfloor(kdbl) from fn_test order by kdbl"
+    qt_sql "select dfloor(kdbl) from fn_test order by kdbl"
     qt_sql "select digital_masking(kbint) from fn_test order by kbint"
     qt_sql "select dlog1(kdbl) from fn_test order by kdbl"
     qt_sql "select dlog10(kdbl) from fn_test order by kdbl"


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org