mesos/spark — pull request #692 by Reinvigorate (2013-07-10 18:41:47+00:00)
Title: adding takeOrdered() to RDD

We have been liking RDD.top(), but when used with ordering it feels awkward.

For instance- given this list: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10

`top(5).sorted` result: 6, 7, 8, 9, 10

Normally when you take the top values, the values would be sorted descending. So to do this one ends up doing something like:

`top(5)(order).sorted(order.reverse)` result: 10, 9, 8, 7, 6

We were doing this everywhere in our code and decided to create a takeOrdered() so that this is cleaner, more clear, and comes out with order:

`takeOrdered(5)` result: 1, 2, 3, 4, 5
`takeOrdered(5)(descendingOrder)` result: 10, 9, 8, 7, 6