2015 9:06 AM
To: user <user@spark.apache.org>
Subject: FlatMap Explanation
Hi ,
Can some one please explain the output of the flat map
data in RDD as below
{1, 2, 3, 3}
rdd.flatMap(x => x.to<http://x.to>(3))
output as below
{1, 2, 3, 2, 3, 3, 3}
i am not able to understand h
gt;
>
>
> Flat map that concatenates the results, so you get
>
>
>
> 1,2,3, 2,3, 3,3
>
>
>
> You should get the same with any scala collection
>
>
>
> Cheers
>
>
>
> *From:* Ashish Soni [mailto:asoni.le...@gmail.com]
> *Sent:* Thursday, Se
Hi ,
Can some one please explain the output of the flat map
data in RDD as below
{1, 2, 3, 3}
rdd.flatMap(x => x.to(3))
output as below
{1, 2, 3, 2, 3, 3, 3}
i am not able to understand how the output came as above.
Thanks,
Flatmap is just like map but it flattens out the seq output of the
closure...
In your case, you call "to" function that is to return list...
a.to(b) returns list(a,...,b)
So rdd.flatMap( x => x.to(3)) will take all element and return range upto
3..
On Sep 3, 2015 7:36 AM, "Ashish Soni"