title: org.apache.spark.sql.Row to Int
body: <p>I'm trying to get an Integer from a SQL statement in spark-sql.</p>
  
  <pre><code>var num_en = ctx.sql("SELECT count(*) FROM table WHERE lang = 'en'")
  num = num_en.collect()(0)
  </code></pre>
  
  <p>num_en is a SchemaRDD, and num, according to the error I get, a "Row".</p>
  
  <pre><code>&lt;console&gt;:144: error: type mismatch;
   found   : org.apache.spark.sql.Row
      (which expands to)  org.apache.spark.sql.catalyst.expressions.Row
  </code></pre>
  
  <p>The problem is that I can't find any useful documentation for either org.apache.spark.sql.Row or org.apache.spark.sql.catalyst.expressions.Row.</p>
  
  <p>How can I extract this one integer value that the SQL statement returns for later use?</p>