@InterfaceAudience.Public public final class FilterList extends FilterBase
Filter that represents an ordered List of Filters
which will be evaluated with a specified boolean operator FilterList.Operator.MUST_PASS_ALL
(AND) or FilterList.Operator.MUST_PASS_ONE (OR).
Since you can use Filter Lists as children of Filter Lists, you can create a
hierarchy of filters to be evaluated.
FilterList.Operator.MUST_PASS_ALL evaluates lazily: evaluation stops as soon as one filter does
not include the KeyValue.
FilterList.Operator.MUST_PASS_ONE evaluates non-lazily: all filters are always evaluated.
FilterList.Operator.MUST_PASS_ALL.| Modifier and Type | Class and Description |
|---|---|
static class |
FilterList.Operator
set operator
|
Filter.ReturnCode| Constructor and Description |
|---|
FilterList(Filter... rowFilters)
Constructor that takes a var arg number of
Filters. |
FilterList(FilterList.Operator operator)
Constructor that takes an operator.
|
FilterList(FilterList.Operator operator,
Filter... rowFilters)
Constructor that takes a var arg number of
Filters and an operator. |
FilterList(FilterList.Operator operator,
List<Filter> rowFilters)
Constructor that takes a set of
Filters and an operator. |
FilterList(List<Filter> rowFilters)
Constructor that takes a set of
Filters. |
| Modifier and Type | Method and Description |
|---|---|
void |
addFilter(Filter filter)
Add a filter.
|
void |
addFilter(List<Filter> filters) |
boolean |
filterAllRemaining()
Filters that never filter all remaining can inherit this implementation that
never stops the filter early.
|
Filter.ReturnCode |
filterKeyValue(Cell c)
A way to filter based on the column family, column qualifier and/or the column value.
|
boolean |
filterRow()
Filters that never filter by rows based on previously gathered state from
Filter.filterKeyValue(Cell) can inherit this implementation that
never filters a row. |
void |
filterRowCells(List<Cell> cells)
Filters that never filter by modifying the returned List of Cells can
inherit this implementation that does nothing.
|
boolean |
filterRowKey(byte[] rowKey,
int offset,
int length)
Filters that do not filter by row key can inherit this implementation that
never filters anything.
|
boolean |
filterRowKey(Cell firstRowCell)
Filters a row based on the row key.
|
List<Filter> |
getFilters()
Get the filters.
|
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.
|
FilterList.Operator |
getOperator()
Get the operator.
|
boolean |
hasFilterRow()
Fitlers that never filter by modifying the returned List of Cells can
inherit this implementation that does nothing.
|
void |
initPrevListForMustPassOne(int size) |
boolean |
isFamilyEssential(byte[] name)
By default, we require all scan's column families to be present.
|
static FilterList |
parseFrom(byte[] pbBytes) |
void |
reset()
Filters that are purely stateless and do nothing in their reset() methods can inherit
this null/empty implementation.
|
void |
setReversed(boolean reversed)
alter the reversed scan flag
|
int |
size() |
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.
|
protected String |
toString(int maxFilters) |
Cell |
transformCell(Cell c)
By default no transformation takes place
Give the filter a chance to transform the passed KeyValue.
|
createFilterFromArgumentsisReversedpublic FilterList(List<Filter> rowFilters)
Filters. The default operator
MUST_PASS_ALL is assumed.
All filters are cloned to internal list.rowFilters - list of filterspublic FilterList(Filter... rowFilters)
Filters. The fefault operator
MUST_PASS_ALL is assumed.rowFilters - public FilterList(FilterList.Operator operator)
operator - Operator to process filter set with.public FilterList(FilterList.Operator operator, List<Filter> rowFilters)
Filters and an operator.operator - Operator to process filter set with.rowFilters - Set of row filters.public FilterList(FilterList.Operator operator, Filter... rowFilters)
Filters and an operator.operator - Operator to process filter set with.rowFilters - Filters to usepublic void initPrevListForMustPassOne(int size)
public FilterList.Operator getOperator()
public int size()
public void addFilter(Filter filter)
filter - another filterpublic void reset()
throws IOException
FilterBaseIOException.reset in class FilterBaseIOException - in case an I/O or an filter specific failure needs to be signaled.public boolean filterRowKey(byte[] rowKey,
int offset,
int length)
throws IOException
FilterBaseFilter.filterKeyValue(Cell) below.
Concrete implementers can signal a failure condition in their code by throwing an
IOException.filterRowKey in class FilterBaserowKey - 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 firstRowCell) throws IOException
FilterFilter.filterKeyValue(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 FilterBasefirstRowCell - 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
FilterBaseIOException.filterAllRemaining in class FilterBaseIOException - in case an I/O or an filter specific failure needs to be signaled.public Cell transformCell(Cell c) throws IOException
FilterBasetransformCell in class FilterBasec - 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 Filter.ReturnCode filterKeyValue(Cell c) throws IOException
FilterReturnCode.NEXT_ROW, it should return
ReturnCode.NEXT_ROW until Filter.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.filterKeyValue in class Filterc - the Cell in questionIOException - in case an I/O or an filter specific failure needs to be signaled.Filter.ReturnCodepublic void filterRowCells(List<Cell> cells) throws IOException
IOException.filterRowCells in class FilterBasecells - the list of Cells to be filteredIOException - in case an I/O or an filter specific failure needs to be signaled.public boolean hasFilterRow()
FilterBasehasFilterRow in class FilterBasepublic boolean filterRow()
throws IOException
FilterBaseFilter.filterKeyValue(Cell) can inherit this implementation that
never filters a row.
Last chance to veto row based on previous Filter.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.filterRow in class FilterBaseIOException - in case an I/O or an filter specific failure needs to be signaled.public byte[] toByteArray()
throws IOException
FilterBasetoByteArray in class FilterBaseIOException - in case an I/O or an filter specific failure needs to be signaled.public static FilterList parseFrom(byte[] pbBytes) throws DeserializationException
pbBytes - A pb serialized FilterList instanceFilterList made from bytesDeserializationExceptiontoByteArray()public Cell getNextCellHint(Cell currentCell) throws IOException
FilterBaseIOException.getNextCellHint in class FilterBaseIOException - in case an I/O or an filter specific failure needs to be signaled.public boolean isFamilyEssential(byte[] name)
throws IOException
FilterBaseIOException.isFamilyEssential in class FilterBaseIOException - in case an I/O or an filter specific failure needs to be signaled.public void setReversed(boolean reversed)
FiltersetReversed in class Filterreversed - flagpublic String toString()
FilterBasetoString in class FilterBaseprotected String toString(int maxFilters)
Copyright © 2007–2017 The Apache Software Foundation. All rights reserved.