davidm-db commented on code in PR #49445: URL: https://github.com/apache/spark/pull/49445#discussion_r1925889523
########## sql/core/src/main/scala/org/apache/spark/sql/scripting/SqlScriptingExecution.scala: ########## @@ -55,7 +55,15 @@ class SqlScriptingExecution( } private val variableManager = new SqlScriptingVariableManager(context) - session.sessionState.catalogManager.setSqlScriptingLocalVariableManager(Some(variableManager)) + private val handle = SqlScriptingVariableManager.create(variableManager) + + /** + * Handles scripting context creation/access/deletion. Calls to execution API must be wrapped + * with this method. + */ + def runWithContext[R](f: => R): R = { + handle.runWith(f) + } Review Comment: It's a bit strange using the word `context` here, since we have `SqlScriptingExecutionContext` and this has nothing to do with it. Maybe `runWithVariableManager`? Or maybe just `withVariableManager` to follow the naming of `withErrorHandling`? -- 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