public class HBaseIntegerComparator
extends org.apache.hadoop.hbase.filter.ByteArrayComparable
To use with HBase it must reside in the classpath of every region server.
It converts a value into Long before comparing.
The filter is good for any integer numeric comparison i.e. integer, bigint, smallint.
according to HBase 0.96 requirements, this must serialized using Protocol Buffers
(toByteArray() and parseFrom(byte[]) methods).
A reference can be found in SubstringComparator.
| Constructor and Description |
|---|
HBaseIntegerComparator(java.lang.Long inVal) |
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(byte[] value,
int offset,
int length)
The comparison function.
|
static org.apache.hadoop.hbase.filter.ByteArrayComparable |
parseFrom(byte[] pbBytes)
Hides ("overrides") a static method in
ByteArrayComparable. |
byte[] |
toByteArray()
Returns the comparator serialized using Protocol Buffers.
|
public int compareTo(byte[] value,
int offset,
int length)
Long.parseLong(String).compareTo in class org.apache.hadoop.hbase.filter.ByteArrayComparablepublic byte[] toByteArray()
toByteArray in class org.apache.hadoop.hbase.filter.ByteArrayComparablepublic static org.apache.hadoop.hbase.filter.ByteArrayComparable parseFrom(byte[] pbBytes)
throws org.apache.hadoop.hbase.exceptions.DeserializationException
ByteArrayComparable.
This method will be called in deserialization.pbBytes - A pb serialized instanceHBaseIntegerComparator made from
bytesorg.apache.hadoop.hbase.exceptions.DeserializationException - if deserialization of bytes to Protocol Buffers failedtoByteArray()