sortByKey

@JvmName(name = "sortByTuple2Key")
fun <T1, T2> Dataset<Tuple2<T1, T2>>.sortByKey(): Dataset<Tuple2<T1, T2>>

Returns a dataset sorted by the first (_1) value of each Tuple2 inside.


@JvmName(name = "sortByPairKey")
fun <T1, T2> Dataset<Pair<T1, T2>>.sortByKey(): Dataset<Pair<T1, T2>>

Returns a dataset sorted by the first (first) value of each Pair inside.


fun <K, V> JavaRDD<Tuple2<K, V>>.sortByKey(ascending: Boolean = true): JavaRDD<Tuple2<K, V>>
fun <K, V> JavaRDD<Tuple2<K, V>>.sortByKey(ascending: Boolean, numPartitions: Int): JavaRDD<Tuple2<K, V>>
fun <K, V> JavaRDD<Tuple2<K, V>>.sortByKey(comp: Comparator<K>, ascending: Boolean = true): JavaRDD<Tuple2<K, V>>
fun <K, V> JavaRDD<Tuple2<K, V>>.sortByKey(comp: Comparator<K>, ascending: Boolean, numPartitions: Int): JavaRDD<Tuple2<K, V>>

Sort the RDD by key, so that each partition contains a sorted range of the elements. Calling JavaRDD.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).


@JvmName(name = "sortByArity2Key")
fun <T1, T2> Dataset<Arity2<T1, T2>>.sortByKey(): Dataset<Arity2<T1, T2>>

Deprecated

Use Scala tuples instead.

Replace with

Returns a dataset sorted by the first (_1) value of each Arity2 inside.