Permalink
Browse files

Removed reducer for graph traversal. It isn't needed.

  • Loading branch information...
eljefe6a committed Dec 29, 2012
1 parent b0b1cce commit 80024df717324bdb549258bde16aec49285c4616
Showing with 7 additions and 20 deletions.
  1. +1 −1 src/BoggleDriver.java
  2. +6 −0 src/BoggleMapper.java
  3. +0 −19 src/BoggleReducer.java
View
@@ -126,7 +126,7 @@ private int traverseGraph(String input, Configuration configuration, FileSystem
// Roll is broken in to x mappers per node
job.setInputFormatClass(NLineInputFormat.class);
- job.setNumReduceTasks(1);
+ job.setNumReduceTasks(0);
job.setMapperClass(BoggleMapper.class);
job.setReducerClass(BoggleReducer.class);
View
@@ -51,6 +51,9 @@ public void map(LongWritable key, Text value, Context context) throws IOExceptio
processNonFinalNode(context, charsSoFar, rollGraph);
} else {
context.write(new Text(charsSoFar), rollGraph);
+
+ // Use counters to keep track of how many words were found so far
+ context.getCounter("boggle", "words").increment(1);
}
} else {
logger.warn("The input line had more spaces than were expected. Had " + values.length
@@ -107,6 +110,9 @@ private void processNonFinalNode(Context context, String charsSoFar, RollGraphWr
RollGraphWritable nextGraphWritable = new RollGraphWritable(nextNodeList, false);
context.write(new Text(newWord), nextGraphWritable);
+
+ // Use counters to keep track of how many words were found so far
+ context.getCounter("boggle", "words").increment(1);
} else {
// Use counters to keep track of how many words were thrown out by the Bloom Filter
context.getCounter("boggle", "bloom").increment(1);
View
@@ -1,19 +0,0 @@
-import java.io.IOException;
-
-import org.apache.hadoop.io.Text;
-import org.apache.hadoop.mapreduce.Reducer;
-
-public class BoggleReducer extends Reducer<Text, RollGraphWritable, Text, RollGraphWritable> {
-
- @Override
- public void reduce(Text key, Iterable<RollGraphWritable> values, Context context) throws IOException,
- InterruptedException {
- for (RollGraphWritable value : values) {
- // Identity reducer
- context.write(key, value);
-
- // Use counters to keep track of how many words were found so far
- context.getCounter("boggle", "words").increment(1);
- }
- }
-}

0 comments on commit 80024df

Please sign in to comment.