Type mismatch in key from map: expected org.apache.hadoop.io.Text, recieved org.apache.hadoop.io.LongWritable

后端 未结 4 1773
情话喂你
情话喂你 2020-12-17 09:22

I am trying to run a map/reducer in java. Below are my files

WordCount.java

package counter;


public class          


        
4条回答
  •  臣服心动
    2020-12-17 09:29

    Add these 2 lines in your code :

    job.setMapOutputKeyClass(Text.class);
    job.setMapOutputValueClass(IntWritable.class);
    

    You are using TextOutputFormat which emits LongWritable key and Text value by default, but you are emitting Text as key and IntWritable as value. You need to tell this to the famework.

    HTH

提交回复
热议问题