@InterfaceAudience.Private public abstract class FilterBase extends Filter
Filter.ReturnCode
Constructor and Description |
---|
FilterBase() |
Modifier and Type | Method and Description |
---|---|
(package private) boolean |
areSerializedFieldsEqual(Filter other)
Default implementation so that writers of custom filters aren't forced to implement.
|
static Filter |
createFilterFromArguments(ArrayList<byte[]> filterArguments)
Given the filter's arguments it constructs the filter
|
boolean |
filterAllRemaining()
Filters that never filter all remaining can inherit this implementation that
never stops the filter early.
|
boolean |
filterRow()
Filters that never filter by rows based on previously gathered state from
Filter.filterCell(Cell) can inherit this implementation that
never filters a row. |
void |
filterRowCells(List<Cell> ignored)
Filters that never filter by modifying the returned List of Cells can
inherit this implementation that does nothing.
|
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) |
boolean |
filterRowKey(Cell cell)
Filters a row based on the row key.
|
Cell |
getNextCellHint(Cell currentCell)
Filters that are not sure which key must be next seeked to, can inherit
this implementation that, by default, returns a null Cell.
|
boolean |
hasFilterRow()
Fitlers that never filter by modifying the returned List of Cells can
inherit this implementation that does nothing.
|
boolean |
isFamilyEssential(byte[] name)
By default, we require all scan's column families to be present.
|
void |
reset()
Filters that are purely stateless and do nothing in their reset() methods can inherit
this null/empty implementation.
|
byte[] |
toByteArray()
Return length 0 byte array for Filters that don't require special serialization
|
String |
toString()
Return filter's info for debugging and logging purpose.
|
Cell |
transformCell(Cell v)
By default no transformation takes place
Give the filter a chance to transform the passed KeyValue.
|
filterCell, filterKeyValue, isReversed, parseFrom, setReversed
public FilterBase()
public void reset() throws IOException
IOException
.reset
in class Filter
IOException
- in case an I/O or an filter specific failure needs to be signaled.@Deprecated public boolean filterRowKey(byte[] buffer, int offset, int length) throws IOException
filterRowKey(Cell)
Filter.filterCell(Cell)
below.
Concrete implementers can signal a failure condition in their code by throwing an
IOException
.filterRowKey
in class Filter
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 boolean filterRowKey(Cell cell) throws IOException
Filter
Filter.filterCell(Cell)
below.
If Filter.filterAllRemaining()
returns true, then Filter.filterRowKey(Cell)
should
also return true.
Concrete implementers can signal a failure condition in their code by throwing an
IOException
.filterRowKey
in class Filter
cell
- The first cell coming in the new rowIOException
- in case an I/O or an filter specific failure needs to be signaled.public boolean filterAllRemaining() throws IOException
IOException
.filterAllRemaining
in class Filter
IOException
- in case an I/O or an filter specific failure needs to be signaled.public Cell transformCell(Cell v) throws IOException
transformCell
in class Filter
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 void filterRowCells(List<Cell> ignored) throws IOException
IOException
.filterRowCells
in class Filter
ignored
- the list of Cells to be filteredIOException
- in case an I/O or an filter specific failure needs to be signaled.public boolean hasFilterRow()
hasFilterRow
in class Filter
public boolean filterRow() throws IOException
Filter.filterCell(Cell)
can inherit this implementation that
never filters a row.
Last chance to veto row based on previous Filter.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
.filterRow
in class Filter
IOException
- in case an I/O or an filter specific failure needs to be signaled.public Cell getNextCellHint(Cell currentCell) throws IOException
IOException
.getNextCellHint
in class Filter
IOException
- in case an I/O or an filter specific failure needs to be signaled.public boolean isFamilyEssential(byte[] name) throws IOException
IOException
.isFamilyEssential
in class Filter
IOException
- in case an I/O or an filter specific failure needs to be signaled.public static Filter createFilterFromArguments(ArrayList<byte[]> filterArguments)
filterArguments
- the filter's argumentspublic byte[] toByteArray() throws IOException
toByteArray
in class Filter
IOException
- in case an I/O or an filter specific failure needs to be signaled.boolean areSerializedFieldsEqual(Filter other)
areSerializedFieldsEqual
in class Filter
other
- Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.