HBASE-20231 Not able to delete column family from a row using RemoteHTable
Signed-off-by: Ashish Singhi <ashishsinghi@apache.org>
This commit is contained in:
parent
b8a13ba10f
commit
a761f175ab
|
@ -115,13 +115,16 @@ public class RemoteHTable implements Table {
|
||||||
Iterator ii = quals.iterator();
|
Iterator ii = quals.iterator();
|
||||||
while (ii.hasNext()) {
|
while (ii.hasNext()) {
|
||||||
sb.append(toURLEncodedBytes((byte[])e.getKey()));
|
sb.append(toURLEncodedBytes((byte[])e.getKey()));
|
||||||
sb.append(':');
|
|
||||||
Object o = ii.next();
|
Object o = ii.next();
|
||||||
// Puts use byte[] but Deletes use KeyValue
|
// Puts use byte[] but Deletes use KeyValue
|
||||||
if (o instanceof byte[]) {
|
if (o instanceof byte[]) {
|
||||||
sb.append(toURLEncodedBytes((byte[])o));
|
sb.append(':');
|
||||||
|
sb.append(toURLEncodedBytes((byte[]) o));
|
||||||
} else if (o instanceof KeyValue) {
|
} else if (o instanceof KeyValue) {
|
||||||
sb.append(toURLEncodedBytes(CellUtil.cloneQualifier((KeyValue)o)));
|
if (((KeyValue) o).getQualifierLength() != 0) {
|
||||||
|
sb.append(':');
|
||||||
|
sb.append(toURLEncodedBytes(CellUtil.cloneQualifier((KeyValue) o)));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new RuntimeException("object type not handled");
|
throw new RuntimeException("object type not handled");
|
||||||
}
|
}
|
||||||
|
|
|
@ -353,18 +353,27 @@ public class TestRemoteTable {
|
||||||
Put put = new Put(ROW_3);
|
Put put = new Put(ROW_3);
|
||||||
put.addColumn(COLUMN_1, QUALIFIER_1, VALUE_1);
|
put.addColumn(COLUMN_1, QUALIFIER_1, VALUE_1);
|
||||||
put.addColumn(COLUMN_2, QUALIFIER_2, VALUE_2);
|
put.addColumn(COLUMN_2, QUALIFIER_2, VALUE_2);
|
||||||
|
put.addColumn(COLUMN_3, QUALIFIER_1, VALUE_1);
|
||||||
|
put.addColumn(COLUMN_3, QUALIFIER_2, VALUE_2);
|
||||||
remoteTable.put(put);
|
remoteTable.put(put);
|
||||||
|
|
||||||
Get get = new Get(ROW_3);
|
Get get = new Get(ROW_3);
|
||||||
get.addFamily(COLUMN_1);
|
get.addFamily(COLUMN_1);
|
||||||
get.addFamily(COLUMN_2);
|
get.addFamily(COLUMN_2);
|
||||||
|
get.addFamily(COLUMN_3);
|
||||||
Result result = remoteTable.get(get);
|
Result result = remoteTable.get(get);
|
||||||
byte[] value1 = result.getValue(COLUMN_1, QUALIFIER_1);
|
byte[] value1 = result.getValue(COLUMN_1, QUALIFIER_1);
|
||||||
byte[] value2 = result.getValue(COLUMN_2, QUALIFIER_2);
|
byte[] value2 = result.getValue(COLUMN_2, QUALIFIER_2);
|
||||||
|
byte[] value3 = result.getValue(COLUMN_3, QUALIFIER_1);
|
||||||
|
byte[] value4 = result.getValue(COLUMN_3, QUALIFIER_2);
|
||||||
assertNotNull(value1);
|
assertNotNull(value1);
|
||||||
assertTrue(Bytes.equals(VALUE_1, value1));
|
assertTrue(Bytes.equals(VALUE_1, value1));
|
||||||
assertNotNull(value2);
|
assertNotNull(value2);
|
||||||
assertTrue(Bytes.equals(VALUE_2, value2));
|
assertTrue(Bytes.equals(VALUE_2, value2));
|
||||||
|
assertNotNull(value3);
|
||||||
|
assertTrue(Bytes.equals(VALUE_1, value3));
|
||||||
|
assertNotNull(value4);
|
||||||
|
assertTrue(Bytes.equals(VALUE_2, value4));
|
||||||
|
|
||||||
Delete delete = new Delete(ROW_3);
|
Delete delete = new Delete(ROW_3);
|
||||||
delete.addColumn(COLUMN_2, QUALIFIER_2);
|
delete.addColumn(COLUMN_2, QUALIFIER_2);
|
||||||
|
@ -394,6 +403,19 @@ public class TestRemoteTable {
|
||||||
assertTrue(Bytes.equals(VALUE_1, value1));
|
assertTrue(Bytes.equals(VALUE_1, value1));
|
||||||
assertNull(value2);
|
assertNull(value2);
|
||||||
|
|
||||||
|
// Delete column family from row
|
||||||
|
delete = new Delete(ROW_3);
|
||||||
|
delete.addFamily(COLUMN_3);
|
||||||
|
remoteTable.delete(delete);
|
||||||
|
|
||||||
|
get = new Get(ROW_3);
|
||||||
|
get.addFamily(COLUMN_3);
|
||||||
|
result = remoteTable.get(get);
|
||||||
|
value3 = result.getValue(COLUMN_3, QUALIFIER_1);
|
||||||
|
value4 = result.getValue(COLUMN_3, QUALIFIER_2);
|
||||||
|
assertNull(value3);
|
||||||
|
assertNull(value4);
|
||||||
|
|
||||||
delete = new Delete(ROW_3);
|
delete = new Delete(ROW_3);
|
||||||
remoteTable.delete(delete);
|
remoteTable.delete(delete);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue