title: How to use ordinals using Dataset API (like SQL's 'GROUP BY 1' or 'ORDER BY 2')?
body: <p>I am able to use ordinals (these integers after <code>GROUP BY</code> and <code>ORDER BY</code>) in the Spark SQL 'literal' query:</p>
  
  <pre class="lang-scala prettyprint-override"><code>sqlContext.sql("SELECT ProfileName, COUNT(1) FROM df GROUP BY 1 ORDER BY 2 DESC")
  </code></pre>
  
  <p>But with DataFrames/DataSets I have to always use the column names:</p>
  
  <pre class="lang-scala prettyprint-override"><code>df.select($"ProfileName").groupBy($"ProfileName").count().orderBy(desc("count"))
  </code></pre>
  
  <p>I didn't find a way to use ordinals in DataFrames.</p>
  
  <p>What I am looking for is something like:</p>
  
  <pre class="lang-scala prettyprint-override"><code>df.select($"ProfileName").groupBy(1).count().orderBy(desc(2)) // WON'T COMPILE
  </code></pre>
  
  <p>Is there anything like that in Spark SQL I can use?</p>