The key provided by the default FileInputFormat is not Text, but an
integer offset into the split(which is not very usful IMHO). Try
changing your mapper back to <WritableComparable, Text>. If you are
expecting the file name to be the key, you will (I think) need to write
your own InputFormat.

Jeff

-----Original Message-----
From: Prasan Ary [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 07, 2008 3:50 PM
To: hadoop
Subject: Map/Reduce Type Mismatch error

  Hi All,
  I am running a Map/Reduce on a textfile.
  Map takes <Text,Text> as (key,value) input pair , and outputs
<Text,IntWritable> as (key,value) output pair.
   
  Reduce takes <Text,IntWritable> as (key,value) input pair, and outputs
<Text,Text> as (key,value) output pair.
   
  I am getting a type mismatch error.
   
  Any suggestion?
   
   
  JobConf job = new JobConf(..............
   
  job.setOutputKeyClass(Text.class); 
  job.setOutputValueClass(Text.class); 
   
  -----------------------------
  public static class Map extends MapReduceBase implements Mapper<Text,
Text, Text, IntWritable> {
    ......
    public void map(Text key, Text value, OutputCollector<Text,
IntWritable> output, Reporter reporter) throws IOException { ......
   
  output.collect(key,new IntWritable(1));
   
  ----------------------------
   
  public static class Reduce extends MapReduceBase implements
Reducer<Text, IntWritable, Text, Text> { 
  public void reduce(Text key, Iterator<IntWritable> values,
OutputCollector<Text,Text> output, Reporter reporter) throws IOException
{  ..............
   
  output.collect(key, new Text("SomeText");

       
---------------------------------
Never miss a thing.   Make Yahoo your homepage.

Reply via email to