title: spark RDD sort by two values
body: <p>I have a <code>RDD</code>of <code>(name:String, popularity:Int, rank:Int)</code>. I want to sort this by <code>rank</code> and if <code>rank</code> matches then by <code>popularity</code>. I am doing so by two transformations. </p>
  
  <pre><code>var result = myRDD
          .sortBy(_._2, ascending = false)
          .sortBy(_._3, ascending = false)
          .take(10)
  </code></pre>
  
  <p>Can I do the it in one transformation?</p>