Skip navigation links
oracle.hadoop.balancer.examples.invindx
Class InvertedIndexMapreduce.InvertedIndexMapper
java.lang.Object
org.apache.hadoop.mapreduce.Mapper<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.Text,InvertedIndex.InvertedIndexKey,InvertedIndex.InvertedIndexValue>
oracle.hadoop.balancer.examples.invindx.InvertedIndexMapreduce.InvertedIndexMapper
- Enclosing class:
- InvertedIndexMapreduce
-
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>
Inverted Index mapper class for 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.
Nested classes/interfaces inherited from class org.apache.hadoop.mapreduce.Mapper |
org.apache.hadoop.mapreduce.Mapper.Context |
Method Summary |
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 |
Methods inherited from class org.apache.hadoop.mapreduce.Mapper |
run |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
InvertedIndexMapreduce.InvertedIndexMapper
public InvertedIndexMapreduce.InvertedIndexMapper()
map
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
- The map function tokenizes each line in the input into words. For each word, it outputs the word, its location (file name) and offset (offset within the file).
-
- Overrides:
map
in class org.apache.hadoop.mapreduce.Mapper<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.Text,InvertedIndex.InvertedIndexKey,InvertedIndex.InvertedIndexValue>
-
- Throws:
java.io.IOException
java.lang.InterruptedException
setup
public void setup(org.apache.hadoop.mapreduce.Mapper.Context context)
throws java.io.IOException
- Initialize the key and value
-
- Overrides:
setup
in class org.apache.hadoop.mapreduce.Mapper<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.Text,InvertedIndex.InvertedIndexKey,InvertedIndex.InvertedIndexValue>
-
- Throws:
java.io.IOException
Skip navigation links
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.