0
我運行一個簡單的Hadoop程序,我得到以下錯誤:MapReduce的用Hadoop類型匹配:
java.io.IOException: Type mismatch in key from map: expected org.apache.hadoop.io.Text, recieved org.apache.hadoop.io.LongWritable
映射:
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
減速機:
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
主營:
...
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(Text.class);
job.setMapOutputKeyClass(Text.class);
job.setMapOutputValueClass(Text.class);
...
我該如何解決這個問題?
你設置了mapper類嗎?看起來你正在獲得IdentityMapper輸出。發佈你的完整作業配置請 –