You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by praveenesh kumar <pr...@gmail.com> on 2013/12/06 17:31:59 UTC

Passing command line arguments

Hi all,

I am using my custom build class and my UDF is acting as wrapper.
I need to pass the command line argument to my UDF, which can be passed
down to the actual class that needs it.

One way would be to use the standard command line passing method and pass
the parameter via constructors down to the class which needs it. But that
doesn't seems to be the right way to me as it requires too much of code
changes, I want to keep my UDF as a separate entity.

Other way (which I am using) is defining the external parameter as system
variable and calling System.getenv( ), get that parameter, which is also
not that ideal as it requires hard-coding the variable on all hadoop nodes.

What I am trying to look, something which I can pass via something like Pig
-D<my parameter=value> and use System.getProperty( ) method to get that
parameter.
But I am not able to find the property. I was wondering is there a way I
can use some other method or alternative to pass the command line variable
using Pig -D method or how pig UDFs are called behind the scenes so that I
can think of some other alternative.

Regards
Praveenesh

Re: Passing command line arguments

Posted by praveenesh kumar <pr...@gmail.com>.
Thanks :)



On Fri, Dec 6, 2013 at 4:36 PM, Serega Sheypak <se...@gmail.com>wrote:

> Mapred. Child.Java.opts
> 06.12.2013 20:32 пользователь "praveenesh kumar" <pr...@gmail.com>
> написал:
>
> > Hi all,
> >
> > I am using my custom build class and my UDF is acting as wrapper.
> > I need to pass the command line argument to my UDF, which can be passed
> > down to the actual class that needs it.
> >
> > One way would be to use the standard command line passing method and pass
> > the parameter via constructors down to the class which needs it. But that
> > doesn't seems to be the right way to me as it requires too much of code
> > changes, I want to keep my UDF as a separate entity.
> >
> > Other way (which I am using) is defining the external parameter as system
> > variable and calling System.getenv( ), get that parameter, which is also
> > not that ideal as it requires hard-coding the variable on all hadoop
> nodes.
> >
> > What I am trying to look, something which I can pass via something like
> Pig
> > -D<my parameter=value> and use System.getProperty( ) method to get that
> > parameter.
> > But I am not able to find the property. I was wondering is there a way I
> > can use some other method or alternative to pass the command line
> variable
> > using Pig -D method or how pig UDFs are called behind the scenes so that
> I
> > can think of some other alternative.
> >
> > Regards
> > Praveenesh
> >
>

Re: Passing command line arguments

Posted by Serega Sheypak <se...@gmail.com>.
Mapred. Child.Java.opts
06.12.2013 20:32 пользователь "praveenesh kumar" <pr...@gmail.com>
написал:

> Hi all,
>
> I am using my custom build class and my UDF is acting as wrapper.
> I need to pass the command line argument to my UDF, which can be passed
> down to the actual class that needs it.
>
> One way would be to use the standard command line passing method and pass
> the parameter via constructors down to the class which needs it. But that
> doesn't seems to be the right way to me as it requires too much of code
> changes, I want to keep my UDF as a separate entity.
>
> Other way (which I am using) is defining the external parameter as system
> variable and calling System.getenv( ), get that parameter, which is also
> not that ideal as it requires hard-coding the variable on all hadoop nodes.
>
> What I am trying to look, something which I can pass via something like Pig
> -D<my parameter=value> and use System.getProperty( ) method to get that
> parameter.
> But I am not able to find the property. I was wondering is there a way I
> can use some other method or alternative to pass the command line variable
> using Pig -D method or how pig UDFs are called behind the scenes so that I
> can think of some other alternative.
>
> Regards
> Praveenesh
>