Skip to content

Commit 3670f00

Browse files
committed
Code review feedback.
1 parent c1185cd commit 3670f00

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

core/src/main/scala/org/apache/spark/broadcast/TorrentBroadcast.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ private[spark] class TorrentBroadcast[T: ClassTag](
5454
id: Long)
5555
extends Broadcast[T](id) with Logging with Serializable {
5656

57-
override protected def getValue() = _value
58-
5957
/**
6058
* Value of the broadcast object. On driver, this is set directly by the constructor.
6159
* On executors, this is reconstructed by [[readObject]], which builds this value by reading
@@ -68,6 +66,8 @@ private[spark] class TorrentBroadcast[T: ClassTag](
6866

6967
private val broadcastId = BroadcastBlockId(id)
7068

69+
override protected def getValue() = _value
70+
7171
/**
7272
* Divide the object into multiple blocks and put those blocks in the block manager.
7373
*
@@ -79,7 +79,7 @@ private[spark] class TorrentBroadcast[T: ClassTag](
7979
// TODO: Use putBytes directly.
8080
SparkEnv.get.blockManager.putSingle(
8181
BroadcastBlockId(id, "piece" + i),
82-
blocks(i),
82+
block,
8383
StorageLevel.MEMORY_AND_DISK_SER,
8484
tellMaster = true)
8585
}
@@ -89,7 +89,7 @@ private[spark] class TorrentBroadcast[T: ClassTag](
8989
/** Fetch torrent blocks from the driver and/or other executors. */
9090
private def readBlocks(): Array[Array[Byte]] = {
9191
// Fetch chunks of data. Note that all these chunks are stored in the BlockManager and reported
92-
// to the driver, so other executors can pull these thunks from this executor as well.
92+
// to the driver, so other executors can pull these chunks from this executor as well.
9393
var numBlocksAvailable = 0
9494
val blocks = new Array[Array[Byte]](numBlocks)
9595

@@ -149,7 +149,7 @@ private[spark] class TorrentBroadcast[T: ClassTag](
149149
logInfo("Reading broadcast variable " + id + " took " + time + " s")
150150

151151
_value = TorrentBroadcast.unBlockifyObject[T](blocks)
152-
// Store the merged copy in BlockManager so other tasks on this executor doesn't
152+
// Store the merged copy in BlockManager so other tasks on this executor don't
153153
// need to re-fetch it.
154154
SparkEnv.get.blockManager.putSingle(
155155
broadcastId, _value, StorageLevel.MEMORY_AND_DISK, tellMaster = false)

0 commit comments

Comments
 (0)