Github user marmbrus commented on a diff in the pull request:
https://github.com/apache/spark/pull/9167#discussion_r42527600
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
---
@@ -675,6 +676,29 @@ object PushPredicateThroughGenerate extends
Rule[LogicalPlan] with PredicateHelp
}
/**
+ * Push [[Filter]] operators through [[Aggregate]] operators. Parts of the
predicate that reference
+ * attributes which are subset of group by attribute set of [[Aggregate]]
will be pushed beneath,
+ * and the rest should remain above.
+ */
+object PushPredicateThroughAggregate extends Rule[LogicalPlan] with
PredicateHelper {
+
+ def apply(plan: LogicalPlan): LogicalPlan = plan transform {
+ case filter @ Filter(condition,
+ aggregate @ Aggregate(groupingExpressions, aggregateExpressions,
grandChild)) =>
--- End diff --
nit: indentation. I'm not sure we have a strict rule, but no indent is
kinda hard to follow. I'd probably try to make it a tree if it fits?
```scala
case filter @ Filter(condition,
aggregate @ Aggregate(groupingExpressions, aggregateExpressions,
grandChild)) =>
```
or just 4 space indent?
---
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]