1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package net.sf.eos.hadoop.mapred.index;
17
18 import net.sf.eos.hadoop.mapred.EosDocumentSupportMapReduceBase;
19 import net.sf.eos.hadoop.mapred.Index;
20
21 import org.apache.hadoop.io.Text;
22 import org.apache.hadoop.io.WritableComparable;
23 import org.apache.hadoop.mapred.JobConf;
24 import org.apache.hadoop.mapred.Mapper;
25 import org.apache.hadoop.mapred.OutputCollector;
26 import org.apache.hadoop.mapred.Reporter;
27
28 import java.io.IOException;
29
30 public class IndexMapper<K extends WritableComparable>
31 extends EosDocumentSupportMapReduceBase
32 implements Mapper<K, Text, K, Text> {
33
34 private JobConf conf;
35
36 public void map(final K key,
37 final Text value,
38 final OutputCollector<K, Text> output,
39 final Reporter reporter)
40 throws IOException {
41 output.collect(key, value);
42 reporter.incrCounter(Index.MAP, 1);
43 }
44
45
46
47
48 @Override
49 public void configure(@SuppressWarnings("hiding") final JobConf conf) {
50 super.configure(conf);
51 this.conf = conf;
52 }
53
54 @Override
55 public void close() throws IOException {
56 super.close();
57 }
58 }