Spark extraindo valores de uma linha

Eu tenho o seguinte quadro de dados

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""")

Estou tentando converter as linhas em objetos de classificação, mas como x (0) retorna uma matriz, isso falha

val ratings = transactions_with_counts
  .map(x => Rating(x(0).toInt, x(1).toInt, x(2).toInt))

error: value toInt não é membro de Qualquer

questionAnswers(3)

yourAnswerToTheQuestion