dusantism-db commented on code in PR #49445: URL: https://github.com/apache/spark/pull/49445#discussion_r1926761739
########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala: ########## @@ -139,6 +139,9 @@ object FakeV2SessionCatalog extends TableCatalog with FunctionCatalog with Suppo * even if a temp view `t` has been created. * @param outerPlan The query plan from the outer query that can be used to resolve star * expressions in a subquery. + * @param isExecuteImmediate Whether the current plan is created by EXECUTE IMMEDIATE. Used when + * resolving variables, as SQL Scripting local variables should not be + * visible from EXECUTE IMMEDIATE. Review Comment: Examples: Should work: ``` BEGIN DECLARE testVar = 5; EXECUTE IMMEDIATE 'SELECT ?' USING testVar; END ``` Should work: ``` BEGIN DECLARE localVar = 1; EXECUTE IMMEDIATE 'SELECT 5' INTO localVar; END ``` Should not work: ``` BEGIN DECLARE localVar = 5; EXECUTE IMMEDIATE 'SELECT localVar'; END ``` -- 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