hvanhovell commented on a change in pull request #27267: [SPARK-30556][SQL]
Copy sparkContext.localproperties to child thread
inSubqueryExec.executionContext
URL: https://github.com/apache/spark/pull/27267#discussion_r369251674
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/SQLExecution.scala
##########
@@ -164,4 +166,18 @@ object SQLExecution {
}
}
}
+
+ /**
+ * Wrap passed function to ensure sparkContext local properties are
forwarded to execution thread
+ */
+ def withThreadLocalCaptured[T](sparkSession: SparkSession)(body: => T)(
+ exec: ExecutionContext): Future[T] = {
+ val activeSession = sparkSession
+ val localProps =
Utils.cloneProperties(sparkSession.sparkContext.getLocalProperties)
Review comment:
I would be in favor of cloning them (BTW I am not sure why
Utils.cloneProperties does not just use clone - the current implementation is
probably less efficient). My main worry is that the local properties object is
shared between multiple threads (which can happen if have multiple broadcast
joins for example), and that these threads no start influencing each other and
the main thread; I would like to avoid midnight debugging sessions caused by
this.
----------------------------------------------------------------
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]