title: Spark extracting values from a Row
body: <p>I have the following dataframe</p>
  
  <pre><code>val transactions_with_counts = sqlContext.sql(
    """SELECT user_id AS user_id, category_id AS category_id,
    COUNT(category_id) FROM transactions GROUP BY user_id, category_id""")
  </code></pre>
  
  <p>I'm trying to convert the rows to Rating objects but since x(0) returns an array this fails</p>
  
  <pre><code>val ratings = transactions_with_counts
    .map(x =&gt; Rating(x(0).toInt, x(1).toInt, x(2).toInt))
  </code></pre>
  
  <blockquote>
    <p>error: value toInt is not a member of Any</p>
  </blockquote>