Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/11828#discussion_r56921893
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
---
@@ -305,21 +305,21 @@ object SetOperationPushDown extends Rule[LogicalPlan]
with PredicateHelper {
}
/**
- * Attempts to eliminate the reading of unneeded columns from the query
plan using the following
- * transformations:
+ * Attempts to eliminate the reading of unneeded columns from the query
plan.
*
- * - Inserting Projections beneath the following operators:
- * - Aggregate
- * - Generate
- * - Project <- Join
- * - LeftSemiJoin
+ * Since adding Project before Filter conflicts with
PushPredicatesThroughProject, this rule will
+ * remove the Project p2 in the following pattern:
+ *
+ * p1 @ Project(_, Filter(_, p2 @ Project(_, child))) if
p2.outputSet.subsetOf(p2.inputSet)
--- End diff --
If this is our target, why not add a new case before [the last
case](https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala#L394),
and handle `case p1 @ Project(_, f @ Filter(_, child)` specially? i.e. don't
insert a `Project` if unnecessary.
---
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]