Hello Kunsheng, You should also change Reducer's Key,Value pair. Now mapper is emitting Text,Text instead of Text, IntWritable. And if you reducer outputs Text,Text as well, you should change conf.setOutputValueClass(IntWritable.class); as well.
Thanks, Lohit ----- Original Message ---- From: Kunsheng Chen <[EMAIL PROTECTED]> To: [email protected] Sent: Thursday, August 14, 2008 11:58:42 AM Subject: Could I change the type of parameter in Mapper and Reducer ? I am going to output the map as <K, V> , in which both K and V are Text value. And K is the first word of each line while V is the second one. My code is modified according to WordCount, the code is compiled successfully but fail to run since it require Mapper to be Mapper<LongWritable, Text, Text, IntWritable> other than Mapper<LongWritable, Text, Text, Text> that I am using . public static class MyMap extends MapReduceBase implements Mapper<LongWritable, Text, Text, Text> { private Text s1=new Text(); private Text s2=new Text(); public void map(LongWritable key, Text value, OutputCollector<Text, Text> output, Reporter reporter) throws IOException { String line = value.toString(); String [] splits = value.toString().split(" "); s1.set(splits[0]); s2.set(splits[1]); // I want to output s1 and s2, both of which are Type Text output.collect(s1,s2); } } } I don't know whether I should overwrite some other classes to change the output or not. There is 'TextOutputFormat.class' inside Example WordCount but I found no more details. Any idea is appreciated. Thanks!
