Convert spark dataframe to Array[String]
This should do the trick:
df.select(columns: _*).collect.map(_.toSeq)
DataFrame to Array[String]
data.collect.map(_.toSeq).flatten
You can also use the following
data.collect.map(row=>row.getString(0))
If you have more columns then it is good to use the last one
data.rdd.map(row=>row.getString(0)).collect