Github user gatorsmile commented on a diff in the pull request:

    https://github.com/apache/spark/pull/16954#discussion_r103852353
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/subquery.scala
 ---
    @@ -83,29 +95,150 @@ object RewritePredicateSubquery extends 
Rule[LogicalPlan] with PredicateHelper {
       }
     
       /**
    -   * Given a predicate expression and an input plan, it rewrites
    -   * any embedded existential sub-query into an existential join.
    -   * It returns the rewritten expression together with the updated plan.
    -   * Currently, it does not support null-aware joins. Embedded NOT IN 
predicates
    -   * are blocked in the Analyzer.
    +   * Given a predicate expression and an input plan, it rewrites any 
embedded existential sub-query
    +   * into an existential join. It returns the rewritten expression 
together with the updated plan.
    +   * Currently, it does not support NOT IN nested inside a NOT expression. 
This case is blocked in
    +   * the Analyzer.
        */
       private def rewriteExistentialExpr(
           exprs: Seq[Expression],
           plan: LogicalPlan): (Option[Expression], LogicalPlan) = {
         var newPlan = plan
         val newExprs = exprs.map { e =>
           e transformUp {
    -        case PredicateSubquery(sub, conditions, nullAware, _) =>
    -          // TODO: support null-aware join
    +        case Exists(sub, conditions, exprId) =>
               val exists = AttributeReference("exists", BooleanType, nullable 
= false)()
    -          newPlan = Join(newPlan, sub, ExistenceJoin(exists), 
conditions.reduceLeftOption(And))
    +          newPlan = Join(newPlan, sub,
    +            ExistenceJoin(exists), conditions.reduceLeftOption(And))
               exists
    -        }
    +        case In(e, Seq(l@ ListQuery(sub, conditions, exprId))) =>
    --- End diff --
    
    `case In(value, Seq(ListQuery(sub, conditions, _)))`


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to