How to flatten list inside RDD?

后端 未结 3 1597
你的背包
你的背包 2020-12-30 05:07

Is it possible to flatten list inside RDD? For example convert:

 val xxx: org.apache.spark.rdd.RDD[List[Foo]]

to:

 val yyy:         


        
3条回答
  •  醉梦人生
    2020-12-30 05:26

    You just need to flatten it, but as there's no explicit 'flatten' method on RDD, you can do this:

    rdd.flatMap(identity)
    

提交回复
热议问题