Github user yhuai commented on a diff in the pull request:
https://github.com/apache/spark/pull/8742#discussion_r39474132
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
---
@@ -136,26 +136,12 @@ object SetOperationPushDown extends Rule[LogicalPlan]
{
Filter(condition, left),
Filter(pushToRight(condition, rewrites), right))
- // Push down projection into intersect
- case Project(projectList, i @ Intersect(left, right)) =>
- val rewrites = buildRewrites(i)
- Intersect(
- Project(projectList, left),
- Project(projectList.map(pushToRight(_, rewrites)), right))
-
// Push down filter into except
case Filter(condition, e @ Except(left, right)) =>
val rewrites = buildRewrites(e)
Except(
Filter(condition, left),
Filter(pushToRight(condition, rewrites), right))
-
- // Push down projection into except
- case Project(projectList, e @ Except(left, right)) =>
- val rewrites = buildRewrites(e)
- Except(
- Project(projectList, left),
- Project(projectList.map(pushToRight(_, rewrites)), right))
--- End diff --
Can we add comments in this class to explain why we cannot pushdown
projections? For filter pushdown, if the condition has non-deterministic
expressions, it is not safe to pushdown filters for some cases. But, it will
not be the case because of https://github.com/apache/spark/pull/7446. But, it
is still good to think about if there is any case that filter pushdown is not
safe. If we determine it is safe to do filter pushdown, let's add comments to
explain the reason.
---
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]