Home Ask Login Register

Developers Planet

Your answer is one click away!

PKM15 February 2016

how to convert Array[org.apache.spark.sql.Row] to Array[Int]

I'm trying to convert Array[Row] to Array[Int] but in vain. Appreciate some help

scala> res17(0).toInt
<console>:30: error: value toInt is not a member of org.apache.spark.sql.Row

scala> res17(0)
res28: org.apache.spark.sql.Row = [1,0]

scala> res17(0).toArray
<console>:30: error: value toArray is not a member of org.apache.spark.sql.Row

scala> res17
res30: Array[org.apache.spark.sql.Row] = Array([1,0])


user5901079 February 2016

Just map with getInt:

val rows: Array[Row] = ???

Post Status

Asked in February 2016
Viewed 2,453 times
Voted 8
Answered 1 times


Leave an answer

Quote of the day: live life