use of com.google.cloud.bigtable.hbase.filter.BigtableFilter in project java-bigtable-hbase by googleapis.
the class TestFilters method testBigtableFilter.
@Test
public void testBigtableFilter() throws IOException {
if (!sharedTestEnv.isBigtable()) {
return;
}
byte[] rowKey = dataHelper.randomData("cbt-filter-");
byte[] qualA = Bytes.toBytes("a");
byte[] qualB = Bytes.toBytes("b");
byte[] valA = dataHelper.randomData("a");
byte[] valB = dataHelper.randomData("b");
try (Table table = getDefaultTable()) {
table.put(new Put(rowKey).addColumn(COLUMN_FAMILY, qualA, valA).addColumn(COLUMN_FAMILY, qualB, valB));
Filters.Filter qualAFilter = Filters.FILTERS.qualifier().exactMatch(new String(qualA));
BigtableFilter bigtableFilter = new BigtableFilter(qualAFilter);
Result result = table.get(new Get(rowKey).setFilter(bigtableFilter));
Assert.assertEquals(1, result.size());
Assert.assertTrue(CellUtil.matchingValue(result.rawCells()[0], valA));
}
}
Aggregations