I am working on a project with Apache spark. I was pretty much aware of transformations and actions in spark, however all in a sudden I am confused with sortByKey() function in spark.
How does that work, does it considers all partitions(i.e all RDDs) for sorting or data is sorted within a single RDD?.
My requirement is to get data sorted globally just like we sort in any programming language(Collections.sort() in java).
Consider the below code:(xyz is rdd after some series of operations)
JavaPairRDD<Float,Object>sorted = xyz.transformToPair(rdd->rdd.sortByKey());
Does the above statement gives result which is globally sorted?
If no, then how to get data sorted globally i.e considering all the data among all the partitions?
Thanks in advance.