[SPARK-2598] RangePartitioner's binary search does not use the given Ordering

We should fix this in branch-1.0 as well.

Shouldn't we also add a test where we do sortByKey and then collect and make sure stuff is in order?