我正在运行一个简单的 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);
...
我怎样才能解决这个问题????