빅데이터 하둡 프로그래밍 교육과정 ]MyMapper2.map




빅데이터 하둡 프로그래밍 교육과정 ]MyMapper2.map

실무개발자를위한 실무교육 전문교육센터학원

www.oraclejava.co.kr에 오시면 보다 다양한 강좌를 보실 수 있습니다.


MyMapper2.map


■ CountCitation(과 TopN)의 결과가 이 Mapper에 의해 처리. 


■ map 함수의 키로는 ID가 들어오고 밸류로는 빈도수가 들어온다. 


■ Reducer로 출력할 때는 ID를 그대로 키로 그리고 빈도수+”\t”+2을 밸류로  넘긴다. 


public static class MyMapper2 extends Mapper<Text, Text, Text, Text> {

      @Override

      protected void map(Text key, Text value, final Context context) throws IOException, InterruptedException {

        context.write(key, new Text(value + "\t" + 2));

        context.getCounter("Stats", "DocID+Citation").increment(1);

      }

    }



+ Recent posts