table.put(p8);
int i = 0;
Scan s = new Scan();
FilterList filterList = new FilterList();
// check for combination of cat in q1 and dog in q1
SingleColumnValueFilter filter1 =
new SingleColumnValueFilter("col1".getBytes(), "ql".getBytes(), CompareOp.EQUAL,
"cat".getBytes());
filter1.setFilterIfMissing(true);
SingleColumnValueFilter filter2 =
new SingleColumnValueFilter("col3".getBytes(), "ql".getBytes(), CompareOp.EQUAL,
"dog".getBytes());
filter2.setFilterIfMissing(true);
filterList.addFilter(filter1);
filterList.addFilter(filter2);
s.setFilter(filterList);
ResultScanner scanner = table.getScanner(s);
for (Result result : scanner) {
i++;
}
Assert.assertEquals(
"Should match for 1 rows in multiple index with diff column family successfully ", 1, i);
Assert.assertTrue("Seek points should be added ", IndexRegionObserver.getSeekpointAdded());
Assert.assertTrue("Indexed table should be used ", IndexRegionObserver.getIndexedFlowUsed());
// Different values in column family should not retreive the rows.. Below
// ensures the same
Scan s1 = new Scan();
FilterList filterList1 = new FilterList();
// check for combination of cat in q1 and dog in q1
SingleColumnValueFilter filter11 =
new SingleColumnValueFilter("col1".getBytes(), "ql".getBytes(), CompareOp.EQUAL,
"cat".getBytes());
filter11.setFilterIfMissing(true);
SingleColumnValueFilter filter12 =
new SingleColumnValueFilter("col3".getBytes(), "ql".getBytes(), CompareOp.EQUAL,
"dog1".getBytes());
filter12.setFilterIfMissing(true);
filterList1.addFilter(filter11);
filterList1.addFilter(filter12);
s1.setFilter(filterList1);
i = 0;
ResultScanner scanner1 = table.getScanner(s1);