@InterfaceAudience.Private public class FilterListWithOR extends FilterListBase
Filter.ReturnCode
Modifier and Type | Field and Description |
---|---|
private List<Cell> |
prevCellList |
private List<Filter.ReturnCode> |
prevFilterRCList
Save previous return code and previous cell for every filter in filter list.
|
filters, subFiltersIncludedCell
Constructor and Description |
---|
FilterListWithOR(List<Filter> filters) |
Modifier and Type | Method and Description |
---|---|
void |
addFilterLists(List<Filter> filters) |
private Filter.ReturnCode |
calculateReturnCodeByPrevCellAndRC(Filter subFilter,
Cell currentCell,
Cell prevCell,
Filter.ReturnCode prevCode)
For MUST_PASS_ONE, we cannot make sure that when filter-A in filter list return NEXT_COL then
the next cell passing to filterList will be the first cell in next column, because if filter-B
in filter list return SKIP, then the filter list will return SKIP.
|
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.
|
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. |
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.
|
protected String |
formatLogFilters(List<Filter> logFilters) |
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.
|
int |
hashCode() |
private Filter.ReturnCode |
mergeReturnCode(Filter.ReturnCode rc,
Filter.ReturnCode localRC)
FilterList with MUST_PASS_ONE choose the minimal forward step among sub-filter in filter list.
|
void |
reset()
Filters that are purely stateless and do nothing in their reset() methods can inherit
this null/empty implementation.
|
private void |
updatePrevCellList(int index,
Cell currentCell,
Filter.ReturnCode currentRC) |
private void |
updatePrevFilterRCList(int index,
Filter.ReturnCode currentRC) |
checkAndGetReversed, compareCell, filterKeyValue, filterRowCells, getFilters, hasFilterRow, isEmpty, isFamilyEssential, isInReturnCodes, setReversed, size, toString, transformCell
areSerializedFieldsEqual, createFilterFromArguments, toByteArray
isReversed, parseFrom
private List<Filter.ReturnCode> prevFilterRCList
private List<Cell> prevCellList
public FilterListWithOR(List<Filter> filters)
public void addFilterLists(List<Filter> filters)
addFilterLists
in class FilterListBase
protected String formatLogFilters(List<Filter> logFilters)
formatLogFilters
in class FilterListBase
private Filter.ReturnCode calculateReturnCodeByPrevCellAndRC(Filter subFilter, Cell currentCell, Cell prevCell, Filter.ReturnCode prevCode) throws IOException
subFilter
- which sub-filter to calculate the return code by using previous cell and
previous return code.prevCell
- the previous cell passed to given sub-filter.currentCell
- the current cell which will pass to given sub-filter.prevCode
- the previous return code for given sub-filter.IOException
Filter.ReturnCode
private Filter.ReturnCode mergeReturnCode(Filter.ReturnCode rc, Filter.ReturnCode localRC)
INCLUDE < SKIP < INCLUDE_AND_NEXT_COL < NEXT_COL < INCLUDE_AND_SEEK_NEXT_ROW < NEXT_ROW < SEEK_NEXT_USING_HINTHere, we have the following map to describe The Minimal Step Rule. if current return code (for previous sub-filters in filter list) is ReturnCode, and current filter returns localRC, then we should return map[ReturnCode][localRC] for the merged result, according to The Minimal Step Rule.
LocalCode\ReturnCode INCLUDE INCLUDE_AND_NEXT_COL INCLUDE_AND_SEEK_NEXT_ROW SKIP NEXT_COL NEXT_ROW SEEK_NEXT_USING_HINT INCLUDE INCLUDE INCLUDE INCLUDE INCLUDE INCLUDE INCLUDE INCLUDE INCLUDE_AND_NEXT_COL INCLUDE INCLUDE_AND_NEXT_COL INCLUDE_AND_NEXT_COL INCLUDE INCLUDE_AND_NEXT_COL INCLUDE_AND_NEXT_COL INCLUDE INCLUDE_AND_SEEK_NEXT_ROW INCLUDE INCLUDE_AND_NEXT_COL INCLUDE_AND_SEEK_NEXT_ROW INCLUDE INCLUDE_AND_NEXT_COL INCLUDE_AND_SEEK_NEXT_ROW INCLUDE SKIP INCLUDE INCLUDE INCLUDE SKIP SKIP SKIP SKIP NEXT_COL INCLUDE INCLUDE_AND_NEXT_COL INCLUDE_AND_NEXT_COL SKIP NEXT_COL NEXT_COL SKIP NEXT_ROW INCLUDE INCLUDE_AND_NEXT_COL INCLUDE_AND_SEEK_NEXT_ROW SKIP NEXT_COL NEXT_ROW SKIP SEEK_NEXT_USING_HINT INCLUDE INCLUDE INCLUDE SKIP SKIP SKIP SEEK_NEXT_USING_HINT
rc
- Return code which is calculated by previous sub-filter(s) in filter list.localRC
- Return code of the current sub-filter in filter list.private void updatePrevFilterRCList(int index, Filter.ReturnCode currentRC)
private void updatePrevCellList(int index, Cell currentCell, Filter.ReturnCode currentRC)
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 reset() throws IOException
FilterBase
IOException
.reset
in class 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
FilterBase
Filter.filterCell(Cell)
below.
Concrete implementers can signal a failure condition in their code by throwing an
IOException
.filterRowKey
in class 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 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
FilterBase
IOException
.filterAllRemaining
in class FilterBase
IOException
- in case an I/O or an filter specific failure needs to be signaled.public boolean filterRow() throws IOException
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 FilterBase
IOException
- in case an I/O or an filter specific failure needs to be signaled.public Cell getNextCellHint(Cell currentCell) throws IOException
FilterBase
IOException
.getNextCellHint
in class FilterBase
IOException
- in case an I/O or an filter specific failure needs to be signaled.Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.