Reducer 的键和值为空

Reducer getting null for key and value

我将我的地图定义为

public static class FlightMapper 
    extends Mapper<Object, Text, Text, Text> {...}

我的减速器 class 定义为

public static class FlightReducer
    extends Reducer<Text,Text,Text,Text> {...}

我的减速器构造函数:

public void reduce(Text key, Text values, 
                Context context) throws IOException, InterruptedException {...}

但是在我的减速器构造函数中的减速器中,当我打印键和值时,值为空。 我的主要功能:

    FileInputFormat.addInputPath(job, new Path(otherArgs[0]));
    FileOutputFormat.setOutputPath(job, new Path(otherArgs[1]));
    job.setNumReduceTasks(4);
    job.setJarByClass(FlightData.class);
    job.setMapperClass(FlightMapper.class);
    job.setMapOutputKeyClass(Text.class);
    job.setMapOutputValueClass(Text.class);
    job.setReducerClass(FlightReducer.class);
    job.setOutputKeyClass(Text.class);
    job.setOutputValueClass(Text.class);
    System.exit(job.waitForCompletion(true) ? 0 : 1);

我是 Hadoop 新手,所以这可能是一些小错误。请帮忙。

我得到了解决方案,没有在构造函数中使用 Iterable,因此 reducer 找不到所需的构造函数。