MapReduce没有输出,得到一个空的文件夹可能的原因

1. Map输出类型和Reducer的输入类型对不上

注意

当Mapper的输出类型和Reducer的输出类型是一样的时候,可以仅设置Reducer的输出类型

job.setOutputKeyClass(Text.class);
job.setOutputValueClass(Text.class);

当时当当Mapper的输出类型和Reducer的输出类型是一样的时候,除了设置Reducer的输出类型外还要显示设置Maper的数据类型,如下

job.setMapOutputKeyClass(xxx.class);
job.setMapOutputValueClass(xxx.class);

2. myMapper和myReducer类不是 static 的,这样在主方法中使用myReducer.class就有问题

原文地址:https://www.cnblogs.com/hi3254014978/p/12951705.html