Github user zsxwing commented on a diff in the pull request:
https://github.com/apache/spark/pull/7774#discussion_r35837036
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/joins/BroadcastHashOuterJoin.scala
---
@@ -57,13 +57,26 @@ case class BroadcastHashOuterJoin(
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, buildKeyGenerator,
input.size)
- sparkContext.broadcast(hashed)
- }(BroadcastHashOuterJoin.broadcastHashOuterJoinExecutionContext)
+ private lazy val broadcastFuture = {
--- End diff --
Although @mateiz removed `lazy` in #1990, I want to add it back here.
Because without `lazy`, if the user runs `explain`, the `broadcastFuture` will
run and I cannot track the job.
---
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]