I have an RDD structure like:
rdd = [[[1],[2],[3]], [[4],[5]], [[6]], [[7],[8],[9],[10]]]
and I want it to become:
rdd = [1,2,3,4,5,6,7,8,9,10]
How do I write a map or reduce function to make it work?
I have an RDD structure like:
rdd = [[[1],[2],[3]], [[4],[5]], [[6]], [[7],[8],[9],[10]]]
and I want it to become:
rdd = [1,2,3,4,5,6,7,8,9,10]
How do I write a map or reduce function to make it work?
You can for example
flatMap
and use list comprehensions:or to make it a little bit more general: