|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Filter
Interface for row and column filters directly applied within the regionserver. A filter can expect the following call sequence:
reset()
: reset the filter state before filtering a new row. filterAllRemaining()
: true means row scan is over; false means keep going. filterRowKey(byte[],int,int)
: true means drop this row; false means include.filterKeyValue(KeyValue)
: decides whether to include or exclude this KeyValue.
See Filter.ReturnCode
. transform(KeyValue)
: if the KeyValue is included, let the filter transform the
KeyValue. filterRow(List)
: allows direct modification of the final list to be submitted
filterRow()
: last chance to drop entire row based on the sequence of
filter calls. Eg: filter a row if it doesn't contain a specified column. FilterBase
to help
you reduce boilerplate.
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. |
KeyValue |
transform(KeyValue v)
Give the filter a chance to transform the passed KeyValue. |
Methods inherited from interface org.apache.hadoop.io.Writable |
---|
readFields, write |
Method Detail |
---|
void reset()
boolean filterRowKey(byte[] buffer, int offset, int length)
filterKeyValue(KeyValue)
below.
buffer
- buffer containing row keyoffset
- offset into buffer where row key startslength
- length of the row key
boolean filterAllRemaining()
Filter.ReturnCode filterKeyValue(KeyValue v)
ReturnCode.NEXT_ROW
, it should return
ReturnCode.NEXT_ROW
until reset()
is called
just in case the caller calls for the next row.
v
- the KeyValue in question
Filter.ReturnCode
KeyValue transform(KeyValue v)
v
- the KeyValue in question
The transformed KeyValue is what is eventually returned to the
client. Most filters will return the passed KeyValue unchanged.
,
for an example of a transformation.
void filterRow(List<KeyValue> kvs)
kvs
- the list of keyvalues to be filteredboolean hasFilterRow()
boolean filterRow()
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).
KeyValue getNextKeyHint(KeyValue currentKV)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |