Package org.apache.hadoop.hbase.filter
Class CompareFilter
java.lang.Object
org.apache.hadoop.hbase.filter.Filter
org.apache.hadoop.hbase.filter.FilterBase
org.apache.hadoop.hbase.filter.CompareFilter
- Direct Known Subclasses:
DependentColumnFilter
,FamilyFilter
,QualifierFilter
,RowFilter
,ValueFilter
This is a generic filter to be used to filter by comparison. It takes an operator (equal,
greater, not equal, etc) and a byte [] comparator.
To filter by row key, use RowFilter
.
To filter by column family, use FamilyFilter
.
To filter by column qualifier, use QualifierFilter
.
To filter by value, use ValueFilter
.
These filters can be wrapped with SkipFilter
and WhileMatchFilter
to add more
control.
Multiple filters can be combined using FilterList
.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.hadoop.hbase.filter.Filter
Filter.ReturnCode
-
Field Summary
-
Constructor Summary
ConstructorDescriptionCompareFilter
(CompareOperator op, ByteArrayComparable comparator) Constructor. -
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.(package private) static boolean
compare
(CompareOperator op, int compareResult) protected boolean
compareFamily
(CompareOperator op, ByteArrayComparable comparator, Cell cell) protected boolean
compareQualifier
(CompareOperator op, ByteArrayComparable comparator, Cell cell) protected boolean
compareRow
(CompareOperator op, ByteArrayComparable comparator, Cell cell) protected boolean
compareValue
(CompareOperator op, ByteArrayComparable comparator, Cell cell) (package private) org.apache.hadoop.hbase.shaded.protobuf.generated.FilterProtos.CompareFilter
convert()
Returns A pb instance to represent this instance.boolean
extractArguments
(ArrayList<byte[]> filterArguments) Returns an array of heterogeneous objectsboolean
filterRowKey
(Cell cell) Filters a row based on the row key.Returns the comparatorint
hashCode()
toString()
Return filter's info for debugging and logging purpose.Methods inherited from class org.apache.hadoop.hbase.filter.FilterBase
createFilterFromArguments, filterAllRemaining, filterRow, filterRowCells, getNextCellHint, hasFilterRow, isFamilyEssential, reset, toByteArray, transformCell
Methods inherited from class org.apache.hadoop.hbase.filter.Filter
filterCell, isReversed, parseFrom, setReversed
-
Field Details
-
op
-
comparator
-
-
Constructor Details
-
CompareFilter
Constructor.- Parameters:
op
- the compare op for row matchingcomparator
- the comparator for row matching
-
-
Method Details
-
getCompareOperator
-
getComparator
Returns the comparator -
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:
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.
-
compareRow
-
compareFamily
-
compareQualifier
-
compareValue
-
compare
-
extractArguments
Returns an array of heterogeneous objects -
convert
org.apache.hadoop.hbase.shaded.protobuf.generated.FilterProtos.CompareFilter convert()Returns A pb instance to represent this instance. -
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 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.
-
toString
Description copied from class:FilterBase
Return filter's info for debugging and logging purpose.- Overrides:
toString
in classFilterBase
-
equals
-
hashCode
-