org.apache.hadoop.hbase.filter
Class SubstringComparator

java.lang.Object
  extended by org.apache.hadoop.hbase.filter.WritableByteArrayComparable
      extended by org.apache.hadoop.hbase.filter.SubstringComparator
All Implemented Interfaces:
Comparable<byte[]>, org.apache.hadoop.io.Writable

public class SubstringComparator
extends WritableByteArrayComparable

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"));
 


Constructor Summary
SubstringComparator()
          Nullary constructor for Writable, do not use
SubstringComparator(String substr)
          Constructor
 
Method Summary
 int compareTo(byte[] value, int offset, int length)
          Special compareTo method for subclasses, to avoid copying byte[] unnecessarily.
 byte[] getValue()
           
 void readFields(DataInput in)
           
 void write(DataOutput out)
           
 
Methods inherited from class org.apache.hadoop.hbase.filter.WritableByteArrayComparable
compareTo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SubstringComparator

public SubstringComparator()
Nullary constructor for Writable, do not use


SubstringComparator

public SubstringComparator(String substr)
Constructor

Parameters:
substr - the substring
Method Detail

getValue

public byte[] getValue()
Overrides:
getValue in class WritableByteArrayComparable

compareTo

public int compareTo(byte[] value,
                     int offset,
                     int length)
Description copied from class: WritableByteArrayComparable
Special compareTo method for subclasses, to avoid copying byte[] unnecessarily.

Specified by:
compareTo in class WritableByteArrayComparable
Parameters:
value - byte[] to compare
offset - offset into value
length - 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.

readFields

public void readFields(DataInput in)
                throws IOException
Specified by:
readFields in interface org.apache.hadoop.io.Writable
Overrides:
readFields in class WritableByteArrayComparable
Throws:
IOException

write

public void write(DataOutput out)
           throws IOException
Specified by:
write in interface org.apache.hadoop.io.Writable
Overrides:
write in class WritableByteArrayComparable
Throws:
IOException


Copyright © 2015 The Apache Software Foundation. All Rights Reserved.