Package org.apache.hadoop.hbase.filter
Class DependentColumnFilter
java.lang.Object
org.apache.hadoop.hbase.filter.Filter
org.apache.hadoop.hbase.filter.FilterBase
org.apache.hadoop.hbase.filter.CompareFilter
org.apache.hadoop.hbase.filter.DependentColumnFilter
A filter for adding inter-column timestamp matching Only cells with a correspondingly timestamped
entry in the target column will be retained Not compatible with Scan.setBatch as operations need
full rows for correct filtering
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.hadoop.hbase.filter.Filter
Filter.ReturnCode
-
Field Summary
Modifier and TypeFieldDescriptionprotected byte[]
protected byte[]
protected boolean
Fields inherited from class org.apache.hadoop.hbase.filter.CompareFilter
comparator, op
-
Constructor Summary
ConstructorDescriptionDependentColumnFilter
(byte[] family, byte[] qualifier) Constructor for DependentColumn filter.DependentColumnFilter
(byte[] family, byte[] qualifier, boolean dropDependentColumn) Constructor for DependentColumn filter.DependentColumnFilter
(byte[] family, byte[] qualifier, boolean dropDependentColumn, CompareOperator op, ByteArrayComparable valueComparator) Build a dependent column filter with value checking dependent column varies will be compared using the supplied compareOp and comparator, for usage of which refer toCompareFilter
-
Method Summary
Modifier and TypeMethodDescription(package private) boolean
Returns true if and only if the fields of the filter that are serialized are equal to the corresponding fields in other.static Filter
createFilterFromArguments
(ArrayList<byte[]> filterArguments) boolean
Returns true if we should drop the dependent column, false otherwiseboolean
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.void
filterRowCells
(List<Cell> kvs) Filters that never filter by modifying the returned List of Cells can inherit this implementation that does nothing.boolean
byte[]
Returns the column familybyte[]
Returns the column qualifierboolean
Filters that never filter by modifying the returned List of Cells can inherit this implementation that does nothing.int
hashCode()
static DependentColumnFilter
parseFrom
(byte[] pbBytes) Parse a seralized representation ofDependentColumnFilter
void
reset()
Filters that are purely stateless and do nothing in their reset() methods can inherit this null/empty implementation.byte[]
Returns The filter serialized using pbtoString()
Return filter's info for debugging and logging purpose.Methods inherited from class org.apache.hadoop.hbase.filter.CompareFilter
compare, compareFamily, compareQualifier, compareRow, compareValue, convert, extractArguments, filterRowKey, getComparator, getCompareOperator
Methods inherited from class org.apache.hadoop.hbase.filter.FilterBase
getNextCellHint, isFamilyEssential, transformCell
Methods inherited from class org.apache.hadoop.hbase.filter.Filter
isReversed, setReversed
-
Field Details
-
columnFamily
-
columnQualifier
-
dropDependentColumn
-
stampSet
-
-
Constructor Details
-
DependentColumnFilter
public DependentColumnFilter(byte[] family, byte[] qualifier, boolean dropDependentColumn, CompareOperator op, ByteArrayComparable valueComparator) Build a dependent column filter with value checking dependent column varies will be compared using the supplied compareOp and comparator, for usage of which refer toCompareFilter
- Parameters:
family
- dependent column familyqualifier
- dependent column qualifierdropDependentColumn
- whether the column should be discarded afterop
- Value comparison opvalueComparator
- comparator
-
DependentColumnFilter
Constructor for DependentColumn filter. Cells where a Cell from target column with the same timestamp do not exist will be dropped.- Parameters:
family
- name of target column familyqualifier
- name of column qualifier
-
DependentColumnFilter
Constructor for DependentColumn filter. Cells where a Cell from target column with the same timestamp do not exist will be dropped.- Parameters:
family
- name of dependent column familyqualifier
- name of dependent qualifierdropDependentColumn
- whether the dependent columns Cells should be discarded
-
-
Method Details
-
getFamily
Returns the column family -
getQualifier
Returns the column qualifier -
dropDependentColumn
Returns true if we should drop the dependent column, false otherwise -
getDropDependentColumn
-
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.
-
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
- See Also:
-
filterRowCells
Description copied from class:FilterBase
Filters that never filter by modifying the returned List of Cells can inherit this implementation that does nothing. Chance to alter the list of Cells to be submitted. Modifications to the list will carry on Concrete implementers can signal a failure condition in their code by throwing anIOException
.- Overrides:
filterRowCells
in classFilterBase
- Parameters:
kvs
- the list of Cells to be filtered
-
hasFilterRow
Description copied from class:FilterBase
Filters that never filter by modifying the returned List of Cells can inherit this implementation that does nothing. Primarily used to check for conflicts with scans(such as scans that do not read a full row at a time).- Overrides:
hasFilterRow
in classFilterBase
- Returns:
- True if this filter actively uses filterRowCells(List) or filterRow().
-
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.
-
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
-
createFilterFromArguments
-
toByteArray
Returns The filter serialized using pb- Overrides:
toByteArray
in classFilterBase
- Returns:
- The filter serialized using pb
-
parseFrom
Parse a seralized representation ofDependentColumnFilter
- Parameters:
pbBytes
- A pb serializedDependentColumnFilter
instance- Returns:
- An instance of
DependentColumnFilter
made frombytes
- Throws:
DeserializationException
- if an error occurred- See Also:
-
areSerializedFieldsEqual
Returns true if and only if the fields of the filter that are serialized are equal to the corresponding fields in other. Used for testing.- Overrides:
areSerializedFieldsEqual
in classCompareFilter
- Returns:
- true if and only if the fields of the filter that are serialized are equal to the corresponding fields in other. Used for testing.
-
toString
Description copied from class:FilterBase
Return filter's info for debugging and logging purpose.- Overrides:
toString
in classCompareFilter
-
equals
- Overrides:
equals
in classCompareFilter
-
hashCode
- Overrides:
hashCode
in classCompareFilter
-