Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Hive, mail # user - Returning variable number of fields from Hive UDTF


Copy link to this message
-
Re: Returning variable number of fields from Hive UDTF
Edward Capriolo 2014-01-29, 15:29
if and only if the number is truely a constant, you can use the constant
Object Inspector in initialize. The value but be a constant at query
compile time.
So this should work:
myudtf(5,xpathsfile);

THhis can not work
myudtf(colx,xpathsfile);
On Wed, Jan 29, 2014 at 10:21 AM, Kumar V <[EMAIL PROTECTED]> wrote:

> Hi all,
>     I have a UDTF that returns fields from an XML/SerDe based table.  So I
> have to return varying number of fields from the UDTF based on the number
> of xpath's in the query file.  I am not sure how to access the values of
> the parameters in the initialize() method of the UDTF.  It only has the
> ObjectInspector array. The UDTF itself works fine if I always return a
> fixed number of fields.
>
> Something like
>
> select * from myudtf(xpathsfile);
>
> Should return as many fields as there are xpaths in the file.  Or I can
> also modify the UDTF to take in a parameter for the number of fields, like
>
> select * from myudtf(5,xpathsfile);
>
> I am kind of against a wall here. Any help is appreciated.
>
> Regards,
> Murali.
>