org.apache.hadoop.hbase.filter
Interface Filter

All Superinterfaces:
org.apache.hadoop.io.Writable
All Known Implementing Classes:
ColumnCountGetFilter, ColumnPaginationFilter, ColumnPrefixFilter, CompareFilter, DependentColumnFilter, FamilyFilter, FilterBase, FilterList, FirstKeyOnlyFilter, InclusiveStopFilter, KeyOnlyFilter, PageFilter, PrefixFilter, QualifierFilter, RowFilter, SingleColumnValueExcludeFilter, SingleColumnValueFilter, SkipFilter, TimestampsFilter, 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. When implementing your own filters, consider inheriting FilterBase to help you reduce boilerplate.

See Also:
FilterBase

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.
 void filterRow(List<KeyValue> kvs)
          Chance to alter the list of keyvalues to be submitted.
 boolean filterRowKey(byte[] buffer, int offset, int length)
          Filters a row based on the row key.
 KeyValue getNextKeyHint(KeyValue currentKV)
          If the filter returns the match code SEEK_NEXT_USING_HINT, then it should also tell which is the next key it must seek to.
 boolean hasFilterRow()
           
 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

void filterRow(List<KeyValue> kvs)
Chance to alter the list of keyvalues to be submitted. Modifications to the list will carry on

Parameters:
kvs - the list of keyvalues to be filtered

hasFilterRow

boolean hasFilterRow()
Returns:
True if this filter actively uses filterRow(List). Primarily used to check for conflicts with scans(such as scans that do not read a full row at a time)

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.

getNextKeyHint

KeyValue getNextKeyHint(KeyValue currentKV)
If the filter returns the match code SEEK_NEXT_USING_HINT, then it should also tell which is the next key it must seek to. After receiving the match code SEEK_NEXT_USING_HINT, the QueryMatcher would call this function to find out which key it must next seek to.

Returns:
KeyValue which must be next seeked. return null if the filter is not sure which key to seek to next.


Copyright © 2011 The Apache Software Foundation. All Rights Reserved.