final Scanner row_scanner = client.newScanner(table);
row_scanner.setStartKey("cf1");
row_scanner.setStopKey("cf4");
row_scanner.setFilter(
new RowFilter(CompareOp.NOT_EQUAL, new BinaryComparator(Bytes.UTF8("cf2"))));
final ArrayList<ArrayList<KeyValue>> row_rows =
row_scanner.nextRows().join();
assertSizeIs(2, row_rows);
assertSizeIs(1, row_rows.get(0));
assertEq("v1", row_rows.get(0).get(0).value());
assertSizeIs(2, row_rows.get(1));
assertEq("v3", row_rows.get(1).get(0).value());
assertEq("v4", row_rows.get(1).get(1).value());
final Scanner family_scanner = client.newScanner(table);
family_scanner.setFilter(
new FamilyFilter(CompareOp.LESS_OR_EQUAL,
new BinaryComparator(Bytes.UTF8("aSomeOtherFamily"))));
final ArrayList<ArrayList<KeyValue>> family_rows =
family_scanner.nextRows().join();
assertNull(family_rows);
final Scanner qualifier_scanner = client.newScanner(table);
qualifier_scanner.setStartKey("cf1");
qualifier_scanner.setStopKey("cf4");
qualifier_scanner.setFilter(
new QualifierFilter(CompareOp.GREATER,
new BinaryComparator(Bytes.UTF8("b"))));
final ArrayList<ArrayList<KeyValue>> qualifier_rows =
qualifier_scanner.nextRows().join();
assertSizeIs(1, qualifier_rows);
assertSizeIs(2, qualifier_rows.get(0));
assertEq("v3", qualifier_rows.get(0).get(0).value());
assertEq("v4", qualifier_rows.get(0).get(1).value());
final Scanner value_scanner = client.newScanner(table);
value_scanner.setStartKey("cf1");
value_scanner.setStopKey("cf4");
value_scanner.setFilter(
new ValueFilter(CompareOp.GREATER_OR_EQUAL,
new BinaryComparator(Bytes.UTF8("v3"))));
final ArrayList<ArrayList<KeyValue>> value_rows =
value_scanner.nextRows().join();
assertSizeIs(1, value_rows);
assertSizeIs(2, value_rows.get(0));
assertEq("v3", value_rows.get(0).get(0).value());
assertEq("v4", value_rows.get(0).get(1).value());
final Scanner dependent_scanner = client.newScanner(table);
dependent_scanner.setMaxNumKeyValues(-1);
dependent_scanner.setFilter(
new DependentColumnFilter(Bytes.UTF8(family), Bytes.UTF8("dep")));
final ArrayList<ArrayList<KeyValue>> dependent_rows =
dependent_scanner.nextRows().join();
assertSizeIs(1, dependent_rows);
assertSizeIs(2, dependent_rows.get(0));
assertEq("v3", dependent_rows.get(0).get(0).value());
assertEq("v4", dependent_rows.get(0).get(1).value());
final Scanner dependent_value_scanner = client.newScanner(table);
dependent_value_scanner.setMaxNumKeyValues(-1);
dependent_value_scanner.setFilter(
new DependentColumnFilter(
Bytes.UTF8(family),
Bytes.UTF8("dep"),
true,
CompareOp.EQUAL,
new BinaryComparator(Bytes.UTF8("v4"))));
final ArrayList<ArrayList<KeyValue>> dependent_value_rows =
dependent_value_scanner.nextRows().join();
assertSizeIs(1, dependent_value_rows);
assertSizeIs(1, dependent_value_rows.get(0));
assertEq("v3", dependent_value_rows.get(0).get(0).value());