aboutsummaryrefslogtreecommitdiff
path: root/core/src/main
diff options
context:
space:
mode:
authorHolden Karau <holden@pigscanfly.ca>2013-09-11 22:35:58 -0700
committerHolden Karau <holden@pigscanfly.ca>2013-09-11 22:35:58 -0700
commit74f710f6cda31c1489e8f0cc130021ce4e9e60c6 (patch)
tree0195f43b9d52a21b4e218deaa12bfbad67b07507 /core/src/main
parenta310de69e05c30fc86a7ea4bab503b7fe59cada9 (diff)
downloadspark-74f710f6cda31c1489e8f0cc130021ce4e9e60c6.tar.gz
spark-74f710f6cda31c1489e8f0cc130021ce4e9e60c6.tar.bz2
spark-74f710f6cda31c1489e8f0cc130021ce4e9e60c6.zip
Start of working on SPARK-615
Diffstat (limited to 'core/src/main')
-rw-r--r--core/src/main/scala/org/apache/spark/api/java/JavaRDDLike.scala8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/src/main/scala/org/apache/spark/api/java/JavaRDDLike.scala b/core/src/main/scala/org/apache/spark/api/java/JavaRDDLike.scala
index 7e6e691f11..9ad175ec19 100644
--- a/core/src/main/scala/org/apache/spark/api/java/JavaRDDLike.scala
+++ b/core/src/main/scala/org/apache/spark/api/java/JavaRDDLike.scala
@@ -68,6 +68,14 @@ trait JavaRDDLike[T, This <: JavaRDDLike[T, This]] extends Serializable {
new JavaRDD(rdd.map(f)(f.returnType()))(f.returnType())
/**
+ * Return a new RDD by applying a function to each partition of this RDD, while tracking the index
+ * of the original partition.
+ */
+ def mapPartitionsWithIndex(f: JFunction2[Int, T, R],
+ preservesPartitioning: Boolean = false): JavaRDD[R] =
+ new JavaRDD(MapPartitionsWithIndexRDD(this, sc.clean(f), preservesPartitioning))
+
+ /**
* Return a new RDD by applying a function to all elements of this RDD.
*/
def map[R](f: DoubleFunction[T]): JavaDoubleRDD =