Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Group elements by key, convert the iterable to list, then sort them in descending order, take the first 200 element
- //Sort the result RDD by key
- val sortedRdd = calcChiSquares.groupByKey().map{case(k,v) => (k ,
- v.toList.sortWith(_.split(":")(1).toDouble > _.split(":")(1).toDouble)
- .take(200).mkString(" "))}.sortByKey()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement