title: hive or spark sql delimited list of value:count?
body: <p>There is a sql function called <code>collect_set()</code> which takes a column as an argument and returns a set of objects with duplicate elements eliminated.</p>
  
  <p>I would like to know if there is a way to get both the set of objects with the count of those objects?</p>
  
  <pre><code>example
  columnA 
  A
  A
  B
  C
  
  collect_set(columnA) =&gt; [A:2, B:1, C:1]
  </code></pre>
  
  <p>If there is a straightforward way, please let me know.  So far, I have not found any.  The alternative is to do a group by that column to have unique set of column values and the respective count on separate rows vs as a delimited list in one row/column.</p>
  
  <p>Thanks!</p>