[SPARK-983] Support external sorting

This satisfies SPARK-983 Support external sorting for RDD#sortByKey()
It also adds a general sortPartitions() method to RDD.
formatting nit: style should be

```
class SomeClass[T](
  file: File,
  blockId: BlockId,
  ...) extends Iterator[T]
```