HBASE-939 NPE in HStoreKey
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@706348 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5e3815484c
commit
fd5543190c
|
@ -35,6 +35,7 @@ Release 0.19.0 - Unreleased
|
|||
they are using HTable
|
||||
With J-D's one line patch, test cases now appear to work and
|
||||
PerformanceEvaluation works as before.
|
||||
HBASE-939 NPE in HStoreKey
|
||||
|
||||
IMPROVEMENTS
|
||||
HBASE-901 Add a limit to key length, check key and value length on client side
|
||||
|
|
|
@ -351,6 +351,11 @@ public class HStoreKey implements WritableComparable {
|
|||
|
||||
static int compareTo(final HRegionInfo hri, final HStoreKey left,
|
||||
final HStoreKey right) {
|
||||
// We can be passed null
|
||||
if (left == null && right == null) return 0;
|
||||
if (left == null) return -1;
|
||||
if (right == null) return 1;
|
||||
|
||||
int result = compareTwoRowKeys(hri, left.getRow(), right.getRow());
|
||||
if (result != 0) {
|
||||
return result;
|
||||
|
|
|
@ -51,6 +51,11 @@ public class TestCompare extends TestCase {
|
|||
nocolumn = new HStoreKey(a, HConstants.LATEST_TIMESTAMP);
|
||||
withcolumn = new HStoreKey(a, a, timestamp);
|
||||
assertTrue(nocolumn.compareTo(withcolumn) < 0);
|
||||
// Test null keys.
|
||||
HStoreKey normal = new HStoreKey("a", "b");
|
||||
assertTrue(normal.compareTo(null) > 0);
|
||||
assertTrue(HStoreKey.compareTo(null, null, null) == 0);
|
||||
assertTrue(HStoreKey.compareTo(null, null, normal) < 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue