Take

The action take returns a list on n elements where n is the argument to be passed to the method take():

//take()
JavaRDD<Integer> intRDD = sparkContext.parallelize(Arrays.asList(1,2,3));
List<Integer> takeTwo=intRDD.take(2);
for(Integer intVal:takeTwo){
System.out.println("The take elements are :: "+intVal);
}

As it can be observed now that the method take() with an argument as 1 will return the same value as the method first(). In other words, output of take(1) is same as running first action.

..................Content has been hidden....................

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