Hisoka-X commented on code in PR #41156:
URL: https://github.com/apache/spark/pull/41156#discussion_r1193007006


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/arithmetic.scala:
##########
@@ -592,7 +599,10 @@ case class Multiply(
   override def inputType: AbstractDataType = NumericType
 
   override def symbol: String = "*"
-  override def decimalMethod: String = "$times"
+
+  override def decimalMethod(mathContextValue: GlobalValue, value1: String, 
value2: String):
+  String = s"Decimal.apply($value1.toJavaBigDecimal()" +
+    s".multiply($value2.toJavaBigDecimal(), $mathContextValue))"
 

Review Comment:
   Thanks for remind, I add test for non-codegen and change the logic for 
`nullSafeEval` to adapt non-codegen. 
   Can't change the logic in 
https://github.com/apache/spark/blob/46332d985e52f76887c139f67d1471b82e85d5ca/sql/catalyst/src/main/scala/org/apache/spark/sql/types/Decimal.scala#L495-L496).
   Because it not bind with round up. So if we change `MathContext` in 
`Decimal.scala`. We also should round up in  `Decimal.scala` again to change 
PRECISION to 38. So we will have three times round up. It will not fix the bug.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to