Sort the RDD by key, so that each partition contains a sorted range of the elements.
Sort the RDD by key, so that each partition contains a sorted range of the elements. Calling
collect
or save
on the resulting RDD will return or output an ordered list of records
(in the save
case, they will be written to multiple part-X
files in the filesystem, in
order of the keys).
Extra functions available on RDDs of (key, value) pairs where the key is sortable through an implicit conversion. Import
org.apache.spark.SparkContext._
at the top of your program to use these functions. They will work with any key typeK
that has an implicitOrdering[K]
in scope. Ordering objects already exist for all of the standard primitive types. Users can also define their own orderings for custom types, or to override the default ordering. The implicit ordering that is in the closest scope will be used.