Update Hadoop-MapReduce.md

This commit is contained in:
heibaiying 2019-06-02 17:37:27 +08:00 committed by GitHub
parent 377e66144c
commit 95b6e172dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -149,7 +149,7 @@ public class WordCountMapper extends Mapper<LongWritable, Text, Text, IntWritabl
`WordCountMapper`继承自`Mappe`r类,这是一个泛型类,定义如下:
`WordCountMapper`继承自`Mappe`类,这是一个泛型类,定义如下:
```java
WordCountMapper extends Mapper<LongWritable, Text, Text, IntWritable>
@ -162,13 +162,13 @@ public class Mapper<KEYIN, VALUEIN, KEYOUT, VALUEOUT> {
+ **KEYIN** : `mapping`输入key的类型即每行的偏移量(每行第一个字符在整个文本中的位置)`Long`类型对应Hadoop中的`LongWritable`类型;
+ **VALUEIN** : `mapping`输入value的类型即每行数据`String`类型对应Hadoop中`Text`类型;
+ **KEYOUT** `mapping`输出的key的类型即每个单词`String`类型对应Hadoop中`Text`类型;
+ **VALUEOUT**`mapping`输出value的类型即每个单词出现的次数这里用`int`类型,对应Hadoop中`IntWritable`类型。
+ **VALUEOUT**`mapping`输出value的类型即每个单词出现的次数这里用`int`类型,对应`IntWritable`类型。
### 4.4 WordCountReducer
在Reduce中进程单词出现次数统计:
在Reduce中进行单词出现次数的统计:
```java
public class WordCountReducer extends Reducer<Text, IntWritable, Text, IntWritable> {