@InterfaceAudience.Public @InterfaceStability.Stable public abstract class Filter extends Object
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| Modifier and Type | Class and Description |
|---|---|
static class |
Filter.ReturnCode
Return codes for filterValue().
|
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
reversed |
| Constructor and Description |
|---|
Filter() |
| Modifier and Type | Method and Description |
|---|---|
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 |
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 org.apache.hadoop.hbase.KeyValue |
getNextKeyHint(org.apache.hadoop.hbase.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 org.apache.hadoop.hbase.KeyValue |
transform(org.apache.hadoop.hbase.KeyValue currentKV)
Deprecated.
|
abstract Cell |
transformCell(Cell v)
Give the filter a chance to transform the passed KeyValue.
|
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 keyIOException - 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 questionIOException - in case an I/O or an filter specific failure needs to be signaled.Filter.ReturnCodepublic abstract Cell transformCell(Cell v) throws IOException
v - the KeyValue in questionIOException - 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 org.apache.hadoop.hbase.KeyValue transform(org.apache.hadoop.hbase.KeyValue currentKV) throws IOException
transformCell(Cell).
This is for transition from 0.94 -> 0.96IOExceptionpublic abstract void filterRowCells(List<Cell> kvs) throws IOException
IOException.kvs - the list of Cells to be filteredIOException - 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(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 org.apache.hadoop.hbase.KeyValue getNextKeyHint(org.apache.hadoop.hbase.KeyValue currentKV) throws IOException
currentKV - IOException - Function is Deprecated. Use getNextCellHint(Cell) instead.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 org.apache.hadoop.hbase.exceptions.DeserializationException
IOException.pbBytes - A pb serialized Filter instanceFilter made from bytesorg.apache.hadoop.hbase.exceptions.DeserializationExceptiontoByteArray()public void setReversed(boolean reversed)
reversed - flagpublic boolean isReversed()
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.