@@ -117,10 +117,10 @@ private object ParallelCollectionRDD {
117117 if (numSlices < 1 ) {
118118 throw new IllegalArgumentException (" Positive number of slices required" )
119119 }
120- // Sequences need to be sliced at same positions for operations
120+ // Sequences need to be sliced at the same set of index positions for operations
121121 // like RDD.zip() to behave as expected
122- def positions (length : Long , numSlices : Int ) = {
123- (0 until numSlices).map(i => {
122+ def positions (length : Long , numSlices : Int ): Iterator [( Int , Int )] = {
123+ (0 until numSlices).iterator. map(i => {
124124 val start = ((i * length) / numSlices).toInt
125125 val end = (((i + 1 ) * length) / numSlices).toInt
126126 (start, end)
@@ -140,7 +140,7 @@ private object ParallelCollectionRDD {
140140 positions(r.length, numSlices).map({
141141 case (start, end) =>
142142 new Range (r.start + start * r.step, r.start + end * r.step, r.step)
143- }).asInstanceOf [Seq [Seq [T ]]]
143+ }).toSeq. asInstanceOf [Seq [Seq [T ]]]
144144 }
145145 case nr : NumericRange [_] => {
146146 // For ranges of Long, Double, BigInteger, etc
@@ -158,7 +158,7 @@ private object ParallelCollectionRDD {
158158 positions(array.length, numSlices).map({
159159 case (start, end) =>
160160 array.slice(start, end).toSeq
161- })
161+ }).toSeq
162162 }
163163 }
164164 }
0 commit comments