-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-22590][SQL] Copy sparkContext.localproperties to child thread in BroadcastExchangeExec.executionContext #27266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 10 commits
6803bb0
ae519ca
59b42d4
dd42e11
354dc61
0b62b52
b208a7a
65c49de
0f39043
742d322
11fffca
763d1bc
2ed76c3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,7 +34,7 @@ import org.apache.spark.sql.execution.{SparkPlan, SQLExecution} | |
| import org.apache.spark.sql.execution.joins.HashedRelation | ||
| import org.apache.spark.sql.execution.metric.SQLMetrics | ||
| import org.apache.spark.sql.internal.{SQLConf, StaticSQLConf} | ||
| import org.apache.spark.util.{SparkFatalException, ThreadUtils} | ||
| import org.apache.spark.util.{SparkFatalException, ThreadUtils, Utils} | ||
|
|
||
| /** | ||
| * A [[BroadcastExchangeExec]] collects, transforms and finally broadcasts the result of | ||
|
|
@@ -73,13 +73,8 @@ case class BroadcastExchangeExec( | |
|
|
||
| @transient | ||
| private[sql] lazy val relationFuture: Future[broadcast.Broadcast[Any]] = { | ||
| // relationFuture is used in "doExecute". Therefore we can get the execution id correctly here. | ||
|
||
| val executionId = sparkContext.getLocalProperty(SQLExecution.EXECUTION_ID_KEY) | ||
| val task = new Callable[broadcast.Broadcast[Any]]() { | ||
| override def call(): broadcast.Broadcast[Any] = { | ||
| // This will run in another thread. Set the execution id so that we can connect these jobs | ||
| // with the correct execution. | ||
| SQLExecution.withExecutionId(sqlContext.sparkSession, executionId) { | ||
| SQLExecution.withThreadLocalCaptured[broadcast.Broadcast[Any]]( | ||
| sqlContext.sparkSession, BroadcastExchangeExec.executionContext) { | ||
| try { | ||
| // Setup a job group here so later it may get cancelled by groupId if necessary. | ||
| sparkContext.setJobGroup(runId.toString, s"broadcast exchange (runId $runId)", | ||
|
|
@@ -121,7 +116,7 @@ case class BroadcastExchangeExec( | |
| val broadcasted = sparkContext.broadcast(relation) | ||
| longMetric("broadcastTime") += NANOSECONDS.toMillis( | ||
| System.nanoTime() - beforeBroadcast) | ||
|
|
||
| val executionId = sparkContext.getLocalProperty(SQLExecution.EXECUTION_ID_KEY) | ||
| SQLMetrics.postDriverMetricUpdates(sparkContext, executionId, metrics.values.toSeq) | ||
| promise.success(broadcasted) | ||
| broadcasted | ||
|
|
@@ -146,10 +141,7 @@ case class BroadcastExchangeExec( | |
| promise.failure(e) | ||
| throw e | ||
| } | ||
| } | ||
| } | ||
| } | ||
| BroadcastExchangeExec.executionContext.submit[broadcast.Broadcast[Any]](task) | ||
| } | ||
|
|
||
| override protected def doPrepare(): Unit = { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.