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

    https://github.com/apache/spark/pull/776#discussion_r12704287
  
    --- Diff: 
core/src/main/scala/org/apache/spark/rdd/ParallelCollectionRDD.scala ---
    @@ -128,18 +137,17 @@ private object ParallelCollectionRDD {
               r.start, r.end + sign, r.step).asInstanceOf[Seq[T]], numSlices)
           }
           case r: Range => {
    -        (0 until numSlices).map(i => {
    -          val start = ((i * r.length.toLong) / numSlices).toInt
    -          val end = (((i + 1) * r.length.toLong) / numSlices).toInt
    -          new Range(r.start + start * r.step, r.start + end * r.step, 
r.step)
    +        positions(r.length, numSlices).map({
    +          case (start, end) =>
    +            new Range(r.start + start * r.step, r.start + end * r.step, 
r.step)
             }).asInstanceOf[Seq[Seq[T]]]
           }
           case nr: NumericRange[_] => {
             // For ranges of Long, Double, BigInteger, etc
             val slices = new ArrayBuffer[Seq[T]](numSlices)
    -        val sliceSize = (nr.size + numSlices - 1) / numSlices // Round up 
to catch everything
             var r = nr
    -        for (i <- 0 until numSlices) {
    +        for ((start, end) <- positions(nr.length, numSlices)) {
    +          val sliceSize = end - start
               slices += r.take(sliceSize).asInstanceOf[Seq[T]]
    --- End diff --
    
    Looks like a bug to me. I couldn't google any pointer on it. You might want 
to post it on Scala forum?


---
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