How to convert List to JavaRDD

前端 未结 4 779
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-11 15:54

We know that in spark there is a method rdd.collect which converts RDD to a list.

List f= rdd.collect();
String[] array = f.toArray(new String[f.si         


        
4条回答
  •  我在风中等你
    2021-02-11 16:38

    There are two ways to convert a collection to a RDD.

    1) sc.Parallelize(collection)
    2) sc.makeRDD(collection)
    

    Both of the method are identical, so we can use any of them

提交回复
热议问题