Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
Hadoop >> mail # user >> old problem: mapper output as sequence file


+
Shi Yu 2011-09-19, 19:19
Copy link to this message
-
Re: old problem: mapper output as sequence file
Hi,

On Mon, Sep 19, 2011 at 3:19 PM, Shi Yu <[EMAIL PROTECTED]> 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
+
Shi Yu 2011-09-19, 20:28