读书人

Type mismatch in key from 地图: exp

发布时间: 2012-08-22 09:50:35 作者: rapoo

Type mismatch in key from map: expected .. Text, received … LongWritable

Couple of things to be fixed in the code

  1. The old (o.a.h.mapred) and the new API (o.a.h.mapreduce) are not compatible, so they should not be mixed.

    import org.apache.hadoop.mapred.OutputCollector;
    import org.apache.hadoop.mapred.Reporter;
    import org.apache.hadoop.mapreduce.Job;
    import org.apache.hadoop.mapreduce.Mapper;
    import org.apache.hadoop.mapreduce.Reducer;

  2. Make sure the input/output for the mappers/reducers are of the type o.a.h.io.Writable. The input key for the Mapper is Object, make it LongWritable.

  3. Looks like the Combiner and the Reducer functionality is the same, so you need not repeat it.

    job.setCombinerClass(Reducer.class);

读书人网 >行业软件

热点推荐