I need to pass a relation to a UDF in PIG
articles = load x using ...;
groupedArticles = udfs.MyUDF(articles);
Is something like this possible? Any workaround?
thanks
I need to pass a relation to a UDF in PIG
articles = load x using ...;
groupedArticles = udfs.MyUDF(articles);
Is something like this possible? Any workaround?
thanks
I guess you mean to pass all fields of the relation to the UDF? Passing the relation would not make sense. In any case this depends on how your load statement looks like. If you load each entry as a tuple load x using ... as (entry:(a:int, b:chararray, ...))
than you could pass that to the UDF like groupedArticles = foreach articles generate udfs.MyUDF(entry)
Passing the whole line as a tuple is probably the most generic way, you have to deal with a generic tuple in your UDF though.