admin 管理员组

文章数量: 887031


2023年12月23日发(作者:divide过去式和过去分词形式)

Reducer1.

package uce;2.

3.

import table;4.

import ;5.

import r;6.

import ption;7.

8.

/**9.

* @author : 张京坤10.

* mail:zhangjingkun88@11.

* date: 2021/12/212.

* project name: HdfsClientDemo13.

* package name: uce14.

* content:15.

* @version :1.016.

*/17.

public class WordcountReducer extends Reducer{18.

int sum;19.

IntWritable v = new IntWritable();20.

21.

@Override22.

protected void reduce(Text key, Iterable values, Context context) throws IOException, InterruptedException {23.

//累加求和24.

sum = 0;25.

for (IntWritable value : values) {26.

sum += ();27.

}28.

//输出29.

(sum);30.

(key, v);31.

}32.

}Driver驱动类1.

package uce;2.

3.

import uration;4.

import ;5.

import table;6.

import ;7.

import ;8.

import putFormat;9.

import tputFormat;10.

11.

import ption;12.

13.

/**14.

* @author : 张京坤15.

* mail:zhangjingkun88@16.

* date: 2021/12/217.

* project name: HdfsClientDemo18.

* package name: uce19.

* content:20.

* @version :1.021.

*/22.

public class WordcountDriver {23.

public static void main(String[] args) throws IOException, ClassNotFoundException, InterruptedException {24.

//1

获取配置信息和job对象25.

Configuration configuration = new Configuration();26.

Job job = tance(configuration);27.

//2

关联本Dirver程序的jar28.

ByClass();29.

//3

关联Mapper和Reducer的jar30.

perClass();31.

ucerClass();


本文标签: 配置 信息 累加 程序