title: Spark convert single column into array
body: <p>How can I convert a single column in spark 2.0.1 into an array?</p>
  
  <pre><code>+---+-----+
  | id| dist| 
  +---+-----+
  |1.0|2.0|
  |2.0|4.0|
  |3.0|6.0|
  |4.0|8.0|
  +---+-----+
  </code></pre>
  
  <p>should return <code>Array(1.0, 2.0, 3.0, 4.0)</code></p>
  
  <p>A</p>
  
  <pre><code>import scala.collection.JavaConverters._ 
  df.select("id").collectAsList.asScala.toArray
  </code></pre>
  
  <p>fails with</p>
  
  <pre><code>java.lang.RuntimeException: Unsupported array type: [Lorg.apache.spark.sql.Row;
  java.lang.RuntimeException: Unsupported array type: [Lorg.apache.spark.sql.Row;
  </code></pre>