Github user andrewor14 commented on a diff in the pull request:
https://github.com/apache/spark/pull/7774#discussion_r36039842
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/joins/BroadcastHashJoin.scala
---
@@ -58,13 +58,26 @@ case class BroadcastHashJoin(
override def requiredChildDistribution: Seq[Distribution] =
UnspecifiedDistribution :: UnspecifiedDistribution :: Nil
+ /**
+ * Use lazy so that we won't do broadcast when calling explain but still
cache the broadcast value
+ * for the same query.
+ */
@transient
- private val broadcastFuture = future {
- // Note that we use .execute().collect() because we don't want to
convert data to Scala types
- val input: Array[InternalRow] =
buildPlan.execute().map(_.copy()).collect()
- val hashed = HashedRelation(input.iterator, buildSideKeyGenerator,
input.size)
- sparkContext.broadcast(hashed)
- }(BroadcastHashJoin.broadcastHashJoinExecutionContext)
+ private lazy val broadcastFuture = {
+ // broadcastFuture is used in "doExecute". Therefore we can get the
execution id correctly here.
+ val executionId =
sparkContext.getLocalProperty(SparkSQLExecution.EXECUTION_ID_KEY)
+ Future {
--- End diff --
The old code used lower case `future`. Does this change anything? (probably
not, but just wondering)
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]