I am new to sparks and scala. I need to order my set of result counters, which is similar to (course, score) in descending order. I put below
val results = ratings.countByValue()
val sortedResults = results.toSeq.sortBy(_._2)
But still it does not work. Thus, he sorts the results on an account with increasing order. But I need to have it in descending order. Can someone please help me.
Results will be similar below.
(History, 12100),
(Music, 13200),
(Drama, 143000)
But I need to display it as below
(Drama, 143000),
(Music, 13200),
(History, 12100)
thank
source
share