Database Reference
In-Depth Information
// Add a column with value "Hello", in
// "cf1:greet", to the scan.
scan.addColumn(Bytes.toBytes("cf1"),
Bytes.toBytes("greet"));
// Filter using the regular expression
Filter filter = new
RowFilter(CompareFilter.CompareOp.EQUAL,
new RegexStringComparator("*-o"));
scan.setFilter(filter);
// Get Scanner Results
ResultScanner scanner = table.getScanner(scan);
for (Result res : scanner) {
System.out.println("Row Value: " + res);
}
scanner.close();
table.close();
}
}
ValueFilter : This ilter works based on a speciic column value and only
includes the rows where the column value passes the criteria. The following
is the syntax:
// Filter using the sub-string expression
Filter filter = new ValueFilter(CompareFilter.CompareOp.NOT_EQUAL,
New SubstringtringComparator("BYE"));
FamilyFilter : This ilter is very similar to RowFilter and is applied on
column families in place of row keys. The following is the syntax:
// Filter in include the specific column families
Filter filter = new FamilyFilter(CompareFilter.CompareOp.GREATER,
new BinaryComparator(Bytes.toBytes("cf1")));
 
Search WWH ::




Custom Search