hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kumar V <kumarbuyonl...@yahoo.com>
Subject Re: Returning variable number of fields from Hive UDTF
Date Wed, 29 Jan 2014 15:49:05 GMT
Thanks a Lot Edward.  constantobjectinspector solved my problem.  It works now.

Regards,
Murali.



On Wednesday, January 29, 2014 10:29 AM, Edward Capriolo <edlinuxguru@gmail.com> wrote:
 
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 <kumarbuyonline@yahoo.com> 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.
Mime
View raw message