• 大小: 154KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-05-21
  • 语言: 其他
  • 标签: Hadoop  

资源简介

完整的词频统计MapReduce版本。基于Hadoop2.2.0,包含一个十万单词左右的测试文件。请参照 http://blog.csdn.net/zythy/article/details/17888439 获取详细解说。

资源截图

代码片段和文件信息

package com.oserp.wordsfrequencies;

import java.io.IOException;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text; 

public class WordsFrequenciesCombiner extends org.apache.hadoop.mapreduce.Reducer{

@Override
protected void reduce(Text key Iterable values
Context context)
throws IOException InterruptedException {

long counts = 0;

for (LongWritable value : values) {
counts += value.get();
}

context.write(key new LongWritable(counts));
}
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件        3278  2014-01-05 11:02  WordsFrequencies\bin\com\oserp\wordsfrequencies\WordsFrequenciesRunner.class
     文件        2316  2014-01-05 09:48  WordsFrequencies\bin\com\oserp\wordsfrequencies\WordsFrequenciesReducer.class
     文件        2275  2014-01-05 10:40  WordsFrequencies\bin\com\oserp\wordsfrequencies\WordsFrequenciesMapper2.class
     文件        1066  2014-01-05 09:29  WordsFrequencies\bin\com\oserp\wordsfrequencies\WordsFrequenciesPartitioner.class
     文件        2358  2014-01-05 09:29  WordsFrequencies\bin\com\oserp\wordsfrequencies\WordsFrequenciesMapper.class
     文件        2319  2014-01-05 09:51  WordsFrequencies\bin\com\oserp\wordsfrequencies\WordsFrequenciesCombiner.class
     文件        2300  2014-01-05 10:48  WordsFrequencies\bin\com\oserp\wordsfrequencies\WordsFrequenciesReducer2.class
     文件         663  2014-01-05 08:01  WordsFrequencies\src\com\oserp\wordsfrequencies\WordsFrequenciesMapper.java
     文件         578  2014-01-05 09:48  WordsFrequencies\src\com\oserp\wordsfrequencies\WordsFrequenciesReducer.java
     文件        2845  2014-01-05 11:02  WordsFrequencies\src\com\oserp\wordsfrequencies\WordsFrequenciesRunner.java
     文件         508  2014-01-04 14:03  WordsFrequencies\src\com\oserp\wordsfrequencies\WordsFrequenciesPartitioner.java
     文件         557  2014-01-05 09:51  WordsFrequencies\src\com\oserp\wordsfrequencies\WordsFrequenciesCombiner.java
     文件         488  2014-01-05 10:40  WordsFrequencies\src\com\oserp\wordsfrequencies\WordsFrequenciesMapper2.java
     文件         573  2014-01-05 10:48  WordsFrequencies\src\com\oserp\wordsfrequencies\WordsFrequenciesReducer2.java
     文件         427  2014-01-03 08:44  WordsFrequencies\.project
     文件       14523  2014-01-03 08:44  WordsFrequencies\.classpath
     目录           0  2014-01-05 09:30  WordsFrequencies\bin\com\oserp\wordsfrequencies\
     目录           0  2014-01-05 09:30  WordsFrequencies\src\com\oserp\wordsfrequencies\
     目录           0  2014-01-05 09:29  WordsFrequencies\bin\com\oserp\
     目录           0  2014-01-03 08:54  WordsFrequencies\src\com\oserp\
     目录           0  2014-01-05 09:29  WordsFrequencies\bin\com\
     目录           0  2014-01-03 08:54  WordsFrequencies\src\com\
     目录           0  2014-01-05 09:29  WordsFrequencies\bin\
     目录           0  2014-01-03 08:54  WordsFrequencies\src\
     目录           0  2014-01-03 08:44  WordsFrequencies\
     文件      430201  2014-01-03 23:09  10 Steps To Sales Success.txt

评论

共有 条评论