[SPARK-983] Support external sorting

This satisfies SPARK-983 Support external sorting for RDD#sortByKey()
It also adds a general sortPartitions() method to RDD.
It seems that all `DiskBuffer`s share the same values for these variables. It might make sense to declare them once in the parent class rather than for each `DiskBuffer`