hadoop-mapreduce-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geoffry Roberts <geoffry.robe...@gmail.com>
Subject Question About Passing Properties to a Mapper
Date Wed, 11 May 2011 15:10:52 GMT

I am attempting to pass a string value from my driver to each one of my
mappers and it is not working.  I can set the value, but when I read it back
it returns null.  the value is not null when I set() it and I am using the
correct key when I attempt to get() it.  This should be a simple, straight
forward thing but it isn't working.

I am, however, passing another string value successfully. The difference
seems to be that the value that passes successfully is short and simple
whereas the other, the failure is long and in fact is an xml document
containing new lines, et al.

Question: What must I do to pass an xml document? url encode it? strip the
new lines? other?

Here's my code.

In my driver:

*public void run() {
**  String scenarioName="56crmid";
**  String **scenarioText = "xml document here; new lines and all."**
**  Job job = new Job(new Configuration());
**  job.getConfiguration().set("**scenarioName**", **scenarioName**);  **
**  job.getConfiguration().set("scenario", scenarioText);

In my mapper:

*protected void setup(Context ctx) throws IOException, InterruptedException
**  String **scenarioName**= ctx.getConfiguration().get("**scenarioName**");
*  // ****scenarioName** **is NOT null*
*  String scenarioText = ctx.getConfiguration().get("scenario");
  // **scenarioText is null*
*  ...

Geoffry Roberts

View raw message