@InterfaceAudience.Public 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(Cell)
: true means drop this row; false means include.filterCell(Cell)
: decides whether to include or exclude this Cell.
See Filter.ReturnCode
. transformCell(Cell)
: if the Cell is included, let the filter transform the
Cell. 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.
|
Filter.ReturnCode |
filterCell(Cell c)
A way to filter based on the column family, column qualifier and/or the column value.
|
Filter.ReturnCode |
filterKeyValue(Cell c)
Deprecated.
As of release 2.0.0, this will be removed in HBase 3.0.0.
Instead use filterCell(Cell)
|
abstract boolean |
filterRow()
Last chance to veto row based on previous
filterCell(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)
Deprecated.
As of release 2.0.0, this will be removed in HBase 3.0.0.
Instead use
filterRowKey(Cell) |
abstract boolean |
filterRowKey(Cell firstRowCell)
Filters a row based on the row key.
|
abstract Cell |
getNextCellHint(Cell currentCell)
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.
|
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 Cell |
transformCell(Cell v)
Give the filter a chance to transform the passed KeyValue.
|
protected transient boolean reversed
public Filter()
public abstract void reset() throws IOException
IOException
.IOException
- in case an I/O or an filter specific failure needs to be signaled.@Deprecated public abstract boolean filterRowKey(byte[] buffer, int offset, int length) throws IOException
filterRowKey(Cell)
filterCell(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 filterRowKey(Cell firstRowCell) throws IOException
filterCell(Cell)
below.
If filterAllRemaining()
returns true, then filterRowKey(Cell)
should
also return true.
Concrete implementers can signal a failure condition in their code by throwing an
IOException
.firstRowCell
- The first cell coming in the new rowIOException
- 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.@Deprecated public Filter.ReturnCode filterKeyValue(Cell c) 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
.c
- the Cell in questionIOException
- in case an I/O or an filter specific failure needs to be signaled.Filter.ReturnCode
public Filter.ReturnCode filterCell(Cell c) 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
.c
- the Cell in questionIOException
- 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 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}.
public 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
filterCell(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.public abstract Cell getNextCellHint(Cell currentCell) 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 bytes
org.apache.hadoop.hbase.exceptions.DeserializationException
toByteArray()
public void setReversed(boolean reversed)
reversed
- flagpublic boolean isReversed()
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.