int low = numRows / 10;
int high = numRows - low;
idxScan.setExpression(Or.or(Comparison.comparison(family, qualLong, Comparison.Operator.GTE, Bytes.toBytes((long) high)),
Comparison.comparison(family, qualDouble, Comparison.Operator.LT, Bytes.toBytes((double) low))));
if (!memStoreEmpty) {
idxScan.setFilter(new FilterList(FilterList.Operator.MUST_PASS_ONE,
Arrays.<Filter>asList(
new SingleColumnValueFilter(family, qualLong, CompareFilter.CompareOp.GREATER_OR_EQUAL,
new BinaryComparator(Bytes.toBytes((long) high))),
new SingleColumnValueFilter(family, qualDouble, CompareFilter.CompareOp.LESS,
new BinaryComparator(Bytes.toBytes((double) low))))
));
}
InternalScanner scanner = region.getScanner(idxScan);
List<KeyValue> res = new ArrayList<KeyValue>();
//long start = System.nanoTime();
while (scanner.next(res)) ;
//long end = System.nanoTime();
//System.out.println("[top and botoom 10%] memStoreEmpty=" + memStoreEmpty + ", time=" + (end - start)/1000000D);
assertEquals(numRows / 5 * numColumns, res.size());
/**
* Scan the index with a matching and expression on two indices
*/
idxScan = new IdxScan();
idxScan.addFamily(family);
int half = numRows / 2;
idxScan.setExpression(And.and(Comparison.comparison(family, qualLong, Comparison.Operator.GTE, Bytes.toBytes((long) half)),
Comparison.comparison(family, qualBytes, Comparison.Operator.EQ, Bytes.toBytes("str" + 30))));
if (!memStoreEmpty) {
idxScan.setFilter(new FilterList(FilterList.Operator.MUST_PASS_ALL,
Arrays.<Filter>asList(
new SingleColumnValueFilter(family, qualLong, CompareFilter.CompareOp.GREATER_OR_EQUAL,
new BinaryComparator(Bytes.toBytes((long) half))),
new SingleColumnValueFilter(family, qualBytes, CompareFilter.CompareOp.EQUAL,
new BinaryComparator(Bytes.toBytes("str" + 30))))