From d596c1c4b251509addc0abf307bc6221e773e46e Mon Sep 17 00:00:00 2001 From: lanhuajian <924060929@qq.com> Date: Sun, 18 Dec 2022 12:23:10 +0800 Subject: [PATCH] fix regression test --- .../expressions/functions/ExecutableFunctions.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/ExecutableFunctions.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/ExecutableFunctions.java index e71c1449dcaf21..8fb7bd8a789ac9 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/ExecutableFunctions.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/ExecutableFunctions.java @@ -24,6 +24,8 @@ import org.apache.doris.nereids.trees.expressions.literal.DecimalLiteral; import org.apache.doris.nereids.trees.expressions.literal.DoubleLiteral; import org.apache.doris.nereids.trees.expressions.literal.IntegerLiteral; +import org.apache.doris.nereids.trees.expressions.literal.Literal; +import org.apache.doris.nereids.trees.expressions.literal.NullLiteral; import org.apache.doris.nereids.trees.expressions.literal.SmallIntLiteral; import org.apache.doris.nereids.trees.expressions.literal.TinyIntLiteral; @@ -153,18 +155,18 @@ public static DecimalLiteral multiplyDecimal(DecimalLiteral first, DecimalLitera } @ExecFunction(name = "divide", argTypes = {"DOUBLE", "DOUBLE"}, returnType = "DOUBLE") - public static DoubleLiteral divideDouble(DoubleLiteral first, DoubleLiteral second) { + public static Literal divideDouble(DoubleLiteral first, DoubleLiteral second) { if (second.getValue() == 0.0) { - return null; + return new NullLiteral(first.getDataType()); } double result = first.getValue() / second.getValue(); return new DoubleLiteral(result); } @ExecFunction(name = "divide", argTypes = {"DECIMAL", "DECIMAL"}, returnType = "DECIMAL") - public static DecimalLiteral divideDecimal(DecimalLiteral first, DecimalLiteral second) { + public static Literal divideDecimal(DecimalLiteral first, DecimalLiteral second) { if (first.getValue().compareTo(BigDecimal.ZERO) == 0) { - return null; + return new NullLiteral(first.getDataType()); } BigDecimal result = first.getValue().divide(second.getValue()); return new DecimalLiteral(result);