Permalink
Browse files

Fixes, debug code and updates.

  • Loading branch information...
1 parent 7647942 commit 64718f0ea69477bc839678181886db482d4d9ca3 @jganitkevitch committed Apr 16, 2012
View
Binary file not shown.
@@ -60,6 +60,7 @@ protected void reduce(Text key, Iterable<MapWritable> values, Context context)
slsh.buildSignatures(true);
context.write(new SignatureWritable(key,
slsh.getSignature(key.toString()), count, count), NullWritable.get());
+ slsh.clear();
}
return;
@@ -52,14 +52,12 @@ public void write(DataOutput out) throws IOException {
@Override
public int compareTo(SignatureWritable that) {
int cmp = count.compareTo(that.count);
- if (cmp != 0)
- return cmp;
+ // Flip sign for descending sort order.
+ if (cmp != 0) return -cmp;
cmp = key.compareTo(that.key);
- if (cmp != 0)
- return cmp;
- cmp = bytes.compareTo(that.bytes);
- if (cmp != 0)
- return cmp;
- return strength.compareTo(that.strength);
+ if (cmp != 0) return cmp;
+ cmp = strength.compareTo(that.strength);
+ if (cmp != 0) return cmp;
+ return bytes.compareTo(that.bytes);
}
}
@@ -15,7 +15,15 @@ public static void main(String[] argv) throws Exception {
SignatureWritable signature = new SignatureWritable();
while (reader.next(signature)) {
- System.err.println(signature.key.toString() + "\t" + signature.count);
+ StringBuilder out = new StringBuilder();
+ out.append(signature.key.toString());
+ out.append("\t");
+ out.append(signature.count);
+ out.append("\t");
+ byte[] bytes = signature.bytes.getBytes();
+ for (int i = 0; i < bytes.length; i++)
+ out.append(" " + bytes[i]);
+ System.err.println(out);
}
reader.close();

0 comments on commit 64718f0

Please sign in to comment.