Package org.apache.hadoop.hbase.filter
Class SubstringComparator
java.lang.Object
org.apache.hadoop.hbase.filter.ByteArrayComparable
org.apache.hadoop.hbase.filter.SubstringComparator
- All Implemented Interfaces:
Comparable<byte[]>
This comparator is for use with SingleColumnValueFilter, for filtering based on the value of a
given column. Use it to test if a given substring appears in a cell value in the column. The
comparison is case insensitive.
Only EQUAL or NOT_EQUAL tests are valid with this comparator.
For example:
SingleColumnValueFilter scvf =
new SingleColumnValueFilter("col", CompareOp.EQUAL, new SubstringComparator("substr"));
-
Field Summary
FieldsFields inherited from class org.apache.hadoop.hbase.filter.ByteArrayComparable
value -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) booleanReturns true if and only if the fields of the comparator that are serialized are equal to the corresponding fields in other.intcompareTo(byte[] value, int offset, int length) Special compareTo method for subclasses, to avoid copying byte[] unnecessarily.byte[]getValue()static SubstringComparatorparseFrom(byte[] pbBytes) Parse a serialized representation ofSubstringComparatorbyte[]Returns The comparator serialized using pbMethods inherited from class org.apache.hadoop.hbase.filter.ByteArrayComparable
compareTo, compareTo
-
Field Details
-
substr
-
-
Constructor Details
-
SubstringComparator
Constructor- Parameters:
substr- the substring
-
-
Method Details
-
getValue
- Overrides:
getValuein classByteArrayComparable
-
compareTo
Description copied from class:ByteArrayComparableSpecial compareTo method for subclasses, to avoid copying byte[] unnecessarily.- Specified by:
compareToin classByteArrayComparable- Parameters:
value- byte[] to compareoffset- offset into valuelength- number of bytes to compare- Returns:
- a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
-
toByteArray
Returns The comparator serialized using pb- Specified by:
toByteArrayin classByteArrayComparable
-
parseFrom
Parse a serialized representation ofSubstringComparator- Parameters:
pbBytes- A pb serializedSubstringComparatorinstance- Returns:
- An instance of
SubstringComparatormade frombytes - Throws:
DeserializationException- if an error occurred- See Also:
-
areSerializedFieldsEqual
Returns true if and only if the fields of the comparator that are serialized are equal to the corresponding fields in other. Used for testing.- Overrides:
areSerializedFieldsEqualin classByteArrayComparable
-