title: How to sort within partitions (and avoid sort across the partitions) using RDD API?
body: <p>It is Hadoop MapReduce shuffle's default behavior to sort the shuffle key within partition, but not cross partitions(It is the total ordering that makes keys sorted cross the parttions)</p>
  
  <p>I would ask how to achieve the same thing using Spark RDD(sort within Partition,but not sort cross the partitions)</p>
  
  <ol>
  <li>RDD's <code>sortByKey</code> method is doing total ordering</li>
  <li>RDD's <code>repartitionAndSortWithinPartitions</code> is doing sort within partition but not cross partitions, but unfortunately it adds an extra step to do repartition.</li>
  </ol>
  
  <p>Is there a direct way to sort within partition but not cross partitions?</p>