[SPARK-983] Support external sorting

This satisfies SPARK-983 Support external sorting for RDD#sortByKey()
It also adds a general sortPartitions() method to RDD.
Same here. `ExternalAppendOnlyMap` is supposedly the only user of this map. We should probably rename this if we want to use it for sorting too.