为什么我们需要在 MapReduce 作业中显式设置 OutputKey/InputKey Class?
Why do we need to explicitly set OutputKey/InputKey Class in MapReduce job?
当 Map 和 Reduce classes 必须扩展 Mapper 和 Reducer classes 时,为什么我们需要在 MapReduce 作业中显式设置 OutputKey/InputKey Class需要添加 <InputKeyClass, InputValueClass, OuputKeyClass, OutputValueClass>
?
一个例子:
工作会议:
job.setOutputKeyClass(NullWritable.class);
job.setOutputValueClass(Text.class);
job.setOutputFormatClass(TextOutputFormat.class);
减速器:
public static class ComputeReducer extends
Reducer<Text, Text, NullWritable, Text> {
如果我们已经显式设置减速器 class 以扩展 'Reducer <Text, Text, NullWritable, Text>'
那么为什么需要传递 OutputKey/value class?
您必须这样做,因为在 java 的 运行 时间所有通用信息都丢失了。
当 Map 和 Reduce classes 必须扩展 Mapper 和 Reducer classes 时,为什么我们需要在 MapReduce 作业中显式设置 OutputKey/InputKey Class需要添加 <InputKeyClass, InputValueClass, OuputKeyClass, OutputValueClass>
?
一个例子:
工作会议:
job.setOutputKeyClass(NullWritable.class);
job.setOutputValueClass(Text.class);
job.setOutputFormatClass(TextOutputFormat.class);
减速器:
public static class ComputeReducer extends
Reducer<Text, Text, NullWritable, Text> {
如果我们已经显式设置减速器 class 以扩展 'Reducer <Text, Text, NullWritable, Text>'
那么为什么需要传递 OutputKey/value class?
您必须这样做,因为在 java 的 运行 时间所有通用信息都丢失了。