public static class InvertedIndexMapreduce.InvertedIndexMapper extends org.apache.hadoop.mapreduce.Mapper<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.Text,InvertedIndex.InvertedIndexKey,InvertedIndex.InvertedIndexValue>
TextInputFormat
and FileSplit
This class uses the file name obtained from FileSplit
as the location of the word, and the value of the LongWritable key of TextInputFormat
as the offset of the word in that file.Constructor and Description |
---|
InvertedIndexMapreduce.InvertedIndexMapper() |
Modifier and Type | Method and Description |
---|---|
void |
map(org.apache.hadoop.io.LongWritable keyIn, org.apache.hadoop.io.Text valueIn, org.apache.hadoop.mapreduce.Mapper.Context context)
The map function tokenizes each line in the input into words.
|
void |
setup(org.apache.hadoop.mapreduce.Mapper.Context context)
Initialize the key and value
|
public InvertedIndexMapreduce.InvertedIndexMapper()
public void map(org.apache.hadoop.io.LongWritable keyIn, org.apache.hadoop.io.Text valueIn, org.apache.hadoop.mapreduce.Mapper.Context context) throws java.io.IOException, java.lang.InterruptedException
map
in class org.apache.hadoop.mapreduce.Mapper<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.Text,InvertedIndex.InvertedIndexKey,InvertedIndex.InvertedIndexValue>
java.io.IOException
java.lang.InterruptedException
public void setup(org.apache.hadoop.mapreduce.Mapper.Context context) throws java.io.IOException
setup
in class org.apache.hadoop.mapreduce.Mapper<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.Text,InvertedIndex.InvertedIndexKey,InvertedIndex.InvertedIndexValue>
java.io.IOException