title: How to sort an RDD in Scala Spark?
body: <p>Reading Spark method sortByKey : </p>
  
  <pre><code>sortByKey([ascending], [numTasks])   When called on a dataset of (K, V) pairs where K implements Ordered, returns a dataset of (K, V) pairs sorted by keys in ascending or descending order, as specified in the boolean ascending argument.
  </code></pre>
  
  <p>Is it possible to return just "N" amount of results. So instead of returning all results, just return the top 10. I could convert the sorted collection to an Array and use <code>take</code> method but since this is an O(N) operation is there a more efficient method ?</p>