title: Hive collect_set() but to Remove Consecutive Duplicates
body: <p>I want to remove consecutive duplicates in an array when using hive. </p>
  
  <p><code>collect_list()</code> keeps all duplicates, while <code>collect_set()</code> only keeps distinct entries. I kind of need something in the middle ground.</p>
  
  <p>For example, from the below table:</p>
  
  <pre><code>id  |  number
  ==============
  fk        4
  fk        4
  fk        2
  4f        1
  4f        8
  4f        8
  h9        7
  h9        4
  h9        7
  </code></pre>
  
  <p>I would like to get something like this:</p>
  
  <pre><code>id | aggregate
  ===========================
  fk   Array&lt;int&gt;(4,2)
  4f   Array&lt;int&gt;(1,8)
  h9   Array&lt;int&gt;(7,4,7)
  </code></pre>