Github user mateiz commented on a diff in the pull request:

    https://github.com/apache/spark/pull/156#discussion_r10859630
  
    --- Diff: core/src/main/scala/org/apache/spark/rdd/RDD.scala ---
    @@ -664,6 +664,24 @@ abstract class RDD[T: ClassTag](
       }
     
       /**
    +   * Return a Stream that contains all of the elements in this RDD.
    +   *
    +   * In case of iterating it consumes memory as the biggest partition in 
cluster.
    +   */
    +  def toLocallyIterable: Stream[T] = {
    +    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
    --- End diff --
    
    Is this lazy or eager? It's a bit unclear. I'd rather have a subclass of 
Iterator that deals with the partitions separately.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to