francis0407 commented on a change in pull request #24344: [SPARK-27440][SQL] 
Optimize uncorrelated predicate subquery
URL: https://github.com/apache/spark/pull/24344#discussion_r285871312
 
 

 ##########
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/subquery.scala
 ##########
 @@ -93,6 +93,21 @@ object SubqueryExpression {
     }.isDefined
   }
 
+  /**
+   * Returns true when an expression contains a correlated IN or correlated 
EXISTS and
+   * false otherwise. An IN is non-correlated only if the left values are 
foldable
+   * and the subquery has no outer references.
+   */
+  def hasCorrelatedInOrExists(e: Expression): Boolean = {
 
 Review comment:
   Moreover, I think `a in (select b from c)` is a `Correlated In` with a 
`Non-Correlated Subquery`. And we are not going to use a subplan for it. We 
only need to deal with the `Non-Correlated In`, whose left value should be 
literal(or foldable) and the right subquery is non-correlated, such as `3 in 
(select b from c)`.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

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

Reply via email to