dongjoon-hyun commented on code in PR #60628:
URL: https://github.com/apache/spark/pull/60628#discussion_r4607889498


##########
sql/core/src/main/scala/org/apache/spark/sql/catalyst/analysis/InvokeProcedures.scala:
##########
@@ -62,6 +63,21 @@ class InvokeProcedures(session: SparkSession) extends 
Rule[LogicalPlan] {
       }
   }
 
+  /**
+   * Checks the subqueries in the arguments as `CheckAnalysis` checks them in 
a SELECT. It never
+   * checks them in a CALL, as this rule replaces the `Call` with its result. 
Unchecked, an invalid
+   * subquery can make the optimizer fail, or lose its invalid part and let 
the procedure run.
+   * A SELECT, unlike a `Call`, allows an uncorrelated EXISTS subquery, which 
works in a CALL as
+   * the optimizer rewrites it into a scalar subquery.
+   */
+  private def checkSubqueries(call: Call): Unit = {
+    val subqueries = call.args.flatMap(_.collect { case s: SubqueryExpression 
=> s })

Review Comment:
   Thanks for the review! The argument expressions outside a subquery are 
already handled by apache/spark#60632 (SPARK-61889).



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