public interface Filter
extends org.apache.hadoop.io.Writable
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
Modifier and Type | Interface and Description |
---|---|
static class |
Filter.ReturnCode
Return codes for filterValue().
|
Modifier and Type | Method and Description |
---|---|
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.
|
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 keyboolean 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 questionFilter.ReturnCode
KeyValue transform(KeyValue v)
v
- the KeyValue in questionThe 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)
Copyright © 2014 The Apache Software Foundation. All Rights Reserved.