Github user mateiz commented on a diff in the pull request:
https://github.com/apache/spark/pull/2983#discussion_r19707994
--- 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 --
Unfortunately I'm not sure where to put this into a rule. This is currently
in the execute() method of GenratedAggregate, which only gets created in the
Spark query planning stage (SparkStrategies), so rules from the optimizer won't
apply here. Is there a place to add further rules after planning?
---
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]