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

    https://github.com/apache/spark/pull/423#discussion_r12080026
  
    --- Diff: core/src/main/scala/org/apache/spark/api/java/JavaRDDLike.scala 
---
    @@ -263,6 +263,26 @@ trait JavaRDDLike[T, This <: JavaRDDLike[T, This]] 
extends Serializable {
           rdd.zipPartitions(other.rdd)(fn)(other.classTag, 
fakeClassTag[V]))(fakeClassTag[V])
       }
     
    +  /**
    +   * Zips this RDD with generated unique Long ids. Items in the kth 
partition will get ids k, n+k,
    +   * 2*n+k, ..., where n is the number of partitions. So there may exist 
gaps, but this method
    +   * won't trigger a spark job, which is different from 
[[org.apache.spark.rdd.RDD#zipWithIndex]].
    +   */
    +  def zipWithUniqueId[Long](): JavaPairRDD[T, Long] = {
    +    JavaPairRDD.fromRDD(rdd.zipWithUniqueId()).asInstanceOf[JavaPairRDD[T, 
Long]]
    +  }
    +
    +  /**
    +   * Zips this RDD with its element indices. The ordering is first based 
on the partition index
    +   * and then the ordering of items within each partition. So the first 
item in the first
    +   * partition gets index 0, and the last item in the last partition 
receives the largest index.
    +   * This is similar to Scala's zipWithIndex but it uses Long instead of 
Int as the index type.
    +   * This method needs to trigger a spark job when this RDD contains more 
than one partitions.
    +   */
    +  def zipWithIndex[Long](): JavaPairRDD[T, Long] = {
    --- End diff --
    
    Ditto.


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