Package org.apache.hadoop.hbase.filter
Class ColumnValueFilter
java.lang.Object
org.apache.hadoop.hbase.filter.Filter
org.apache.hadoop.hbase.filter.FilterBase
org.apache.hadoop.hbase.filter.ColumnValueFilter
Different from
SingleColumnValueFilter which returns an entire row when specified
condition is matched, ColumnValueFilter return the matched cell only.
This filter is used to filter cells based on column and value. It takes a
CompareOperator operator (<, <=, =, !=, >, >=), and and a
ByteArrayComparable comparator.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.hadoop.hbase.filter.Filter
Filter.ReturnCode -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate final ByteArrayComparableprivate final byte[]private final CompareOperatorprivate final byte[] -
Constructor Summary
ConstructorsConstructorDescriptionColumnValueFilter(byte[] family, byte[] qualifier, CompareOperator op, byte[] value) ColumnValueFilter(byte[] family, byte[] qualifier, CompareOperator op, ByteArrayComparable comparator) -
Method Summary
Modifier and TypeMethodDescription(package private) booleanReturns true if and only if the fields of the filter that are serialized are equal to the corresponding fields in other.private booleancompareValue(CompareOperator op, ByteArrayComparable comparator, Cell cell) This method is used to determine a cell should be included or filtered out.(package private) org.apache.hadoop.hbase.shaded.protobuf.generated.FilterProtos.ColumnValueFilterconvert()Returns A pb instance to represent this instance.static FiltercreateFilterFromArguments(ArrayList<byte[]> filterArguments) Creating this filter by reflection, it is used byParseFilter,booleanfilterCell(Cell c) A way to filter based on the column family, column qualifier and/or the column value.booleanfilterRowKey(Cell cell) Filters a row based on the row key.Returns the comparatorReturns operatorbyte[]Returns the column familybyte[]Returns the qualifierinthashCode()booleanisFamilyEssential(byte[] name) By default, we require all scan's column families to be present.static ColumnValueFilterparseFrom(byte[] pbBytes) Parse a serialized representation ofColumnValueFiltervoidreset()Filters that are purely stateless and do nothing in their reset() methods can inherit this null/empty implementation.byte[]Return length 0 byte array for Filters that don't require special serializationtoString()Return filter's info for debugging and logging purpose.Methods inherited from class org.apache.hadoop.hbase.filter.FilterBase
filterAllRemaining, filterRow, filterRowCells, getNextCellHint, hasFilterRow, transformCellMethods inherited from class org.apache.hadoop.hbase.filter.Filter
isReversed, setReversed
-
Field Details
-
family
-
qualifier
-
op
-
comparator
-
columnFound
-
-
Constructor Details
-
ColumnValueFilter
-
ColumnValueFilter
public ColumnValueFilter(byte[] family, byte[] qualifier, CompareOperator op, ByteArrayComparable comparator)
-
-
Method Details
-
getCompareOperator
Returns operator -
getComparator
Returns the comparator -
getFamily
Returns the column family -
getQualifier
Returns the qualifier -
reset
Description copied from class:FilterBaseFilters 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:
resetin classFilterBase- Throws:
IOException- in case an I/O or an filter specific failure needs to be signaled.
-
filterRowKey
Description copied from class:FilterFilters 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:
filterRowKeyin classFilterBase- Parameters:
cell- 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.
-
filterCell
Description copied from class:FilterA 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_ROWuntilFilter.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:
filterCellin 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:
-
compareValue
This method is used to determine a cell should be included or filtered out.- Parameters:
op- one of operatorsCompareOperatorcomparator- comparator used to compare cells.cell- cell to be compared.- Returns:
- true means cell should be filtered out, included otherwise.
-
createFilterFromArguments
Creating this filter by reflection, it is used byParseFilter,- Parameters:
filterArguments- arguments for creating a ColumnValueFilter- Returns:
- a ColumnValueFilter
-
convert
org.apache.hadoop.hbase.shaded.protobuf.generated.FilterProtos.ColumnValueFilter convert()Returns A pb instance to represent this instance. -
parseFrom
Parse a serialized representation ofColumnValueFilter- Parameters:
pbBytes- A pb serializedColumnValueFilterinstance- Returns:
- An instance of
ColumnValueFiltermade frombytes - Throws:
DeserializationException- if an error occurred- See Also:
-
toByteArray
Description copied from class:FilterBaseReturn length 0 byte array for Filters that don't require special serialization- Overrides:
toByteArrayin classFilterBase- Returns:
- The filter serialized using pb
- Throws:
IOException- in case an I/O or an filter specific failure needs to be signaled.
-
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:
areSerializedFieldsEqualin classFilterBase- 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.
-
isFamilyEssential
Description copied from class:FilterBaseBy default, we require all scan's column families to be present. Our subclasses may be more precise. Check that given column family is essential for filter to check row. Most filters always return true here. But some could have more sophisticated logic which could significantly reduce scanning process by not even touching columns until we are 100% sure that it's data is needed in result. Concrete implementers can signal a failure condition in their code by throwing anIOException.- Overrides:
isFamilyEssentialin classFilterBase- Throws:
IOException- in case an I/O or an filter specific failure needs to be signaled.
-
toString
Description copied from class:FilterBaseReturn filter's info for debugging and logging purpose.- Overrides:
toStringin classFilterBase
-
equals
-
hashCode
-