I have Array[org.apache.spark.sql.Row]
returned by sqc.sql(sqlcmd).collect()
:
Array([10479,6,10], [8975,149,640], ...)
I can get the individual values:
scala> pixels(0)(0)
res34: Any = 10479
but they are Any
, not Int
.
How do I extract them as Int
?
The most obvious solution did not work:
scala> pixels(0).getInt(0)
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Int
PS. I can do pixels(0)(0).toString.toInt
or pixels(0).getString(0).toInt
, but they feel wrong...