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!




      

Reply via email to