From e32c494a54f10f6cd7eb2c155388387a3b95b4bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=92=8B=E6=B7=BB?= Date: Wed, 21 Aug 2024 11:18:34 +0800 Subject: [PATCH] [CORE] Fix incorrect precision of Decimal literal --- .../scala/org/apache/gluten/utils/DecimalArithmeticUtil.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gluten-core/src/main/scala/org/apache/gluten/utils/DecimalArithmeticUtil.scala b/gluten-core/src/main/scala/org/apache/gluten/utils/DecimalArithmeticUtil.scala index d3a3373aa058..6fe52aa5624d 100644 --- a/gluten-core/src/main/scala/org/apache/gluten/utils/DecimalArithmeticUtil.scala +++ b/gluten-core/src/main/scala/org/apache/gluten/utils/DecimalArithmeticUtil.scala @@ -99,7 +99,7 @@ object DecimalArithmeticUtil { // For decimal * 10 case, dec will be Decimal(38, 18), then the result precision is wrong, // so here we will get the real precision and scale of the literal. private def getNewPrecisionScale(dec: Decimal): (Integer, Integer) = { - val input = dec.abs.toString() + val input = dec.abs.toJavaBigDecimal.toPlainString() val dotIndex = input.indexOf(".") if (dotIndex == -1) { return (input.length, 0)