cloud-fan commented on issue #27267: [SPARK-30556][SQL] Copy 
sparkContext.localproperties to child thread inSubqueryExec.executionContext
URL: https://github.com/apache/spark/pull/27267#issuecomment-576595096
 
 
   I think this is a common problem when we run code in a thread pool. I just 
realized that we hit a similar issue before with `SQLConf.get` and we add a 
hack to work around it.
   
   Shall we add a util function to easily capture the necessary thread locals 
and propagate them to thread pool? For example, we can add a 
`SQLExecution.withThreadLocalCaptured`
   ```
   def withThreadLocalCaptured(f: => T): Future[T] = {
     val activeSession = ...
     val localProperties = ...
     // any other important thread locals?
     Future {
       // set active sessionn
       // set local properties
      f
     }
   }
   ```
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to