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

Switch to Plain View
Pig, mail # user - Passing command line arguments


Copy link to this message
-
Passing command line arguments
praveenesh kumar 2013-12-06, 16:31
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
+
Serega Sheypak 2013-12-06, 16:36
+
praveenesh kumar 2013-12-06, 16:55