Github user marmbrus commented on a diff in the pull request:
https://github.com/apache/spark/pull/3184#discussion_r20392048
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/GeneratedAggregate.scala
---
@@ -117,15 +119,15 @@ case class GeneratedAggregate(
val updateCount = If(IsNotNull(toCount), Add(currentCount,
Literal(1L)), currentCount)
val updateSum = Coalesce(Add(expr, currentSum) :: currentSum ::
Nil)
- val resultType = expr.dataType match {
- case DecimalType.Fixed(precision, scale) =>
- DecimalType(precision + 4, scale + 4)
- case DecimalType.Unlimited =>
+ val calcType =
+ if (DecimalType.isFixed(expr.dataType)) {
--- End diff --
Are you changing the semantics of the aggregation here? We are trying to
follow specific rules about how precision is supposed to change when doing
aggregation of decimals. [See here for more
details](https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/HiveTypeCoercion.scala#L284)
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]