One way is to access them using sql as shown below.
df.registerTempTable("tab1") val df2 = sqlContext.sql("select tk[0], tk[1] from tab1") df2.show()
To get the size of an array column,
val df3 = sqlContext.sql("select size(tk) from tab1") df3.show()
If the version of Spark is older, you can use the HiveContext instead of the Spark SQL Context.
I would also try something that goes by.
Srini source share