aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiangrui Meng <meng@databricks.com>2014-02-12 10:47:52 -0800
committerReynold Xin <rxin@apache.org>2014-02-12 10:47:52 -0800
commit2bea0709f9a1597f3c0dcc68d7c0536f465b3640 (patch)
treeae54aa2fa96706a12eda8740f4db8ae255ce82a3
parente733d655df6bf569d3d16fdd65c11ef3d2b9de16 (diff)
downloadspark-2bea0709f9a1597f3c0dcc68d7c0536f465b3640.tar.gz
spark-2bea0709f9a1597f3c0dcc68d7c0536f465b3640.tar.bz2
spark-2bea0709f9a1597f3c0dcc68d7c0536f465b3640.zip
Merge pull request #589 from mengxr/index.
SPARK-1076: Convert Int to Long to avoid overflow Patch for PR #578. Author: Xiangrui Meng <meng@databricks.com> Closes #589 and squashes the following commits: 98c435e [Xiangrui Meng] cast Int to Long to avoid Int overflow
-rw-r--r--core/src/main/scala/org/apache/spark/rdd/RDD.scala2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/src/main/scala/org/apache/spark/rdd/RDD.scala b/core/src/main/scala/org/apache/spark/rdd/RDD.scala
index ec8e311aff..d4fc28f551 100644
--- a/core/src/main/scala/org/apache/spark/rdd/RDD.scala
+++ b/core/src/main/scala/org/apache/spark/rdd/RDD.scala
@@ -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)