Yes, but a (partitionID, partitionIndex) tuple is a unique identifier
that's just as useful---and you can map that to unique line numbers at any
time.  myRdd.mapPartitionsWithIndex( (id, it) => it.zipWithIndex.map{case
(el, fID) => ( (id, fID), el) } )


On Mon, Dec 30, 2013 at 8:41 AM, Aureliano Buendia <[email protected]>wrote:

> One thing could make this more complicated is partitioning.
>
>
> On Mon, Dec 30, 2013 at 12:28 PM, Aureliano Buendia 
> <[email protected]>wrote:
>
>> Hi,
>>
>> When reading a simple text file in spark, what's the best way of mapping
>> each line to (line number, line)? RDD doesn't seem to have an equivalent of
>> zipWithIndex.
>>
>
>

Reply via email to