title: get the distinct elements of an ArrayType column in a spark dataframe
body: <p>I have a dataframe with 3 columns named <em>id</em>, <em>feat1</em> and <em>feat2</em>. <em>feat1</em> and <em>feat2</em> are in the form of Array of String:</p>
  
  <pre><code>Id, feat1,feat2
  ------------------
  1, ["feat1_1","feat1_2","feat1_3"],[] 
  
  2, ["feat1_2"],["feat2_1","feat2_2"]
  
  3,["feat1_4"],["feat2_3"]
  </code></pre>
  
  <p>I want to get the list of distinct elements inside each feature column, so the output will be:</p>
  
  <pre><code>distinct_feat1,distinct_feat2
  -----------------------------  
  ["feat1_1","feat1_2","feat1_3","feat1_4"],["feat2_1","feat2_2","feat2_3]
  </code></pre>
  
  <p>what is the best way to do this in Scala?</p>