maropu commented on a change in pull request #32303:
URL: https://github.com/apache/spark/pull/32303#discussion_r647092456



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala
##########
@@ -784,11 +791,10 @@ trait CheckAnalysis extends PredicateHelper with 
LookupCatalog {
             failAnalysis(s"IN/EXISTS predicate sub-queries can only be used 
in" +
                 s" Filter/Join and a few commands: $plan")
         }
+        // Validate to make sure the correlations appearing in the query are 
valid and
+        // allowed by spark.
+        checkCorrelationsInSubquery(expr.plan)
     }
-
-    // Validate to make sure the correlations appearing in the query are valid 
and
-    // allowed by spark.
-    checkCorrelationsInSubquery(expr.plan)

Review comment:
       Instead of moving this check into each `case` statement, can we just 
check if `plan` is lateral or not here?
   ```
   checkCorrelationsInSubquery(expr.plan, isLateral = 
plan.isInstanceOf[LateralJoin])
   ```




-- 
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to