Skip to content

Commit

Permalink
#92 -- copy the Text objects that we're storing because I'm pretty su…
Browse files Browse the repository at this point in the history
…re now we're getting hung up because Hadoop is reusing Writables so they are not safe to store in a collection
  • Loading branch information
paulhoule committed Dec 18, 2013
1 parent bfdfe11 commit 89cb4c6
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 27 deletions.
79 changes: 56 additions & 23 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ public void setup(Context context) throws IOException, InterruptedException {
log.info("Accepting type: ["+type+"]");
}

@Override
protected Text copy(Text text) {
return new Text(text);
}

@Override
protected boolean matches(Text subject, Iterable<Text> facts) {
for(Text fact:facts) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,15 @@ protected void reduce(KEY key,Iterable<VALUE> values,Context context) throws IOE

List<VALUE> rewindableValues= Lists.newArrayList();
for(VALUE value:values) {
if (value.toString().contains("/m.01hpdw>")) {
log.info("Key: "+key+" has value ["+value+"]");
}
rewindableValues.add(value);
rewindableValues.add(copy(value));
}

if(matches(key,rewindableValues))
for(VALUE value:rewindableValues)
context.write(null,value);
}

protected abstract VALUE copy(VALUE value);

protected abstract boolean matches(KEY key, Iterable<VALUE> values);
}

0 comments on commit 89cb4c6

Please sign in to comment.