wangyum commented on code in PR #36628:
URL: https://github.com/apache/spark/pull/36628#discussion_r878789366
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/types/Decimal.scala:
##########
@@ -502,7 +502,8 @@ final class Decimal extends Ordered[Decimal] with
Serializable {
Decimal(toJavaBigDecimal.multiply(that.toJavaBigDecimal, MATH_CONTEXT))
def / (that: Decimal): Decimal =
- if (that.isZero) null else
Decimal(toJavaBigDecimal.divide(that.toJavaBigDecimal, MATH_CONTEXT))
+ if (that.isZero) null else
Decimal(toJavaBigDecimal.divide(that.toJavaBigDecimal,
+ DecimalType.MAX_SCALE, MATH_CONTEXT.getRoundingMode))
Review Comment:
Hive also use this API before 2.2:
https://github.com/apache/hive/blob/rel/release-2.1.1/storage-api/src/java/org/apache/hadoop/hive/common/type/HiveDecimal.java#L233-L235
--
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]