[fix](Nereids) decimal divide should not return null if numerator is zero (#22309)
This commit is contained in:
@ -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();
|
||||
|
||||
@ -19,3 +19,6 @@
|
||||
-- !select --
|
||||
2 2020-01-01
|
||||
|
||||
-- !select --
|
||||
\N 0.00000
|
||||
|
||||
|
||||
@ -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"
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user