org.apache.hadoop.hbase.filter
Interface Filter

All Superinterfaces:
org.apache.hadoop.io.Writable
All Known Implementing Classes:
ColumnCountGetFilter, CompareFilter, FilterList, FirstKeyOnlyFilter, InclusiveStopFilter, PageFilter, PrefixFilter, QualifierFilter, RowFilter, SingleColumnValueFilter, SkipFilter, ValueFilter, WhileMatchFilter

public interface Filter
extends org.apache.hadoop.io.Writable

Interface for row and column filters directly applied within the regionserver. A filter can expect the following call sequence:

Filter instances are created one per region/scan. This interface replaces the old RowFilterInterface.


Nested Class Summary
static class Filter.ReturnCode
          Return codes for filterValue().
 
Method Summary
 boolean filterAllRemaining()
          If this returns true, the scan will terminate.
 Filter.ReturnCode filterKeyValue(KeyValue v)
          A way to filter based on the column family, column qualifier and/or the column value.
 boolean filterRow()
          Last chance to veto row based on previous filterKeyValue(KeyValue) calls.
 boolean filterRowKey(byte[] buffer, int offset, int length)
          Filters a row based on the row key.
 void reset()
          Reset the state of the filter between rows.
 
Methods inherited from interface org.apache.hadoop.io.Writable
readFields, write
 

Method Detail

reset

void reset()
Reset the state of the filter between rows.


filterRowKey

boolean filterRowKey(byte[] buffer,
                     int offset,
                     int length)
Filters a row based on the row key. If this returns true, the entire row will be excluded. If false, each KeyValue in the row will be passed to filterKeyValue(KeyValue) below.

Parameters:
buffer - buffer containing row key
offset - offset into buffer where row key starts
length - length of the row key
Returns:
true, remove entire row, false, include the row (maybe).

filterAllRemaining

boolean filterAllRemaining()
If this returns true, the scan will terminate.

Returns:
true to end scan, false to continue.

filterKeyValue

Filter.ReturnCode filterKeyValue(KeyValue v)
A way to filter based on the column family, column qualifier and/or the column value. Return code is described below. This allows filters to filter only certain number of columns, then terminate without matching ever column. If your filter returns ReturnCode.NEXT_ROW, it should return ReturnCode.NEXT_ROW until reset() is called just in case the caller calls for the next row.

Parameters:
v - the KeyValue in question
Returns:
code as described below
See Also:
Filter.ReturnCode

filterRow

boolean filterRow()
Last chance to veto row based on previous filterKeyValue(KeyValue) calls. The filter needs to retain state then return a particular value for this call if they wish to exclude a row if a certain column is missing (for example).

Returns:
true to exclude row, false to include row.


Copyright © 2010 The Apache Software Foundation