ulysses-you commented on code in PR #37207:
URL: https://github.com/apache/spark/pull/37207#discussion_r924028738
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/Average.scala:
##########
@@ -88,9 +88,14 @@ abstract class AverageBase
// We can't directly use `/` as it throws an exception under ansi mode.
protected def getEvaluateExpression(queryContext: String) = child.dataType
match {
case _: DecimalType =>
- Divide(
- CheckOverflowInSum(sum, sumDataType.asInstanceOf[DecimalType],
!useAnsiAdd, queryContext),
- count.cast(DecimalType.LongDecimal), failOnError =
false).cast(resultType)
Review Comment:
I see, then it's also a unnecessary overflow check for average before this
pr. if sum is not overflow, sum / count will never overflow.
--
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]