diff options
author | navis.ryu <navis@apache.org> | 2015-06-10 18:19:12 -0700 |
---|---|---|
committer | Reynold Xin <rxin@databricks.com> | 2015-06-10 18:19:12 -0700 |
commit | 6a47114bc297f0bce874e425feb1c24a5c26cef0 (patch) | |
tree | 5ac9f4927a6fe85a06a4c3b425447de056e8f17d /sql | |
parent | 37719e0cd0b00cc5ffee0ebe1652d465a574db0f (diff) | |
download | spark-6a47114bc297f0bce874e425feb1c24a5c26cef0.tar.gz spark-6a47114bc297f0bce874e425feb1c24a5c26cef0.tar.bz2 spark-6a47114bc297f0bce874e425feb1c24a5c26cef0.zip |
[SPARK-8285] [SQL] CombineSum should be calculated as unlimited decimal first
case cs CombineSum(expr) =>
val calcType = expr.dataType
expr.dataType match {
case DecimalType.Fixed(_, _) =>
DecimalType.Unlimited
case _ =>
expr.dataType
}
calcType is always expr.dataType. credits are all belong to IntelliJ
Author: navis.ryu <navis@apache.org>
Closes #6736 from navis/SPARK-8285 and squashes the following commits:
20382c1 [navis.ryu] [SPARK-8285] [SQL] CombineSum should be calculated as unlimited decimal first
Diffstat (limited to 'sql')
-rw-r--r-- | sql/core/src/main/scala/org/apache/spark/sql/execution/GeneratedAggregate.scala | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/core/src/main/scala/org/apache/spark/sql/execution/GeneratedAggregate.scala b/sql/core/src/main/scala/org/apache/spark/sql/execution/GeneratedAggregate.scala index 3e27c1bde2..af3791734d 100644 --- a/sql/core/src/main/scala/org/apache/spark/sql/execution/GeneratedAggregate.scala +++ b/sql/core/src/main/scala/org/apache/spark/sql/execution/GeneratedAggregate.scala @@ -118,7 +118,7 @@ case class GeneratedAggregate( AggregateEvaluation(currentSum :: Nil, initialValue :: Nil, updateFunction :: Nil, result) case cs @ CombineSum(expr) => - val calcType = expr.dataType + val calcType = expr.dataType match { case DecimalType.Fixed(_, _) => DecimalType.Unlimited @@ -129,7 +129,7 @@ case class GeneratedAggregate( val currentSum = AttributeReference("currentSum", calcType, nullable = true)() val initialValue = Literal.create(null, calcType) - // Coalasce avoids double calculation... + // Coalesce avoids double calculation... // but really, common sub expression elimination would be better.... val zero = Cast(Literal(0), calcType) // If we're evaluating UnscaledValue(x), we can do Count on x directly, since its |