Thanks, Paolo and Mark. :)

> On 04 Dec 2014, at 11:58, Paolo Platter <paolo.plat...@agilelab.it> wrote:
> 
> Hi,
> 
> rdd.flatMap( e => e._2.map( i => ( i, e._1)))
> 
> Should work, but I didn't test it so maybe I'm missing something.
> 
> Paolo
> 
> Inviata dal mio Windows Phone
> Da: Yifan LI <mailto:iamyifa...@gmail.com>
> Inviato: ‎04/‎12/‎2014 09:27
> A: user@spark.apache.org <mailto:user@spark.apache.org>
> Oggetto: map function 
> 
> Hi,
> 
> I have a RDD like below:
> (1, (10, 20))
> (2, (30, 40, 10))
> (3, (30))
> …
> 
> Is there any way to map it to this:
> (10,1)
> (20,1)
> (30,2)
> (40,2)
> (10,2)
> (30,3)
> …
> 
> generally, for each element, it might be mapped to multiple.
> 
> Thanks in advance! 
> 
> 
> Best,
> Yifan LI
> 
> 
> 
> 
> 

Reply via email to