按照艺术家分组并输出某个艺术家的唯一键-值对

来源:互联网 发布:武汉ui培训知乎 编辑:程序博客网 时间:2024/05/17 09:04
<strong><span style="font-size:18px;">/*** * @author YangXin * @info 按照艺术家分组并输出某个艺术家的唯一键-值对 * Mapper输出艺术家,而Reducer只输出唯一的艺术家并丢弃空的字符值。 */package unitTwelve;import java.io.IOException;import org.apache.hadoop.io.IntWritable;import org.apache.hadoop.io.Text;import org.apache.hadoop.mapreduce.Reducer;public class DirectoryReducer extends Reducer<Text, IntWritable, Text, IntWritable>{    @Override    protected void reduce(Text artist, Iterable<IntWritable> values, Context context) throws IOException, InterruptedException{        context.write(artist, new IntWritable(0));    }}</span></strong>


0 0
原创粉丝点击