Skip to content

Commit

Permalink
Make to local iterator shorter
Browse files Browse the repository at this point in the history
  • Loading branch information
epahomov committed Apr 5, 2014
1 parent 34aa300 commit 8ec8f24
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions core/src/main/scala/org/apache/spark/rdd/RDD.scala
Original file line number Diff line number Diff line change
Expand Up @@ -672,13 +672,7 @@ abstract class RDD[T: ClassTag](
def collectPartition(p: Int): Array[T] = {
sc.runJob(this, (iter: Iterator[T]) => iter.toArray, Seq(p), allowLocal = false).head
}
var buffer = Stream.empty[T]
for (p <- 0 until this.partitions.length) {
buffer = buffer append {
collectPartition(p).toStream
}
}
buffer.iterator
(0 until partitions.length).iterator.flatMap(i => collectPartition(i))
}

/**
Expand Down

0 comments on commit 8ec8f24

Please sign in to comment.