[fix](Nereids): fix dceil() dfloor() (#16174)

This commit is contained in:
jakevin
2023-01-29 11:59:23 +08:00
committed by GitHub
parent 35398ad8d9
commit ce487e2b11
4 changed files with 47 additions and 22 deletions

View File

@ -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)
);
/**

View File

@ -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)
);
/**

View File

@ -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

View File

@ -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"