@InterfaceAudience.Public public final class FilterList extends org.apache.hadoop.hbase.filter.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 Cell. 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... filters)
Constructor that takes a var arg number of
Filter s. |
FilterList(FilterList.Operator operator)
Constructor that takes an operator.
|
FilterList(FilterList.Operator operator,
Filter... filters)
Constructor that takes a var arg number of
Filter s and an operator. |
FilterList(FilterList.Operator operator,
List<Filter> filters)
Constructor that takes a set of
Filter s and an operator. |
FilterList(List<Filter> filters)
Constructor that takes a set of
Filter s. |
Modifier and Type | Method and Description |
---|---|
void |
addFilter(Filter filter)
Add a filter.
|
void |
addFilter(List<Filter> filters) |
boolean |
equals(Object obj) |
boolean |
filterAllRemaining()
Filters that never filter all remaining can inherit this implementation that
never stops the filter early.
|
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.
|
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> 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.
|
int |
hashCode() |
boolean |
isFamilyEssential(byte[] name)
By default, we require all scan's column families to be present.
|
boolean |
isReversed() |
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.
|
Cell |
transformCell(Cell c)
By default no transformation takes place
Give the filter a chance to transform the passed KeyValue.
|
public FilterList(FilterList.Operator operator, List<Filter> filters)
Filter
s and an operator.operator
- Operator to process filter set with.filters
- Set of row filters.public FilterList(List<Filter> filters)
Filter
s. The default operator MUST_PASS_ALL is assumed.
All filters are cloned to internal list.filters
- list of filterspublic FilterList(Filter... filters)
Filter
s. The default operator MUST_PASS_ALL
is assumed.filters
- public FilterList(FilterList.Operator operator)
operator
- Operator to process filter set with.public FilterList(FilterList.Operator operator, Filter... filters)
Filter
s and an operator.operator
- Operator to process filter set with.filters
- Filters to usepublic FilterList.Operator getOperator()
public List<Filter> getFilters()
public int size()
public void reset() throws IOException
org.apache.hadoop.hbase.filter.FilterBase
IOException
.reset
in class org.apache.hadoop.hbase.filter.FilterBase
IOException
- 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
org.apache.hadoop.hbase.filter.FilterBase
Filter.filterCell(Cell)
below.
Concrete implementers can signal a failure condition in their code by throwing an
IOException
.filterRowKey
in class org.apache.hadoop.hbase.filter.FilterBase
rowKey
- 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
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 org.apache.hadoop.hbase.filter.FilterBase
firstRowCell
- 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
org.apache.hadoop.hbase.filter.FilterBase
IOException
.filterAllRemaining
in class org.apache.hadoop.hbase.filter.FilterBase
IOException
- in case an I/O or an filter specific failure needs to be signaled.public Cell transformCell(Cell c) throws IOException
org.apache.hadoop.hbase.filter.FilterBase
transformCell
in class org.apache.hadoop.hbase.filter.FilterBase
c
- 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 Filter.ReturnCode filterKeyValue(Cell c) throws IOException
Filter
ReturnCode.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 Filter
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
Filter
ReturnCode.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
.filterCell
in class Filter
c
- the Cell in questionIOException
- in case an I/O or an filter specific failure needs to be signaled.Filter.ReturnCode
public void filterRowCells(List<Cell> cells) throws IOException
IOException
.filterRowCells
in class org.apache.hadoop.hbase.filter.FilterBase
cells
- the list of Cells to be filteredIOException
- in case an I/O or an filter specific failure needs to be signaled.public boolean hasFilterRow()
org.apache.hadoop.hbase.filter.FilterBase
hasFilterRow
in class org.apache.hadoop.hbase.filter.FilterBase
public boolean filterRow() throws IOException
org.apache.hadoop.hbase.filter.FilterBase
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 org.apache.hadoop.hbase.filter.FilterBase
IOException
- in case an I/O or an filter specific failure needs to be signaled.public byte[] toByteArray() throws IOException
org.apache.hadoop.hbase.filter.FilterBase
toByteArray
in class org.apache.hadoop.hbase.filter.FilterBase
IOException
- in case an I/O or an filter specific failure needs to be signaled.public static FilterList parseFrom(byte[] pbBytes) throws org.apache.hadoop.hbase.exceptions.DeserializationException
pbBytes
- A pb serialized FilterList
instanceFilterList
made from bytes
org.apache.hadoop.hbase.exceptions.DeserializationException
toByteArray()
public Cell getNextCellHint(Cell currentCell) throws IOException
org.apache.hadoop.hbase.filter.FilterBase
IOException
.getNextCellHint
in class org.apache.hadoop.hbase.filter.FilterBase
IOException
- in case an I/O or an filter specific failure needs to be signaled.public boolean isFamilyEssential(byte[] name) throws IOException
org.apache.hadoop.hbase.filter.FilterBase
IOException
.isFamilyEssential
in class org.apache.hadoop.hbase.filter.FilterBase
IOException
- in case an I/O or an filter specific failure needs to be signaled.public void setReversed(boolean reversed)
Filter
setReversed
in class Filter
reversed
- flagpublic boolean isReversed()
isReversed
in class Filter
public String toString()
org.apache.hadoop.hbase.filter.FilterBase
toString
in class org.apache.hadoop.hbase.filter.FilterBase
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.