There exist some similar questions like this and this but they couldn't provide me sufficient help. Following is a piece of my code.
val output = abc.collect()
output.foreach(tup => println(tup._1 + " " + math.ceil(tup._2 * 1000)/1000))
Following is a piece of the output.
5 0.835
1 0.901
110 0.797
7 0.821
11 0.899
0 0.871
32 0.313
78 0.273
35698 0.333
119 0.273
I want to have the output in sorted form. I tried takeOrdered(n)
but the output it gives is not what I need. It is sorted but perhaps as string, not numbers. It is something like
0 0.871
1 0.901
10 1.072
11 0.899
110 0.797
111 0.288
12 0.288
123 0.273
14 0.554
153 0.228
Any Help please?