cloud-fan commented on code in PR #49445:
URL: https://github.com/apache/spark/pull/49445#discussion_r1926879054


##########
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:
   Thanks for the explanation! Instead of hacking the `AnalysisContext`, how 
about we move the hack into the scripting itself? e.g. in 
`SingleStatementExec#buildDataFrame`, if the parsed plan is 
`ExecuteImmediateQuery`, we do
   ```
   SqlScriptingVariableManager.create(None).runWith(Dataset.ofRows(session, 
preparedPlan))
   ```



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

Reply via email to