srielau commented on code in PR #52173: URL: https://github.com/apache/spark/pull/52173#discussion_r2338923141
########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/executeImmediate.scala: ########## @@ -17,202 +17,109 @@ package org.apache.spark.sql.catalyst.analysis -import scala.util.{Either, Left, Right} - -import org.apache.spark.sql.catalyst.expressions.{Alias, Expression, VariableReference} -import org.apache.spark.sql.catalyst.parser.ParseException -import org.apache.spark.sql.catalyst.plans.logical.{CompoundBody, LogicalPlan, SetVariable} +import org.apache.spark.sql.catalyst.expressions.{Alias, Attribute, Expression, VariableReference} +import org.apache.spark.sql.catalyst.plans.logical.{ExecutableDuringAnalysis, LocalRelation, LogicalPlan, SetVariable, SupportsSubquery, UnaryNode} import org.apache.spark.sql.catalyst.rules.Rule import org.apache.spark.sql.catalyst.trees.TreePattern.{EXECUTE_IMMEDIATE, TreePattern} import org.apache.spark.sql.connector.catalog.CatalogManager import org.apache.spark.sql.errors.QueryCompilationErrors -import org.apache.spark.sql.types.StringType /** * Logical plan representing execute immediate query. * - * @param args parameters of query - * @param query query string or variable + * @param sqlStmtStr the query expression (first child) + * @param args parameters from USING clause (subsequent children) * @param targetVariables variables to store the result of the query */ -case class ExecuteImmediateQuery( +case class UnresolvedExecuteImmediate( + sqlStmtStr: Expression, args: Seq[Expression], - query: Either[String, UnresolvedAttribute], - targetVariables: Seq[UnresolvedAttribute]) - extends UnresolvedLeafNode { + targetVariables: Seq[Expression]) + extends UnresolvedLeafNode with SupportsSubquery { Review Comment: Actually I added this on purpose. It allows the inputs to survive analysis and then the regular constant folding code can block complex queries. I think this is very clean. -- 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-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org