Please also take a look at ZippedWithIndexRDDPartition which is 72 lines long.
You can create your own version which extends RDD[(Long, T)] Cheers On Sun, Apr 12, 2015 at 1:29 PM, Ted Yu <yuzhih...@gmail.com> wrote: > bq. will return something like JavaPairRDD<Object, long> > > The long component of the pair fits your description of index. What other > requirement does ZipWithIndex not provide you ? > > Cheers > > On Sun, Apr 12, 2015 at 1:16 PM, Jeetendra Gangele <gangele...@gmail.com> > wrote: > >> Hi All I have an RDD JavaRDD<Object> and I want to convert it to >> JavaPairRDD<Index,Object>.. Index should be unique and it should maintain >> the order. For first object It should have 1 and then for second 2 like >> that. >> >> I tried using ZipWithIndex but it will return something like >> JavaPairRDD<Object, long> >> I wanted to use this RDD for lookup and join operation later in my >> workflow so ordering is important. >> >> >> Regards >> jeet >> > >