title: How do I convert a WrappedArray column in spark dataframe to Strings?
body: <p>I am trying to convert a column which contains Array[String] to String, but I consistently get this error   </p>
  
  <pre><code>org.apache.spark.SparkException: Job aborted due to stage failure: Task 0 in stage 78.0 failed 4 times, most recent failure: Lost task 0.3 in stage 78.0 (TID 1691, ip-******): java.lang.ClassCastException: scala.collection.mutable.WrappedArray$ofRef cannot be cast to [Ljava.lang.String; 
  </code></pre>
  
  <p>Here's the piece of code  </p>
  
  <pre><code>val mkString = udf((arrayCol:Array[String])=&gt;arrayCol.mkString(","))  
  val dfWithString=df.select($"arrayCol").withColumn("arrayString",
        mkString($"arrayCol"))  
  </code></pre>