File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
core/src/main/scala/org/apache/spark/storage Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -329,8 +329,21 @@ private[spark] class BlockManager(
329
329
* never deletes (recent) items.
330
330
*/
331
331
def getLocalFromDisk (blockId : BlockId , serializer : Serializer ): Option [Iterator [Any ]] = {
332
- diskStore.getValues(blockId, serializer).orElse(
333
- sys.error(" Block " + blockId + " not found on disk, though it should be" ))
332
+ class LazyProxyIterator (f : => Iterator [Any ]) extends Iterator [Any ] {
333
+
334
+ lazy val proxy = f
335
+
336
+ def hasNext : Boolean = proxy.hasNext
337
+
338
+ def next (): Any = proxy.next()
339
+ }
340
+
341
+ if (diskStore.contains(blockId)) {
342
+ Some (new LazyProxyIterator (diskStore.getValues(blockId, serializer).get))
343
+ } else {
344
+ sys.error(" Block " + blockId + " not found on disk, though it should be" )
345
+ None
346
+ }
334
347
}
335
348
336
349
/**
You can’t perform that action at this time.
0 commit comments