cloud-fan commented on code in PR #45652:
URL: https://github.com/apache/spark/pull/45652#discussion_r1537002460


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/higherOrderFunctions.scala:
##########
@@ -138,4 +141,16 @@ object ResolveLambdaVariables extends Rule[LogicalPlan] {
     case _ =>
       e.mapChildren(resolve(_, parentLambdaMap))
   }
+
+  /**
+   * SPARK-47509: There is a correctness bug when subquery expressions appear 
within lambdas or
+   * higher-order functions. Here we check for that case and return an error 
if the corresponding
+   * configuration indicates to do so.
+   */
+  private def checkForSubqueryExpressions(expression: Expression): Unit = {
+    if (expression.containsPattern(PLAN_EXPRESSION) &&
+      
!conf.getConf(SQLConf.ALLOW_SUBQUERY_EXPRESSIONS_IN_LAMBDAS_AND_HIGHER_ORDER_FUNCTIONS))
 {
+      throw 
QueryCompilationErrors.subqueryExpressionInLambdaOrHigherOrderFunctionNotAllowedError()

Review Comment:
   shall we update the PR title to match the new code?



-- 
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.

To unsubscribe, e-mail: [email protected]

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