collect

Collect retrieves the data from different partitions of RDD into an array at the driver program. Care should be taken to call the collect action only on RDDs having considerably small data as otherwise it can crash the driver program.

Usually, after applying a set of transformations when the data size condenses, a collect action is called. The simplest example to call collect() can be filtering a specific value as follows:

//Collect
List<Integer> collectedList= intRDD.collect();
for(Integer elements: collectedList){
System.out.println( "The collected elements are ::"+elements);
}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.168.214