hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Viral Bajaria <>
Subject hive genericudf : possible to output column headers ?
Date Mon, 07 Apr 2014 22:06:34 GMT

I have a use-case where I want a UDF to return dynamic number of columns
based on parameter.

Consider a udf function called return_cols which takes two params, fields
and a comma-separated list of output fields eg. select
return_cols(table-field, "foo,bar") from table or select
return_cols(table-field, "foo,bar,baz") from table.

The first call return 2 columns back while the second call returns 3
columns back. I could technically return a map of things but that would
mean I will have to wrap the query and select,, map.baz. I
had rather output the data with column headers and let the downstream tools
figure out how to consume it.

Is it possible to output columns headers through a hive genericudf ? I
looked around for example but could not find anything.


View raw message