You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "dtenedor (via GitHub)" <gi...@apache.org> on 2024/03/25 18:50:33 UTC

Re: [PR] [SPARK-47509][SQL] Block subquery expressions in lambda and higher-order functions [spark]

dtenedor commented on code in PR #45652:
URL: https://github.com/apache/spark/pull/45652#discussion_r1538082343


##########
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:
   This is done.



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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