hadoop-common-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brock Noland <br...@cloudera.com>
Subject Re: old problem: mapper output as sequence file
Date Mon, 19 Sep 2011 20:15:09 GMT
Hi,

On Mon, Sep 19, 2011 at 3:19 PM, Shi Yu <shiyu@uchicago.edu> wrote:
>
> I am stuck again in a probably very simple problem.  I couldn't generate the
> map output in sequence file format.  I always get this error:
> java.io.IOException: wrong key class: org.apache.hadoop.io.Text is not class org.apache.hadoop.io.LongWritable


No worries.

>        job.setMapOutputKeyClass(Text.class);
>        job.setMapOutputValueClass(Text.class);

You are running a map only job, so I think you want:

       job.setOutputKeyClass(Text.class);
       job.setOutputValueClass(Text.class);

But I also recommend adding @Override on your map method because it's
easy to accidentally not override your superclass method.

         @Override
          public void map(LongWritable key, Text value, Context context)
         throws IOException, InterruptedException{


Brock

Mime
View raw message