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 >> UDF that takes bag as input and returns another bag


Copy link to this message
-
Re: UDF that takes bag as input and returns another bag
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
>
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