cloud-fan commented on code in PR #49445: URL: https://github.com/apache/spark/pull/49445#discussion_r1925386521
########## sql/catalyst/src/main/scala/org/apache/spark/sql/connector/catalog/CatalogManager.scala: ########## @@ -49,6 +49,18 @@ class CatalogManager( // TODO: create a real SYSTEM catalog to host `TempVariableManager` under the SESSION namespace. val tempVariableManager: TempVariableManager = new TempVariableManager + // This field will be populated and cleaned up by SqlScriptingExecution. + private val sqlScriptingLocalVariableManager: InheritableThreadLocal[Option[VariableManager]] = Review Comment: I'm afraid ThreadLocal is the only way to hold states between long distances, and it's used quite often in Spark. Ideally we should pass states around explicitly, which means the Analyzer should take an extra parameter for cross-query states, but the change might be invasive. How about we start with ThreadLocal? We can remove it once there is a better mechanism to pass state object to Analyzer. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
