LuciferYang commented on a change in pull request #29660:
URL: https://github.com/apache/spark/pull/29660#discussion_r484333977
##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/types/Decimal.scala
##########
@@ -478,15 +478,15 @@ final class Decimal extends Ordered[Decimal] with
Serializable {
if (decimalVal.eq(null) && that.decimalVal.eq(null) && scale ==
that.scale) {
Decimal(longVal + that.longVal, Math.max(precision, that.precision),
scale)
} else {
- Decimal(toBigDecimal + that.toBigDecimal)
Review comment:
In Scala 2.13, `+` method is
```
def + (that: BigDecimal): BigDecimal = new
BigDecimal(this.bigDecimal.add(that.bigDecimal, mc), mc)
```
and in Scala 2.12 `+` method is
```
def + (that: BigDecimal): BigDecimal = new BigDecimal(this.bigDecimal add
that.bigDecimal, mc)
```
There are some differences in accuracy.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]