Type mismatch in key from map In Hadoop Sorting
NickName:hard coder Ask DateTime:2015-10-28T17:58:47

Type mismatch in key from map In Hadoop Sorting

I am creating a simple hadoop sorting example, I have following code.

I am using ready-made InverseMaper and Identity reducer

        FileInputFormat.setInputPaths(conf, new Path(args[0]));
        FileOutputFormat.setOutputPath(conf, new Path(args[1]));

        conf.setInputFormat(TextInputFormat.class);

        conf.setOutputKeyClass(LongWritable.class);
        conf.setOutputValueClass(LongWritable.class);

        conf.setMapOutputKeyClass(LongWritable.class);
        conf.setMapOutputValueClass(LongWritable.class);

        conf.setMapperClass(InverseMapper.class);
        conf.setReducerClass(IdentityReducer.class);

        conf.setNumReduceTasks(1);

This is my input file data -

432
532
5234
43
65
524
15
56
96
25
3251
369845
58
249
354

When I run this code, I am getting following error. Could anyone help?

15/10/28 15:25:09 INFO mapred.LocalJobRunner: map task executor complete.
15/10/28 15:25:09 WARN mapred.LocalJobRunner: job_local2001686703_0001
java.lang.Exception: java.io.IOException: Type mismatch in key from map: expected org.apache.hadoop.io.LongWritable, received org.apache.hadoop.io.Text
    at org.apache.hadoop.mapred.LocalJobRunner$Job.runTasks(LocalJobRunner.java:462)
    at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:522)
Caused by: java.io.IOException: Type mismatch in key from map: expected org.apache.hadoop.io.LongWritable, received org.apache.hadoop.io.Text
    at org.apache.hadoop.mapred.MapTask$MapOutputBuffer.collect(MapTask.java:1069)
    at org.apache.hadoop.mapred.MapTask$OldOutputCollector.collect(MapTask.java:607)
    at org.apache.hadoop.mapred.lib.InverseMapper.map(InverseMapper.java:42)
    at org.apache.hadoop.mapred.MapRunner.run(MapRunner.java:54)
    at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:450)
    at org.apache.hadoop.mapred.MapTask.run(MapTask.java:343)
    at org.apache.hadoop.mapred.LocalJobRunner$Job$MapTaskRunnable.run(LocalJobRunner.java:243)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

Copyright Notice:Content Author:「hard coder」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/33387929/type-mismatch-in-key-from-map-in-hadoop-sorting

More about “Type mismatch in key from map In Hadoop Sorting” related questions

Type mismatch in key from map In Hadoop Sorting

I am creating a simple hadoop sorting example, I have following code. I am using ready-made InverseMaper and Identity reducer FileInputFormat.setInputPaths(conf, new Path(args[0])); ...

Show Detail

MapReduce with Hadoop: Type mismatch in key from map

I'm running a simple wordcount program, and I get the following error: Type mismatch in key from map: expected org.apache.hadoop.io.Text, received org.apache.hadoop.io.LongWritable What is the me...

Show Detail

hadoop-streaming example failed to run - Type mismatch in key from map

I was running $HADOOP_HOME/bin/hadoop jar $HADOOP_HOME/hadoop-streaming.jar \ -D stream.map.output.field.separator=. \ -D stream.num.map.output.key.fields=4 \ -input myInputDirs \ -

Show Detail

Hadoop Stream Job Error (Type mismatch in key from map)

I know that there are few identical issues reported. In my case my case I wrote Mr. jobs on R in regular way. I know there is a way to use RHadoop to access hadoop directly from R though. I execu...

Show Detail

MapReduce with Hadoop: Type mismatch

I'm running a simple hadoop program, and I get the following error: java.io.IOException: Type mismatch in key from map: expected org.apache.hadoop.io.Text, recieved org.apache.hadoop.io.LongWritab...

Show Detail

Task fails in hadoop because of "Type mismatch in key from map"

I have been folowing this tutorial for setting up hadoop on a single windows machine. Both the NameNode and JobTracker services are working respectively on http://localhost:50070 and http://localhost:

Show Detail

Hadoop: Error: java.io.IOException: Type mismatch in key from map: expected org.apache.hadoop.io.Text, received org.apache.hadoop.io.LongWritable

I am tryiing to write a map reduce program for inverted index calculations. My map code is public class InvertdIdxMapper extends Mapper<LongWritable, Text, Text, Text> { public void map(

Show Detail

Type mismatch in key from map even though i setMapOutputKey class

I am getting type mismatch from map even though i have set map output key class and map output value class. This is my sample code. public class NgramCount{ protected final static String RAWCOUN...

Show Detail

Type mismatch in key from map as it identified as LongWriteable

I wrote a MapReduce program to process the data from a text file. But when I run it locally (Linux VM), it hits an error that it identified the key from the map as a LongWriteable not Text as requi...

Show Detail

Type mismatch in value from map

I am running this code using oozie workflow and getting type mismatch error: public static class mapClass extends Mapper<Object, Text, LongWritable, LongWritable> { public void map(...

Show Detail