aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorJosh Rosen <joshrosen@apache.org>2013-10-20 13:20:14 -0700
committerJosh Rosen <joshrosen@apache.org>2013-10-20 13:20:14 -0700
commit68d6806ea493a0a87dc46fa2272dcfe1c014f290 (patch)
tree90369f22313759bc3a4a39140734daed0bacc093 /core
parent867d8fdf2a3617086016022dba9f8bb60feccd42 (diff)
downloadspark-68d6806ea493a0a87dc46fa2272dcfe1c014f290.tar.gz
spark-68d6806ea493a0a87dc46fa2272dcfe1c014f290.tar.bz2
spark-68d6806ea493a0a87dc46fa2272dcfe1c014f290.zip
Minor cleanup based on @aarondav's code review.
Diffstat (limited to 'core')
-rw-r--r--core/src/main/scala/org/apache/spark/storage/BlockManager.scala16
1 files changed, 5 insertions, 11 deletions
diff --git a/core/src/main/scala/org/apache/spark/storage/BlockManager.scala b/core/src/main/scala/org/apache/spark/storage/BlockManager.scala
index 653b97b768..768e5a647f 100644
--- a/core/src/main/scala/org/apache/spark/storage/BlockManager.scala
+++ b/core/src/main/scala/org/apache/spark/storage/BlockManager.scala
@@ -394,7 +394,7 @@ private[spark] class BlockManager(
// Otherwise, we also have to store something in the memory store:
if (!level.deserialized || !asValues) {
// We'll store the bytes in memory if the block's storage level includes
- // "memory serialized", or if it should cached as objects in memory
+ // "memory serialized", or if it should be cached as objects in memory
// but we only requested its serialized bytes:
val copyForMemory = ByteBuffer.allocate(bytes.limit)
copyForMemory.put(bytes)
@@ -626,16 +626,10 @@ private[spark] class BlockManager(
}
}
case Right(bytes) => {
- if (level.useMemory) {
- // Store it only in memory at first, even if useDisk is also set to true
- bytes.rewind()
- memoryStore.putBytes(blockId, bytes, level)
- size = bytes.limit
- } else {
- bytes.rewind()
- diskStore.putBytes(blockId, bytes, level)
- size = bytes.limit
- }
+ bytes.rewind()
+ // Store it only in memory at first, even if useDisk is also set to true
+ (if (level.useMemory) memoryStore else diskStore).putBytes(blockId, bytes, level)
+ size = bytes.limit
}
}