Working with apache spark
using Java
. I got an JavaPairRDD<String,Long>
and I want to sort this dataset by its value. However, it seems that there only is sortByKey
method in it. How could I sort it by the value of Long
type?
dataset.mapToPair(x -> x.swap()).sortByKey(false).mapToPair(x -> x.swap()).take(100)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With