Github user viirya commented on a diff in the pull request:
https://github.com/apache/spark/pull/19496#discussion_r144689475
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/Average.scala
---
@@ -80,7 +80,8 @@ case class Average(child: Expression) extends
DeclarativeAggregate with Implicit
case DecimalType.Fixed(p, s) =>
// increase the precision and scale to prevent precision loss
val dt = DecimalType.bounded(p + 14, s + 4)
- Cast(Cast(sum, dt) / Cast(count, dt), resultType)
+ Cast(Cast(sum, dt) / Cast(count, DecimalType.bounded
(DecimalType.MAX_PRECISION, 0)),
--- End diff --
No need to add space after `bounded`.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]