|
||||||||||
| 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(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(). |
| Constructor Summary | |
|---|---|
Filter()
|
|
| Method Summary | |
|---|---|
abstract boolean |
filterAllRemaining()
If this returns true, the scan will terminate. |
abstract Filter.ReturnCode |
filterKeyValue(KeyValue 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(KeyValue) calls. |
abstract void |
filterRow(List<KeyValue> kvs)
Chance to alter the list of keyvalues to be submitted. |
abstract boolean |
filterRowKey(byte[] buffer,
int offset,
int length)
Filters a row based on the row key. |
abstract 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. |
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. |
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. |
abstract byte[] |
toByteArray()
TODO: JAVADOC Concrete implementers can signal a failure condition in their code by throwing an IOException. |
abstract KeyValue |
transform(KeyValue 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 |
| 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(KeyValue) 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(KeyValue 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 KeyValue in question
IOException - in case an I/O or an filter specific failure needs to be signaled.Filter.ReturnCode
public abstract KeyValue transform(KeyValue 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}.
public abstract void filterRow(List<KeyValue> kvs)
throws IOException
IOException.
kvs - the list of keyvalues to be filtered
IOException - in case an I/O or an filter specific failure needs to be signaled.public abstract boolean hasFilterRow()
public abstract boolean filterRow()
throws IOException
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).
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.
public abstract KeyValue getNextKeyHint(KeyValue 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()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||