Github user marmbrus commented on a diff in the pull request:
https://github.com/apache/spark/pull/2983#discussion_r19698052
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/GeneratedAggregate.scala
---
@@ -70,16 +70,29 @@ case class GeneratedAggregate(
val computeFunctions = aggregatesToCompute.map {
case c @ Count(expr) =>
+ // If we're evaluating UnscaledValue(x), we can do Count on x
directly, since its
+ // UnscaledValue will be null if and only if x is null; helps with
Average on decimals
+ val toCount = expr match {
+ case UnscaledValue(e) => e
+ case _ => expr
+ }
--- End diff --
This could be a rule right? I only mention this because I thought you
weren't doing this optimization when I was playing around with some query
plans. Of course you actually thought of everything :)
---
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]