Commit 8f493184 authored by dangq's avatar dangq

Pair finished

parent a9b19c45
......@@ -28,9 +28,9 @@ public class Pair extends Configured implements Tool {
TextPair, // TODO: change Object to output key type
IntWritable> { // TODO: change Object to output value type
// TODO: implement mapper
protected void map(LongWritable key, Text text, Context context) throws IOException, InterruptedException {
protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
//TODO :
String line = this.toString();
String line = value.toString();
line = line.replaceAll("[^a-zA-Z0-9_]+", " ");
line = line.replaceAll("^\\s+", "");
String[] words = line.split("\\s+");
......@@ -100,12 +100,12 @@ public class Pair extends Configured implements Tool {
// TODO: set map class and the map output key and value classes
job.setMapperClass(PairMapper.class);
job.setMapOutputKeyClass(Text.class);
job.setMapOutputKeyClass(TextPair.class);
job.setMapOutputValueClass(IntWritable.class);
// TODO: set reduce class and the reduce output key and value classes
job.setReducerClass(PairReducer.class);
job.setOutputKeyClass(Text.class);
job.setOutputKeyClass(TextPair.class);
job.setOutputValueClass(IntWritable.class);
// TODO: set job output format
......@@ -121,7 +121,7 @@ public class Pair extends Configured implements Tool {
// TODO: set the jar class
job.setJarByClass(WordCount.class);
job.setJarByClass(Pair.class);
job.waitForCompletion(true);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment