This is an automated email from the ASF dual-hosted git repository.
morrysnow 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 716d58f5ff [fix](Nereids) decimal divide should not return null if
numerator is zero (#22309)
716d58f5ff is described below
commit 716d58f5ff38b19352c375d7af417df4eff1344f
Author: 谢健 <[email protected]>
AuthorDate: Thu Jul 27 20:23:04 2023 +0800
[fix](Nereids) decimal divide should not return null if numerator is zero
(#22309)
---
.../trees/expressions/functions/executable/NumericArithmetic.java | 2 +-
regression-test/data/delete_p0/fold_constant/fold_constant.out | 3 +++
regression-test/suites/delete_p0/fold_constant/fold_constant.groovy | 1 +
3 files changed, 5 insertions(+), 1 deletion(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/NumericArithmetic.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/NumericArithmetic.java
index b04d7705d2..28e34af5f0 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/NumericArithmetic.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/NumericArithmetic.java
@@ -584,7 +584,7 @@ public class NumericArithmetic {
*/
@ExecFunction(name = "divide", argTypes = {"DECIMALV3", "DECIMALV3"},
returnType = "DECIMALV3")
public static Expression divideDecimalV3(DecimalV3Literal first,
DecimalV3Literal second) {
- if (first.getValue().compareTo(BigDecimal.ZERO) == 0) {
+ if (second.getValue().compareTo(BigDecimal.ZERO) == 0) {
return new NullLiteral(first.getDataType());
}
DecimalV3Type t1 = (DecimalV3Type) first.getDataType();
diff --git a/regression-test/data/delete_p0/fold_constant/fold_constant.out
b/regression-test/data/delete_p0/fold_constant/fold_constant.out
index b3a24450b0..032867a978 100644
--- a/regression-test/data/delete_p0/fold_constant/fold_constant.out
+++ b/regression-test/data/delete_p0/fold_constant/fold_constant.out
@@ -19,3 +19,6 @@
-- !select --
2 2020-01-01
+-- !select --
+\N 0.00000
+
diff --git
a/regression-test/suites/delete_p0/fold_constant/fold_constant.groovy
b/regression-test/suites/delete_p0/fold_constant/fold_constant.groovy
index 007eeb699b..d6aec52ea8 100644
--- a/regression-test/suites/delete_p0/fold_constant/fold_constant.groovy
+++ b/regression-test/suites/delete_p0/fold_constant/fold_constant.groovy
@@ -59,5 +59,6 @@ suite("fold_constant") {
qt_select "select * from d_table2 order by 1;"
sql "delete from d_table2 where k1=3+1;"
qt_select "select * from d_table2 order by 1;"
+ qt_select "select 10.0/0, 0.0/10"
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]