mgaido91 commented on a change in pull request #25033: [SPARK-28224][SQL]
Aggregate sum large decimals
URL: https://github.com/apache/spark/pull/25033#discussion_r299831635
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/Sum.scala
##########
@@ -89,5 +90,10 @@ case class Sum(child: Expression) extends
DeclarativeAggregate with ImplicitCast
)
}
- override lazy val evaluateExpression: Expression = sum
+ override lazy val evaluateExpression: Expression = dataType match {
+ case DecimalType.Fixed(precision, scale) =>
+ CheckOverflow(sum, DecimalType(precision, scale),
SQLConf.get.decimalOperationsNullOnOverflow)
Review comment:
yes, sorry, I meant something like this:
```
case _: DecimalType =>
CheckOverflow(sum, resultType,
SQLConf.get.decimalOperationsNullOnOverflow)
```
In this way we do not create a new `DecimalType` and I think it is more
readable... Thanks.
----------------------------------------------------------------
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]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]