Github user davies commented on a diff in the pull request:
https://github.com/apache/spark/pull/12539#discussion_r60697650
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
---
@@ -1536,17 +1560,22 @@ object RewritePredicateSubquery extends
Rule[LogicalPlan] with PredicateHelper {
// Filter the plan by applying left semi and left anti joins.
withSubquery.foldLeft(newFilter) {
- case (p, Exists(sub)) =>
+ case (p, Exists(sub, _)) =>
val (resolved, conditions) = pullOutCorrelatedPredicates(sub, p)
Join(p, resolved, LeftSemi, conditions.reduceOption(And))
- case (p, Not(Exists(sub))) =>
+ case (p, Not(Exists(sub, _))) =>
val (resolved, conditions) = pullOutCorrelatedPredicates(sub, p)
Join(p, resolved, LeftAnti, conditions.reduceOption(And))
case (p, in: InSubQuery) =>
- val (resolved, conditions) = pullOutCorrelatedPredicates(in, p)
- Join(p, resolved, LeftSemi, conditions.reduceOption(And))
+ val (newP, resolved, conditions) =
pullOutCorrelatedPredicates(in, p)
--- End diff --
Yes, This additional Project could be removed by other rules.
I thought this rule was in the last batch of optimizer, it actually is in
the first batch. We may move this rule after predicate push down, then this
if/else could be useful.
---
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]