|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.hbase.filter.Filter
@InterfaceAudience.Public @InterfaceStability.Stable public abstract class 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(Cell)
: decides whether to include or exclude this KeyValue.
See Filter.ReturnCode
. transform(KeyValue)
: if the KeyValue is included, let the filter transform the
KeyValue. filterRowCells(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(). |
Field Summary | |
---|---|
protected boolean |
reversed
|
Constructor Summary | |
---|---|
Filter()
|
Method Summary | |
---|---|
abstract boolean |
filterAllRemaining()
If this returns true, the scan will terminate. |
abstract Filter.ReturnCode |
filterKeyValue(Cell v)
A way to filter based on the column family, column qualifier and/or the column value. |
abstract boolean |
filterRow()
Last chance to veto row based on previous filterKeyValue(Cell) calls. |
abstract void |
filterRow(List<KeyValue> kvs)
Deprecated. |
abstract void |
filterRowCells(List<Cell> kvs)
Chance to alter the list of Cells to be submitted. |
abstract boolean |
filterRowKey(byte[] buffer,
int offset,
int length)
Filters a row based on the row key. |
abstract Cell |
getNextCellHint(Cell 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. |
abstract KeyValue |
getNextKeyHint(KeyValue currentKV)
Deprecated. |
abstract boolean |
hasFilterRow()
Primarily used to check for conflicts with scans(such as scans that do not read a full row at a time). |
abstract boolean |
isFamilyEssential(byte[] name)
Check that given column family is essential for filter to check row. |
boolean |
isReversed()
|
static Filter |
parseFrom(byte[] pbBytes)
Concrete implementers can signal a failure condition in their code by throwing an IOException . |
abstract void |
reset()
Reset the state of the filter between rows. |
void |
setReversed(boolean reversed)
alter the reversed scan flag |
abstract byte[] |
toByteArray()
TODO: JAVADOC Concrete implementers can signal a failure condition in their code by throwing an IOException . |
abstract KeyValue |
transform(KeyValue currentKV)
Deprecated. |
abstract Cell |
transformCell(Cell v)
Give the filter a chance to transform the passed KeyValue. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected transient boolean reversed
Constructor Detail |
---|
public Filter()
Method Detail |
---|
public abstract void reset() throws IOException
IOException
.
IOException
- in case an I/O or an filter specific failure needs to be signaled.public abstract boolean filterRowKey(byte[] buffer, int offset, int length) throws IOException
filterKeyValue(Cell)
below.
Concrete implementers can signal a failure condition in their code by throwing an
IOException
.
buffer
- buffer containing row keyoffset
- offset into buffer where row key startslength
- length of the row key
IOException
- in case an I/O or an filter specific failure needs to be signaled.public abstract boolean filterAllRemaining() throws IOException
IOException
.
IOException
- in case an I/O or an filter specific failure needs to be signaled.public abstract Filter.ReturnCode filterKeyValue(Cell v) throws IOException
ReturnCode.NEXT_ROW
, it should return
ReturnCode.NEXT_ROW
until reset()
is called just in case the caller calls
for the next row.
Concrete implementers can signal a failure condition in their code by throwing an
IOException
.
v
- the Cell in question
IOException
- in case an I/O or an filter specific failure needs to be signaled.Filter.ReturnCode
public abstract Cell transformCell(Cell v) throws IOException
v
- the KeyValue in question
IOException
- in case an I/O or an filter specific failure needs to be signaled.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.
Concrete implementers can signal a failure condition in their code by throwing an
{@link IOException}.
@Deprecated public abstract KeyValue transform(KeyValue currentKV) throws IOException
transformCell(Cell)
.
This is for transition from 0.94 -> 0.96
IOException
public abstract void filterRowCells(List<Cell> kvs) throws IOException
IOException
.
kvs
- the list of Cells to be filtered
IOException
- in case an I/O or an filter specific failure needs to be signaled.@Deprecated public abstract void filterRow(List<KeyValue> kvs) throws IOException
filterRowCells(List)
.
This is for transition from 0.94 -> 0.96
IOException
public abstract boolean hasFilterRow()
public abstract boolean filterRow() throws IOException
filterKeyValue(Cell)
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).
Concrete implementers can signal a failure condition in their code by throwing an
IOException
.
IOException
- in case an I/O or an filter specific failure needs to be signaled.@Deprecated public abstract KeyValue getNextKeyHint(KeyValue currentKV) throws IOException
IOException
public abstract Cell getNextCellHint(Cell currentKV) throws IOException
IOException
.
IOException
- in case an I/O or an filter specific failure needs to be signaled.public abstract boolean isFamilyEssential(byte[] name) throws IOException
IOException
.
IOException
- in case an I/O or an filter specific failure needs to be signaled.public abstract byte[] toByteArray() throws IOException
IOException
.
IOException
- in case an I/O or an filter specific failure needs to be signaled.public static Filter parseFrom(byte[] pbBytes) throws DeserializationException
IOException
.
pbBytes
- A pb serialized Filter
instance
Filter
made from bytes
DeserializationException
IOException
- in case an I/O or an filter specific failure needs to be signaled.toByteArray()
public void setReversed(boolean reversed)
reversed
- flagpublic boolean isReversed()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |