title: Return ArrayList<String> in HIVE UDF
body: <p>I've created a UDF function which takes two text arguments and return 
      ArrayList.
  But when I call the UDF function in Hive, it gives me an error.</p>
  
  <p>Here is a snippet of my UDF code:</p>
  
  <pre><code>public class MyTestUDF extends UDF {
      public ArrayList&lt;String&gt; evaluate(Text i, Text s) {
  
          if(s == null) return null;
  
          String id = i.toString();
          String value = s.toString();
  
          &lt;parse string value to v1, v2, and v3, and apply logic&gt;
  
          ArrayList&lt;String&gt; result = new ArrayList&lt;String&gt;();
          result.add(id);
          result.add(v1);
          result.add(v2);
          result.add(v3);
  
          return result;
      }       
  }
  </code></pre>
  
  <p>And here is how I ran in Hive:</p>
  
  <pre><code>hive&gt; SELECT multi[0] AS id,
               multi[1] AS value1, 
               multi[2] AS value2,
               multi[3] AS value3
        FROM (SELECT my_udf_function(id, data) AS multi FROM testDB) bar;
  
  FAILED: SemanticException [Error 10033]: Line 1:7 [] not valid on 
          non-collection types '0': struct&lt;elementdata:struct&lt;&gt;,size:int&gt;
  </code></pre>
  
  <p>The data is a giant string value that I parse and apply logic and return three values as a format of ArrayList. </p>
  
  <p>I referred this link <a href="http://paxcel.net/blog/returning-using-multiple-values-from-a-hive-udf/" rel="nofollow noreferrer">Returning &amp; Using Multiple Values from a HIVE UDF</a> but it doesn't work for me.</p>
  
  <p>Can anyone please help?</p>
  
  <p>Thanks!</p>