Skip to content

Commit

Permalink
Add comment explaining collectPartitions's use
Browse files Browse the repository at this point in the history
  • Loading branch information
shivaram committed Dec 19, 2013
1 parent d3234f9 commit 9cc3a6d
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,8 @@ trait JavaRDDLike[T, This <: JavaRDDLike[T, This]] extends Serializable {
* Return an array that contains all of the elements in a specific partition of this RDD.
*/
def collectPartitions(partitionIds: Array[Int]): Array[JList[T]] = {
// This is useful for implementing `take` from other language frontends
// like Python where the data is serialized.
import scala.collection.JavaConversions._
val res = context.runJob(rdd, (it: Iterator[T]) => it.toArray, partitionIds, true)
res.map(x => new java.util.ArrayList(x.toSeq)).toArray
Expand Down

0 comments on commit 9cc3a6d

Please sign in to comment.