hadoop-common-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rajarshi Guha <rg...@indiana.edu>
Subject Re: specifying command line args, but getting an NPE
Date Mon, 04 May 2009 22:21:02 GMT

On May 4, 2009, at 6:07 PM, Todd Lipcon wrote:

>
> Since you have a simple String here, this should be pretty simple.  
> Something
> like:
>
> conf.set("com.example.tool.pattern", otherArgs[2]);
>
> then in the configure() function of your Mapper/Reducer, simply  
> retrieve it
> using conf.get("com.example.tool.pattern");


Trial and error solved the problem. It turns out I need to set the  
value in the Configuration object before I create the Job object.  
Thus, the following works and makes the value of  
net.rguha.dc.data.pattern available to the mappers.

Configuration conf = new Configuration();
conf.set("net.rguha.dc.data.pattern", otherArgs[2]);
Job job = new Job(conf, "id 1");

But if conf.set(...) is called after instantiating job, it doesn't.

Is this intended?

-------------------------------------------------------------------
Rajarshi Guha  <rguha@indiana.edu>
GPG Fingerprint: D070 5427 CC5B 7938 929C  DD13 66A1 922C 51E7 9E84
-------------------------------------------------------------------
Q:  What's polite and works for the phone company?
A:  A deferential operator.



Mime
View raw message