Package org.apache.hadoop.hbase.filter
Class FilterListWithAND
java.lang.Object
org.apache.hadoop.hbase.filter.Filter
org.apache.hadoop.hbase.filter.FilterBase
org.apache.hadoop.hbase.filter.FilterListBase
org.apache.hadoop.hbase.filter.FilterListWithAND
FilterListWithAND represents an ordered list of filters which will be evaluated with an AND
operator.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.hadoop.hbase.filter.Filter
Filter.ReturnCode
-
Field Summary
Fields inherited from class org.apache.hadoop.hbase.filter.FilterListBase
filters, subFiltersIncludedCell
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addFilterLists
(List<Filter> filters) boolean
boolean
Filters that never filter all remaining can inherit this implementation that never stops the filter early.filterCell
(Cell c) A way to filter based on the column family, column qualifier and/or the column value.boolean
Filters that never filter by rows based on previously gathered state fromFilter.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) 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 boolean
private Filter.ReturnCode
mergeReturnCode
(Filter.ReturnCode rc, Filter.ReturnCode localRC) FilterList with MUST_PASS_ALL choose the maximal forward step among sub-filters in filter list.void
reset()
Filters that are purely stateless and do nothing in their reset() methods can inherit this null/empty implementation.Methods inherited from class org.apache.hadoop.hbase.filter.FilterListBase
checkAndGetReversed, compareCell, filterKeyValue, filterRowCells, getFilters, hasFilterRow, isEmpty, isFamilyEssential, isInReturnCodes, setReversed, size, toString, transformCell
Methods inherited from class org.apache.hadoop.hbase.filter.FilterBase
areSerializedFieldsEqual, createFilterFromArguments, toByteArray
Methods inherited from class org.apache.hadoop.hbase.filter.Filter
isReversed, parseFrom
-
Field Details
-
seekHintFilters
-
-
Constructor Details
-
FilterListWithAND
-
-
Method Details
-
addFilterLists
- Specified by:
addFilterLists
in classFilterListBase
-
formatLogFilters
- Specified by:
formatLogFilters
in classFilterListBase
-
mergeReturnCode
FilterList with MUST_PASS_ALL choose the maximal forward step among sub-filters in filter list. Let's call it: The Maximal Step Rule. So if filter-A in filter list return INCLUDE and filter-B in filter list return INCLUDE_AND_NEXT_COL, then the filter list should return INCLUDE_AND_NEXT_COL. For SEEK_NEXT_USING_HINT, it's more special, and in method filterCellWithMustPassAll(), if any sub-filter return SEEK_NEXT_USING_HINT, then our filter list will return SEEK_NEXT_USING_HINT. so we don't care about the SEEK_NEXT_USING_HINT here.
The jump step will be:INCLUDE < SKIP < INCLUDE_AND_NEXT_COL < NEXT_COL < INCLUDE_AND_SEEK_NEXT_ROW < NEXT_ROW < SEEK_NEXT_USING_HINT
Here, we have the following map to describe The Maximal 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 Maximal 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_AND_NEXT_COL INCLUDE_AND_SEEK_NEXT_ROW SKIP NEXT_COL NEXT_ROW SEEK_NEXT_USING_HINT INCLUDE_AND_NEXT_COL INCLUDE_AND_NEXT_COL INCLUDE_AND_NEXT_COL INCLUDE_AND_SEEK_NEXT_ROW NEXT_COL NEXT_COL NEXT_ROW SEEK_NEXT_USING_HINT INCLUDE_AND_SEEK_NEXT_ROW INCLUDE_AND_SEEK_NEXT_ROW INCLUDE_AND_SEEK_NEXT_ROW INCLUDE_AND_SEEK_NEXT_ROW NEXT_ROW NEXT_ROW NEXT_ROW SEEK_NEXT_USING_HINT SKIP SKIP NEXT_COL NEXT_ROW SKIP NEXT_COL NEXT_ROW SEEK_NEXT_USING_HINT NEXT_COL NEXT_COL NEXT_COL NEXT_ROW NEXT_COL NEXT_COL NEXT_ROW SEEK_NEXT_USING_HINT NEXT_ROW NEXT_ROW NEXT_ROW NEXT_ROW NEXT_ROW NEXT_ROW NEXT_ROW SEEK_NEXT_USING_HINT SEEK_NEXT_USING_HINT SEEK_NEXT_USING_HINT SEEK_NEXT_USING_HINT SEEK_NEXT_USING_HINT SEEK_NEXT_USING_HINT SEEK_NEXT_USING_HINT SEEK_NEXT_USING_HINT SEEK_NEXT_USING_HINT
- Parameters:
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.- Returns:
- Return code which is merged by the return code of previous sub-filter(s) and the return code of current sub-filter.
-
isIncludeRelatedReturnCode
-
filterCell
Description copied from class:Filter
A way to filter based on the column family, column qualifier and/or the column value. Return code is described below. This allows filters to filter only certain number of columns, then terminate without matching ever column. If filterRowKey returns true, filterCell needs to be consistent with it. filterCell can assume that filterRowKey has already been called for the row. If your filter returnsReturnCode.NEXT_ROW
, it should returnReturnCode.NEXT_ROW
untilFilter.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 anIOException
.- Overrides:
filterCell
in classFilter
- Parameters:
c
- the Cell in question- Returns:
- code as described below
- Throws:
IOException
- in case an I/O or an filter specific failure needs to be signaled.- See Also:
-
reset
Description copied from class:FilterBase
Filters that are purely stateless and do nothing in their reset() methods can inherit this null/empty implementation. Reset the state of the filter between rows. Concrete implementers can signal a failure condition in their code by throwing anIOException
.- Overrides:
reset
in classFilterBase
- Throws:
IOException
- in case an I/O or an filter specific failure needs to be signaled.
-
filterRowKey
Description copied from class:FilterBase
Filters that do not filter by row key can inherit this implementation that never filters anything. (ie: returns false). Filters a row based on the row key. If this returns true, the entire row will be excluded. If false, each KeyValue in the row will be passed toFilter.filterCell(Cell)
below. Concrete implementers can signal a failure condition in their code by throwing anIOException
.- Overrides:
filterRowKey
in classFilterBase
- Parameters:
rowKey
- buffer containing row keyoffset
- offset into buffer where row key startslength
- length of the row key- Returns:
- true, remove entire row, false, include the row (maybe).
- Throws:
IOException
- in case an I/O or an filter specific failure needs to be signaled.
-
filterRowKey
Description copied from class:Filter
Filters a row based on the row key. If this returns true, the entire row will be excluded. If false, each KeyValue in the row will be passed toFilter.filterCell(Cell)
below. IfFilter.filterAllRemaining()
returns true, thenFilter.filterRowKey(Cell)
should also return true. Concrete implementers can signal a failure condition in their code by throwing anIOException
.- Overrides:
filterRowKey
in classFilterBase
- Parameters:
firstRowCell
- The first cell coming in the new row- Returns:
- true, remove entire row, false, include the row (maybe).
- Throws:
IOException
- in case an I/O or an filter specific failure needs to be signaled.
-
filterAllRemaining
Description copied from class:FilterBase
Filters that never filter all remaining can inherit this implementation that never stops the filter early. If this returns true, the scan will terminate. Concrete implementers can signal a failure condition in their code by throwing anIOException
.- Overrides:
filterAllRemaining
in classFilterBase
- Returns:
- true to end scan, false to continue.
- Throws:
IOException
- in case an I/O or an filter specific failure needs to be signaled.
-
filterRow
Description copied from class:FilterBase
Filters that never filter by rows based on previously gathered state fromFilter.filterCell(Cell)
can inherit this implementation that never filters a row. Last chance to veto row based on previousFilter.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 anIOException
.- Overrides:
filterRow
in classFilterBase
- Returns:
- true to exclude row, false to include row.
- Throws:
IOException
- in case an I/O or an filter specific failure needs to be signaled.
-
getNextCellHint
Description copied from class:FilterBase
Filters that are not sure which key must be next seeked to, can inherit this implementation that, by default, returns a null Cell. 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. After receiving the match code SEEK_NEXT_USING_HINT, the QueryMatcher would call this function to find out which key it must next seek to. Concrete implementers can signal a failure condition in their code by throwing anIOException
.- Overrides:
getNextCellHint
in classFilterBase
- Returns:
- KeyValue which must be next seeked. return null if the filter is not sure which key to seek to next.
- Throws:
IOException
- in case an I/O or an filter specific failure needs to be signaled.
-
equals
-
hashCode
-