Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/9959#discussion_r45950794
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
---
@@ -690,12 +684,24 @@ object PushPredicateThroughAggregate extends
Rule[LogicalPlan] with PredicateHel
def apply(plan: LogicalPlan): LogicalPlan = plan transform {
case filter @ Filter(condition,
aggregate @ Aggregate(groupingExpressions, aggregateExpressions,
grandChild)) =>
- val (pushDown, stayUp) =
splitConjunctivePredicates(condition).partition {
- conjunct => conjunct.references subsetOf
AttributeSet(groupingExpressions)
+
+ def hasAggregate(expression: Expression): Boolean = expression match
{
+ case agg: AggregateExpression => true
+ case other => expression.children.exists(hasAggregate)
+ }
--- End diff --
a simplification:
`expr.find(_.isInstanceOf[AggregateExpression]).isDefined`, but it's minor, may
not worth another roundtrip.
---
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]