title: compute string length in Spark SQL DSL
body: <p>Edit: this is an old question concerning Spark 1.2</p>
  
  <p>I've been trying to compute on the fly the length of a string column in a SchemaRDD for orderBy purposes. I am learning Spark SQL so my question is strictly about using the DSL or the SQL interface that Spark SQL exposes, or to know their limitations.</p>
  
  <p>My first attempt has been to use the integrated relational queries, for instance</p>
  
  <pre><code>notes.select('note).orderBy(length('note))
  </code></pre>
  
  <p>with no luck at the compilation:</p>
  
  <pre><code>error: not found: value length
  </code></pre>
  
  <p>(Which makes me wonder where to find what "Expression" this DSL can actually resolve. For instance, it resolves "+" for column additions.)</p>
  
  <p>Then I tried</p>
  
  <pre><code>sql("SELECT note, length(note) as len FROM notes")
  </code></pre>
  
  <p>This fails with</p>
  
  <pre><code>java.util.NoSuchElementException: key not found: length
  </code></pre>
  
  <p>(Then I reread this (I'm running 1.2.0)
  <a href="http://spark.apache.org/docs/1.2.0/sql-programming-guide.html#supported-hive-features" rel="noreferrer">http://spark.apache.org/docs/1.2.0/sql-programming-guide.html#supported-hive-features</a>
  and wonder in what sense Spark SQL supports the listed hive features.)</p>
  
  <p>Questions: is the length operator really supported in Expressions and/or in SQL statements? If yes, what is the syntax? (bonus: is there a specific documentation about what is resolved in Spark SQL Expressions, and what would be the syntax in general?)</p>
  
  <p>Thanks!</p>