hvanhovell commented on a change in pull request #27266: [SPARK-22590][SQL]
Copy sparkContext.localproperties to child thread in
BroadcastExchangeExec.executionContext
URL: https://github.com/apache/spark/pull/27266#discussion_r372939597
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/SQLExecution.scala
##########
@@ -182,4 +182,22 @@ object SQLExecution {
body
}(exec)
}
+
+ /**
+ * Wrap passed function to ensure necessary thread-local variables like
+ * SparkContext local properties are forwarded to execution thread
+ */
+ def withThreadLocalCaptured[T](
+ sparkSession: SparkSession)(body: => T): Callable[T] = {
+ val activeSession = sparkSession
+ val sc = sparkSession.sparkContext
+ val localProps = Utils.cloneProperties(sc.getLocalProperties)
+ () => {
+ SparkSession.setActiveSession(activeSession)
Review comment:
Please unset these once we you are done.
----------------------------------------------------------------
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]