org.apache.hadoop.examples
Class WordMedian.WordMedianMapper

java.lang.Object
  extended by org.apache.hadoop.mapreduce.Mapper<Object,org.apache.hadoop.io.Text,org.apache.hadoop.io.IntWritable,org.apache.hadoop.io.IntWritable>
      extended by org.apache.hadoop.examples.WordMedian.WordMedianMapper
Enclosing class:
WordMedian

public static class WordMedian.WordMedianMapper
extends org.apache.hadoop.mapreduce.Mapper<Object,org.apache.hadoop.io.Text,org.apache.hadoop.io.IntWritable,org.apache.hadoop.io.IntWritable>

Maps words from line of text into a key-value pair; the length of the word as the key, and 1 as the value.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.hadoop.mapreduce.Mapper
org.apache.hadoop.mapreduce.Mapper.Context
 
Constructor Summary
WordMedian.WordMedianMapper()
           
 
Method Summary
 void map(Object key, org.apache.hadoop.io.Text value, org.apache.hadoop.mapreduce.Mapper.Context context)
          Emits a key-value pair for counting the word.
 
Methods inherited from class org.apache.hadoop.mapreduce.Mapper
cleanup, run, setup
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WordMedian.WordMedianMapper

public WordMedian.WordMedianMapper()
Method Detail

map

public void map(Object key,
                org.apache.hadoop.io.Text value,
                org.apache.hadoop.mapreduce.Mapper.Context context)
         throws IOException,
                InterruptedException
Emits a key-value pair for counting the word. Outputs are (IntWritable, IntWritable).

Overrides:
map in class org.apache.hadoop.mapreduce.Mapper<Object,org.apache.hadoop.io.Text,org.apache.hadoop.io.IntWritable,org.apache.hadoop.io.IntWritable>
Parameters:
value - This will be a line of text coming in from our input file.
Throws:
IOException
InterruptedException


Copyright © 2014 Apache Software Foundation. All Rights Reserved.