title: hive querying records for a specific uniontype
body: <p>I have a sample hive table  created as</p>
  
  <pre><code>CREATE TABLE union_test(foo UNIONTYPE&lt;int, double, array&lt;string&gt;, struct&lt;a:int,b:string&gt;&gt;);
  </code></pre>
  
  <p>The data can be viewed as </p>
  
  <pre><code>SELECT foo FROM union_test;
  </code></pre>
  
  <p>The output is</p>
  
  <pre><code>{0:1}
  {1:2.0}
  {2:["three","four"]}
  {3:{"a":5,"b":"five"}}
  {2:["six","seven"]}
  {3:{"a":8,"b":"eight"}}
  {0:9}
  {1:10.0}
  </code></pre>
  
  <p>the first field (tag) denotes the type of the union ( 0 for int, 1 for double, 2 for array etc).</p>
  
  <p>My problem is if I found to select only those records where the union type is 2 (array), how should I frame my query?</p>