Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
Pig, mail # user - UDF that takes bag as input and returns another bag


+
pranjal rajput 2013-03-18, 09:26
Copy link to this message
-
Re: UDF that takes bag as input and returns another bag
Jonathan Coveney 2013-03-18, 10:19
Absolutely.

public class MyUdf extends EvalFunc<DataBag> {
  public DataBag exec(Tuple input) throws IOException {
    return (DataBag)input.get(0);
  }
}
A dummy example, but there you go. DataBag is a valid pig type like any
other, so you just returnit like you would normally.
2013/3/18 pranjal rajput <[EMAIL PROTECTED]>

> Hi,
> Can we define a UDF in pig that takes a bag as an input and returns another
> bag as output?
> How can this be done?
> Thanks,
> --
> regards
> Pranjal
>
+
Kris Coward 2013-03-18, 14:24
+
Jonathan Coveney 2013-03-18, 15:01
+
Dan DeCapria, CivicScienc... 2013-03-18, 15:57