title: bigquery standard sql udf mapping to struct is returning internal error
body: <p>I have a code block below for parsing query params using udf. It works fine when the value passed to function is hardcoded as in the example. Thought when I try to parse the same value fetched from a table I get a 
  An internal error occurred and the request could not be completed. (error code: internalError) </p>
  
  <pre><code>CREATE TEMPORARY FUNCTION parse(queryString STRING) RETURNS ARRAY&lt;STRUCT&lt;key STRING, value STRING&gt;&gt; LANGUAGE js AS
  """
      var params = {}
      var array = []
      // split into key/value pairs
      var queries = queryString.split('&amp;');
      var ind = 0
      // convert the array of strings into an object
      for (var i = 0; i &lt; queries.length; i++ ) {
          var temp = queries[i].split('=');
          if(temp.length &lt; 2) continue;
          array[ind++] = { key: temp[0], value: decodeURI(temp[1]) }
      }
      return array;
  """;
  select parse('ca_chid=2002810&amp;ca_source=gaw&amp;ca_ace=&amp;ca_nw=g&amp;ca_dev=c&amp;ca_pl=&amp;ca_pos=1t3&amp;ca_agid=32438864366&amp;ca_caid=260997846&amp;ca_adid=151983037851&amp;ca_kwt=florists%20in%20walsall&amp;ca_mt=e&amp;ca_fid=&amp;ca_tid=aud-117534990726:kwd-420175760&amp;ca_lp=9045676&amp;ca_li=&amp;ca_devm=&amp;ca_plt=&amp;ca_sadt=&amp;ca_smid=&amp;ca_spc=&amp;ca_spid=&amp;ca_sco=&amp;ca_sla=&amp;ca_sptid=&amp;ca_ssc=&amp;gclid=CLaDoa6ZrdACFcyRGwodG8IFvQ') as params
  
  --not working
  --select parse(page_urlquery) from (
  --SELECT page_urlquery  FROM `query_param_snapshot` where page_urlquery != '' LIMIT 1
  </code></pre>