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

Switch to Threaded View
MapReduce >> mail # user >> Passing arguments in hadoop


Copy link to this message
-
Passing arguments in hadoop
Hi,
  I am trying to pass a parameter to multiple mappers

So, I do this in my driver

conf.set("delimiter", args[3]);

In mapper1, I am retreiving this as:

Configuration conf = context.getConfiguration();
String[] values = value.toString().split(conf.get("delimiter"));

and same is my mapper2
But I get this error:
13/08/06 16:38:09 INFO mapred.JobClient: Task Id :
attempt_201306191416_1384_m_000001_0, Status : FAILED
java.lang.NullPointerException
at java.util.regex.Pattern.<init>(Pattern.java:1149)
at java.util.regex.Pattern.compile(Pattern.java:840)
at java.lang.String.split(String.java:2304)
at java.lang.String.split(String.java:2346)
at  DataSourceOneMapper.map(DataSourceOneMapper.java:22)
at .DataSourceOneMapper.map(DataSourceOneMapper.java:1)
And the line 22 corresponds to this conf.get("...") line

What am i doing wrong?
Also, just to add, in this particular case delimiter is "@"

So, if i do

String[] values = value.toString().split("@");

everything works fine??
How do i resolve this?
Thanks