yaooqinn commented on a change in pull request #31079:
URL: https://github.com/apache/spark/pull/31079#discussion_r553747250



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercion.scala
##########
@@ -634,17 +634,6 @@ object TypeCoercion {
 
         m.copy(newKeys.zip(newValues).flatMap { case (k, v) => Seq(k, v) })
 
-      // Promote SUM, SUM DISTINCT and AVERAGE to largest types to prevent 
overflows.
-      case s @ Sum(e @ DecimalType()) => s // Decimal is already the biggest.

Review comment:
       the type-coercion for numeric types of average and sum is not necessary 
at all, as the resultType and sumType can prevent the overflow. and it causes 
the issue here




----------------------------------------------------------------
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]

Reply via email to