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
Pig >> mail # user >> Eval UDF passing parameters


Copy link to this message
-
Eval UDF passing parameters
Hi,

This might be a dumb question. Is it possible to pass anything other than
the input tuple to a UDF Eval function?

Basically in my UDF, I need to do some user info lookup. So the input will
be:

(userid,f1,f2)

with this UDF, I want to convert it to something like

(userid,age,gender,location,f1,f2)

where in the UDF I do a DB lookup on the userid and returns user's info
(age, gender, etc). But I don't necessarily want to pass back the same user
info fields, e.g. sometimes I only want age.

I hope there is a way for me to tell the UDF that I only want "age", and
sometimes "age, location", etc.

What's the best way to achieve this without having to write a separate UDF
for every case?

Thanks.
Dexin
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