Skip to content
Browse files

fix for badly sorted kvs in UpdateProcessingResult

  • Loading branch information...
1 parent 1880fef commit 0a3a1390dba7387ab686391cb3c74b612fc55580 Alex Baranau committed May 4, 2012
View
2 src/main/java/com/sematext/hbase/hut/HutResultScanner.java
@@ -300,6 +300,8 @@ public boolean isEmpty() {
}
public Result getResult() {
+ // Result object relies on kvs to be sorted
+ Arrays.sort(kvs, KeyValue.COMPARATOR);
return new Result(kvs);
}
}
View
4 src/test/java/com/sematext/hbase/hut/TestHBaseHut.java
@@ -81,7 +81,9 @@ public void process(Iterable<Result> records, UpdateProcessingResult processingR
if (lastIndex == -1) { // nothing to output
return;
}
- for (int i = 0; i < 5; i++) {
+
+ // writing fields backwards (non in alphabetical order) intentionally: test for one of the fixes
+ for (int i = 4; i >= 0; i--) {
// iterating backwards so that "lastPrice0" is set to the most recent one
int index = (lastIndex + 5 - i) % 5;
byte[] price = lastPricesBuff[index];

0 comments on commit 0a3a139

Please sign in to comment.
Something went wrong with that request. Please try again.