-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSedMapper.Java
30 lines (23 loc) · 853 Bytes
/
SedMapper.Java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package june_6_2013;
import java.io.IOException;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
public class SedMapper extends Mapper<LongWritable, Text, NullWritable,Text>
{
private String str_format;
//ivate String str_find_val="Hadoop";
//private String str_replace_val="Big Dataaaaaa ";
private Text returnvalue=new Text();
public void map(LongWritable key,Text value,Context context)
throws IOException,InterruptedException
{
str_format=value.toString();
if(str_format.contains(context.getConfiguration().get("sed-arg1")))
{
returnvalue.set(str_format.replaceAll(context.getConfiguration().get("sed-arg1"),context.getConfiguration().get("sed-arg2")));
context.write(NullWritable.get(),returnvalue);
}
}
}