Skip to content

Commit

Permalink
Merge pull request apache#589 from mengxr/index.
Browse files Browse the repository at this point in the history
SPARK-1076: Convert Int to Long to avoid overflow

Patch for PR apache#578.

Author: Xiangrui Meng <[email protected]>

Closes apache#589 and squashes the following commits:

98c435e [Xiangrui Meng] cast Int to Long to avoid Int overflow
  • Loading branch information
mengxr authored and rxin committed Feb 12, 2014
1 parent e733d65 commit 2bea070
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/src/main/scala/org/apache/spark/rdd/RDD.scala
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,7 @@ abstract class RDD[T: ClassTag](
* won't trigger a spark job, which is different from [[org.apache.spark.rdd.RDD#zipWithIndex]].
*/
def zipWithUniqueId(): RDD[(T, Long)] = {
val n = this.partitions.size
val n = this.partitions.size.toLong
this.mapPartitionsWithIndex { case (k, iter) =>
iter.zipWithIndex.map { case (item, i) =>
(item, i * n + k)
Expand Down

0 comments on commit 2bea070

Please sign in to comment.