diff options
author | Matei Zaharia <matei@eecs.berkeley.edu> | 2012-10-12 14:46:41 -0700 |
---|---|---|
committer | Matei Zaharia <matei@eecs.berkeley.edu> | 2012-10-12 14:46:41 -0700 |
commit | dca496bb77e9391c40cfdbc61ae2512d19e7b766 (patch) | |
tree | 7ca42db86f309e854cf943867abc878be3371ec2 /core | |
parent | 1183b309419bb3efb17ef77cf491597fb0849706 (diff) | |
download | spark-dca496bb77e9391c40cfdbc61ae2512d19e7b766.tar.gz spark-dca496bb77e9391c40cfdbc61ae2512d19e7b766.tar.bz2 spark-dca496bb77e9391c40cfdbc61ae2512d19e7b766.zip |
Document cartesian() operation
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/scala/spark/RDD.scala | 4 | ||||
-rw-r--r-- | core/src/main/scala/spark/api/java/JavaRDDLike.scala | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/core/src/main/scala/spark/RDD.scala b/core/src/main/scala/spark/RDD.scala index c9334f68a8..fdda8f29a6 100644 --- a/core/src/main/scala/spark/RDD.scala +++ b/core/src/main/scala/spark/RDD.scala @@ -243,6 +243,10 @@ abstract class RDD[T: ClassManifest](@transient sc: SparkContext) extends Serial */ def glom(): RDD[Array[T]] = new GlommedRDD(this) + /** + * Return the Cartesian product of this RDD and another one, that is, the RDD of all pairs of + * elements (a, b) where a is in `this` and b is in `other`. + */ def cartesian[U: ClassManifest](other: RDD[U]): RDD[(T, U)] = new CartesianRDD(sc, this, other) /** diff --git a/core/src/main/scala/spark/api/java/JavaRDDLike.scala b/core/src/main/scala/spark/api/java/JavaRDDLike.scala index 43d0ca0e2f..13fcee1004 100644 --- a/core/src/main/scala/spark/api/java/JavaRDDLike.scala +++ b/core/src/main/scala/spark/api/java/JavaRDDLike.scala @@ -123,6 +123,10 @@ trait JavaRDDLike[T, This <: JavaRDDLike[T, This]] extends Serializable { def glom(): JavaRDD[JList[T]] = new JavaRDD(rdd.glom().map(x => new java.util.ArrayList[T](x.toSeq))) + /** + * Return the Cartesian product of this RDD and another one, that is, the RDD of all pairs of + * elements (a, b) where a is in `this` and b is in `other`. + */ def cartesian[U](other: JavaRDDLike[U, _]): JavaPairRDD[T, U] = JavaPairRDD.fromRDD(rdd.cartesian(other.rdd)(other.classManifest))(classManifest, other.classManifest) |