Skip to content

Commit cf33383

Browse files
miyuan-ljrstuBirdFly
authored andcommitted
fix (#66)
1 parent 65f8cdd commit cf33383

File tree

1 file changed

+9
-54
lines changed

1 file changed

+9
-54
lines changed

src/test/java/com/alipay/oceanbase/hbase/HTableTestBase.java

Lines changed: 9 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,13 @@ public void testFilter() throws Exception {
752752
Assert.assertEquals(res_count, 1);
753753
scanner.close();
754754

755+
Delete deleteKey3Family = new Delete(toBytes("getKey3"));
756+
deleteKey3Family.deleteFamily(toBytes(family));
757+
Delete deleteKey4Family = new Delete(toBytes("getKey4"));
758+
deleteKey4Family.deleteFamily(toBytes(family));
759+
hTable.delete(deleteKey3Family);
760+
hTable.delete(deleteKey4Family);
761+
755762
Put putKey3Column3Value1 = new Put(toBytes("getKey3"));
756763
putKey3Column3Value1.add(toBytes(family), toBytes(column1), toBytes(value1));
757764
tryPut(hTable, putKey3Column3Value1);
@@ -772,7 +779,7 @@ public void testFilter() throws Exception {
772779
res_count += 1;
773780
}
774781
}
775-
Assert.assertEquals(res_count, 30);
782+
Assert.assertEquals(res_count, 12);
776783
scanner.close();
777784

778785
scan = new Scan();
@@ -808,7 +815,7 @@ public void testFilter() throws Exception {
808815
res_count += 1;
809816
}
810817
}
811-
Assert.assertEquals(res_count, 30);
818+
Assert.assertEquals(res_count, 12);
812819
scanner.close();
813820
}
814821

@@ -1117,58 +1124,6 @@ public void testFilter2() throws Exception {
11171124
scanner.close();
11181125
}
11191126

1120-
@Test
1121-
public void debugtest() throws Exception {
1122-
String key1 = "getKey1";
1123-
String key2 = "getKey2";
1124-
String column1 = "abc";
1125-
String column2 = "def";
1126-
String value1 = "value1";
1127-
String value2 = "value2";
1128-
String value3 = "value3";
1129-
String family = "family1";
1130-
long ts;
1131-
Delete deleteKey1Family = new Delete(toBytes(key1));
1132-
deleteKey1Family.deleteFamily(toBytes(family));
1133-
1134-
Delete deleteKey2Family = new Delete(toBytes(key2));
1135-
deleteKey2Family.deleteFamily(toBytes(family));
1136-
1137-
hTable.delete(deleteKey1Family);
1138-
hTable.delete(deleteKey2Family);
1139-
1140-
Put putKey1Column1Value1 = new Put(toBytes(key1));
1141-
putKey1Column1Value1.add(toBytes(family), toBytes(column1), toBytes(value1));
1142-
tryPut(hTable, putKey1Column1Value1);
1143-
1144-
Scan scan = new Scan();
1145-
scan.addFamily(family.getBytes());
1146-
scan.setStartRow("getKey1".getBytes());
1147-
scan.setStopRow("getKey3".getBytes());
1148-
scan.setMaxVersions(10);
1149-
KeyOnlyFilter kFilter = new KeyOnlyFilter(true);
1150-
scan.setFilter(kFilter);
1151-
ResultScanner scanner = hTable.getScanner(scan);
1152-
1153-
int res_count = 0;
1154-
for (Result result : scanner) {
1155-
for (Cell cell : result.rawCells()) {
1156-
if (res_count < 8) {
1157-
Assert.assertArrayEquals(key1.getBytes(), cell.getRow());
1158-
} else {
1159-
Assert.assertArrayEquals(key2.getBytes(), cell.getRow());
1160-
}
1161-
int offset = cell.getValueOffset();
1162-
System.out.println(Arrays.toString(CellUtil.cloneValue(cell)));
1163-
Assert.assertEquals(4, cell.getValueLength());
1164-
Assert.assertEquals(6, Bytes.toInt(CellUtil.cloneValue(cell)));
1165-
res_count += 1;
1166-
}
1167-
}
1168-
Assert.assertEquals(res_count, 2);
1169-
scanner.close();
1170-
}
1171-
11721127
@Test
11731128
public void testGetFilter() throws Exception {
11741129
String key1 = "getKey1";

0 commit comments

Comments
 (0)