MapReduce with Hadoop: Type mismatch
NickName:Babis Babis Ask DateTime:2013-02-03T03:39:50

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.LongWritable

Mapper:

public static class myMapper extends Mapper<LongWritable, Text, Text, Text>
public void map(LongWritable key, Text line,OutputCollector<Text,Text> output, Reporter reporter) throws IOException, InterruptedException

Reducer:

public static class triangleCounterReducer extends Reducer<Text, Text, Text, Text> 
public void reduce(Text key,Iterable<Text> line,OutputCollector<Text,Text> output,Reporter reporter) throws IOException, InterruptedException

Main:

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

How can i fix this????

Copyright Notice:Content Author:「Babis Babis」,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/14665711/mapreduce-with-hadoop-type-mismatch

More about “MapReduce with Hadoop: Type mismatch” related questions

MapReduce Key type mismatch

I am new to MapReduce, in my MapReduce program I got a key type mismatch error: Error: java.io.IOException: Type mismatch in key from map: expected org.apache.hadoop.io.LongWritable, received org.a...

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

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 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

Unable to run map reduce job in hadoop 2.7 - Type Mismatch

While running the program getting Error: java.io.IOException: Type mismatch in key from map: expected org.apache.hadoop.io.Text, received org.apache.hadoop.io.LongWritable I tried more suggestions...

Show Detail

Hadoop MapReduce thinking

I am newbie in the world of hadoop mapreduce framework. I read a lot of tutorials myself and understood the framework. I have successfully configured a hadoop setup in pseudo distributed mode. I ha...

Show Detail

Error: "java.io.IOException: Type mismatch in key from map" on my MapReduce class (using Hadoop 2.2.0)

I'm trying to execute a MapReduce program on localhost by Hadoop. I wrote a program to count the word in a text file. The source code is very simple: import java.io.IOException; import java.util.

Show Detail

Hadoop, mapreduce java.io.IOException: Type mismatch in value from map: expected org.apache.hadoop.io.Text, recieved org.apache.hadoop.io.IntWritable

I am trying to use two mappers and one reducer. I got this following error : I want to combine several keys and I am expecting to get the output for its summation based on each key. I don't know ...

Show Detail

Jars for hadoop mapreduce

I am following this hadoop mapreduce tutorial given by Apache. The Java code given there uses these Apache-hadoop classes: import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.f...

Show Detail

Hadoop MapReduce NoSuchElementException

I wanted to run a MapReduce-Job on my FreeBSD-Cluster with two nodes but I get the following Exception 14/08/27 14:23:04 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your

Show Detail