Skip to content

Commit cac1fad

Browse files
committed
Fixing MemoryStore, so that it converts incoming iterators to ArrayBuffer objects. This was previously done higher up the stack.
1 parent efe1102 commit cac1fad

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

core/src/main/scala/org/apache/spark/storage/MemoryStore.scala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,11 @@ private class MemoryStore(blockManager: BlockManager, maxMemory: Long)
7171
: PutResult = {
7272

7373
if (level.deserialized) {
74-
val sizeEstimate = SizeEstimator.estimate(values.asInstanceOf[AnyRef])
75-
tryToPut(blockId, values, sizeEstimate, true)
76-
PutResult(sizeEstimate, Left(values))
74+
val valueEntries = new ArrayBuffer[Any]();
75+
valueEntries ++= values;
76+
val sizeEstimate = SizeEstimator.estimate(valueEntries.asInstanceOf[AnyRef])
77+
tryToPut(blockId, valueEntries, sizeEstimate, true)
78+
PutResult(sizeEstimate, Left(valueEntries.toIterator))
7779
} else {
7880
val bytes = blockManager.dataSerialize(blockId, values)
7981
tryToPut(blockId, bytes, bytes.limit, false)

0 commit comments

Comments
 (0)