Database Reference
In-Depth Information
Some other useful utility ilters are as follows:
PageFilter : This ilter keeps track of the number of rows returned per
page. It terminates scanning once the number of ilter-passed rows is greater
than the given page size. This is because the ilter is applied separately on
different region servers.
ColumnCountGetFilter : This ilter restricts the number of columns returned
for each row. This is more suitable for the get() operation, as in the case of
the scan() operation, it stops as soon as it inds the row with the speciied
number of columns.
ColumnPaginationFilter : This ilter provides the pagination over the
column within the rows. Using the offset parameter, it skips the speciied
number of columns.
RandomRowFilter : This ilter uses Java's Random.nextFloat() method for
selecting the rows randomly.
Comparison ilters
These types of ilter use the comparison operator and comparator instance. The
comparison operators, such as LESS , EQUAL , GREATER , and so on, deine the inclusion
or exclusion criteria for the applied ilter. This provides ine-grained control to
specify the range, subset, or exact match for the data scanned. Comparator instances,
such as BinaryComparator , RegexStringComparator , SubstringComparator , and
so on, are required to compare the cell values or keys. Some of the comparison ilters
are discussed as follows:
RowFilter : This ilter works based on the key value. It takes a comparison
operator and a byte[] comparator for the row, as well as the column
qualiier portions of a key, as shown in the following code:
public class RowFilterExample {
public static void main(String[] args) throws IOException
{
// Get instance of Default Configuration
Configuration conf = HBaseConfiguration.create();
// Get table instance
HTable table = new HTable(conf, "tab1");
// Create Scan instance
Scan scan = new Scan();
 
Search WWH ::




Custom Search