You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/07/03 08:21:22 UTC

[GitHub] [spark] mgaido91 commented on a change in pull request #25033: [SPARK-28224][SQL] Aggregate sum large decimals

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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org