I figured out how to do this. The problem is that you need to add the number of fields you want to be returned to the StandardStructObjectInspector that is returned in the initialize() method of the UDTF.
-Thomas From: Ryabin, Thomas Sent: Tuesday, April 24, 2012 12:46 PM To: [email protected] Subject: Possible to return different number of columns than parameters specified in custom UDTF? Hello, I have created a custom UDTF called "test_udtf". This function takes 4 parameters. Right now I can use this function like so in the following query: SELECT test_udtf(product, store, 'test0', 'test1') as (col0, col1, col2, col3) from products join stores; The problem is that I want to return more than 4 columns for every combination of product and store. I have tried the query: SELECT test_udtf(product, store, 'test0', 'test1') as (col0, col1, col2, col3, col4) from products join stores; but I get an error that says I have provided an invalid number of aliases. Is there a way to do this? Thanks, Thomas
