빅데이터 하둡 프로그래밍 교육과정 ]MyReducer.reduce
빅데이터 하둡 프로그래밍 교육과정 ]MyReducer.reduce
실무개발자를위한 실무교육 전문교육센터학원
www.oraclejava.co.kr에 오시면 보다 다양한 강좌를 보실 수 있습니다.
MyReducer.reduce
public void reduce(Text key, Iterable<Text> valueIter, final Context context) throws IOException, InterruptedException {
String title = null;
String frequency = null;
int count = 0;
for(Text t: valueIter) {
String str = t.toString();
String []tokens = str.split("\\t");
if (tokens[1].equals("1"))
title = tokens[0];
else
frequency = tokens[0];
count++;
}
if (count == 2 && title != null frequency != null)
context.write(key, new Text(title + "\t" + frequency));
}
'빅데이터 > 빅데이터Hadoop' 카테고리의 다른 글
빅데이터 하둡 프로그래밍 교육과정 ]Sort String 개요 (0) | 2017.02.08 |
---|---|
빅데이터 하둡 프로그래밍 교육과정 ]실행결과 (top 10 most referred wikipedia pages) (0) | 2017.02.08 |
빅데이터 하둡 프로그래밍 교육과정 ]MyMapper2.map (0) | 2017.02.08 |
빅데이터 하둡 프로그래밍 교육과정 ]MyMapper1.map (0) | 2017.02.07 |
빅데이터 하둡 프로그래밍 교육과정 ]MultipleInputs의 사용 (0) | 2017.02.07 |