Hi I'm very new to spark as well. So if someone with more experience wants to override my answer, please do.
But from what I've figured it has to be done at the Driver side. i.e. the sorting will happen after you've collected the RRD in to the driver process.
for e.g.
RRD.collect.toSeq.sortBy(_._2)
this worked for me, for key/value tuple.
The thing to remember is that this is driver side, so not distributed, so your RRD that is going to be collected needs to be fairly small, which should be the case for most MR jobs anyways.
best regards
Bhaskar