You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Shayne Grant <Sh...@sas.com> on 2015/06/26 20:31:13 UTC

UDTF returning dynamic number of output columns

I am trying to create a HIVE UDTF like the following:



select MyUDFT(parm1, parm2) from MyTable;



I would like to use the value of parm1 to determine how many columns of out= put the UDTF should have.  The way I understand UDTFs, the initialize() met= hod has to define all the output columns before the process() method is inv= oked, however the initialize() method is not given the value of the paramet= ers.  I have many possible values for parm1 and each value will dictate how=  many output columns are needed.  It's not possible for me to code all poss= ibilities for parm1 within my UDTF.  Can someone confirm that I can only se= t the output columns in the initialize() method and whether there is any wa= y for me to achieve having a dynamic number of output columns using the val= ue of a parameter to the UDTF?





Shayne