Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Threaded View
Hive >> mail # user >> hive genericudf : possible to output column headers ?


Copy link to this message
-
hive genericudf : possible to output column headers ?
Hi,

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.foo, map.bar, 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.

Thanks,
Viral

 
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB