pig-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zhang jianfeng <zjf...@gmail.com>
Subject Re: Is it possible to access Configuration in UDF ?
Date Tue, 04 Aug 2009 03:03:40 GMT
Dmitriy,

Thank you for your help.

I find this way of using API is not so intuitive ,  I recommend the base
class of UDF to implements the Configurable interface.
Then each UDF can use the getConf() to get the Configuration object.
Because UDF is part of MapReduce , it makes sense to make it Configurable.

The following is what I recommend to change the EvalFunc

public abstract class EvalFunc<T>  implements Configurable{
 ......
 protected Configuration conf;
 ......
 public EvalFunc(){
         conf=PigMapReduce.sJobConf;
 }
 ......
     @Override
    public void setConf(Configuration conf) {
        this.conf=conf;
    }

    @Override
    public Configuration getConf() {
        return this.conf;
    }




Jeff Zhang





On Mon, Aug 3, 2009 at 8:52 PM, Dmitriy Ryaboy <dvryaboy@cloudera.com>wrote:

> You can access the JobConf with the following call:
>
> ConfigurationUtil.toProperties(PigMapReduce.sJobConf)
>
> On Mon, Aug 3, 2009 at 12:40 AM, zhang jianfeng<zjffdu@gmail.com> wrote:
> > Hi all,
> >
> > I'd like to set property in Configuration to customize my UDF. But  it
> looks
> > like I can not access the Configuration object in UDF.
> >
> > Does pig have a plan to support this feature ?
> >
> >
> > Thank you.
> >
> > Jeff Zhang
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message