[SPARK-911] allow efficient queries for a range if RDD is partitioned wi...

...th RangePartitioner
Why do you need this cast?