title: size of array with conditional argument in hive
body: <p>I have a dataset that has a column with an array of timestamps and a column with just one timestamp. I'm looking to get the size of the array using the c1 timestamp as a condition for larger and smaller.</p>
  
  <p>Table (my_table):</p>
  
  <pre><code>c1 |           c2           |
  ----------------------------|
  4  | [1,2,3,4,5,6,7,8,9,10] |
  1  | [1,2,3,4,5,6,7,8,9,10] |
  5  | [1,2,3,4,5,6,7,8,9,10] |
  3  | [1,2,3,4,5,6,7,8,9,10] |
  </code></pre>
  
  <p>Query:</p>
  
  <pre><code>select
  c1,
  c2,
  size(some_udf_split_on_c1(sort_array(&lt;array&gt;), c1)[1]) AS smaller_than_c1
  size(some_udf_split_on_c1(sort_array(&lt;array&gt;), c1)[2]) AS larger_than_c1
  
  from my_table
  </code></pre>
  
  <p>The udf's there are my hypothesized implementation.</p>
  
  <p>Output:</p>
  
  <pre><code>c1 |           c2           | smaller_than_c1 | larger_than_c1
  ----------------------------|-----------------|---------------
  4  | [1,2,3,4,5,6,7,8,9,10] |        3        |      6
  1  | [1,2,3,4,5,6,7,8,9,10] |        0        |      9
  5  | [1,2,3,4,5,6,7,8,9,10] |        4        |      5
  3  | [1,2,3,4,5,6,7,8,9,10] |        1        |      8       
  </code></pre>