-Re: Context Object in Map Reduce
manish dunani 2013-07-26, 14:33
Can u please elaborate what is the code and what is error.??
Then it will be much better to give the answer.
Regards Manish Dunani..
On Fri, Jul 26, 2013 at 7:07 PM, Tanniru Govardhan
> Hi everyone,
> I am trying to pass a string variable from Driver class to Mapper class.
> I came to know that i need to use context variable for this purpose.
> But the Mapper method i have used has a signature without context object.
> It is not allowing to change the method signature.(reporting syntax error)
> Can anyone please suggest me what can I do regarding this?
> I am very new to Map Reduce Programming.
> Here is the code:
> class Map<V> extends MapReduceBase implements Mapper<LongWritable, Text,
> Text, IntWritable>
> String myfilename;
> private Text word = new Text();
> private IntWritable var = new IntWritable();
> public void map(LongWritable key, Text value, *Context context,*OutputCollector<Text, IntWritable> output, Reporter reporter)
> *//here is the error *
> throws IOException
> Configuration conf = context.getConfiguration();
> myfilename = conf.get("filename");
> -- - - -- - -- -
> public void compute() throws Exception
> Configuration config = new Configuration();
> config.set("filename", "Syn-100n-8t-2l-2k.vars");
> JobConf conf = new JobConf(Hadoop_GNTS.class);
> -- - - - -- - -
+91 9426881954,+91 8460656443