davidm-db commented on code in PR #49445: URL: https://github.com/apache/spark/pull/49445#discussion_r1913369000
########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/executeImmediate.scala: ########## @@ -185,7 +185,7 @@ class SubstituteExecuteImmediate(val catalogManager: CatalogManager) } private def getVariableReference(expr: Expression, nameParts: Seq[String]): VariableReference = { - lookupVariable(nameParts) match { + lookupVariable(nameParts, sessionVariablesOnly = true) match { Review Comment: will this be okay to allow referencing local variables in the `USING` clause of the `EXECUTE IMMEDIATE`? looking at the `apply` function here, it looks like the call chain when resolving execute immediate params is (`apply` -> `resolveArugments` -> `resolveVariable` -> `getVariableReference`) and the flag will be `true` always, which means only session variables can be used in the `USING` clause. Or am I missing something? I guess we could add a test that tests this anyways. -- 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