org.apache.hadoop.hbase.filter
Class CompareFilter

java.lang.Object
  extended by org.apache.hadoop.hbase.filter.FilterBase
      extended by org.apache.hadoop.hbase.filter.CompareFilter
All Implemented Interfaces:
Filter, org.apache.hadoop.io.Writable
Direct Known Subclasses:
DependentColumnFilter, FamilyFilter, QualifierFilter, RowFilter, ValueFilter

public abstract class CompareFilter
extends FilterBase

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 qualifier, use QualifierFilter.

To filter by value, use SingleColumnValueFilter.

These filters can be wrapped with SkipFilter and WhileMatchFilter to add more control.

Multiple filters can be combined using FilterList.


Nested Class Summary
static class CompareFilter.CompareOp
          Comparison operators.
 
Nested classes/interfaces inherited from interface org.apache.hadoop.hbase.filter.Filter
Filter.ReturnCode
 
Field Summary
protected  WritableByteArrayComparable comparator
           
protected  CompareFilter.CompareOp compareOp
           
 
Constructor Summary
CompareFilter()
          Writable constructor, do not use.
CompareFilter(CompareFilter.CompareOp compareOp, WritableByteArrayComparable comparator)
          Constructor.
 
Method Summary
protected  boolean doCompare(CompareFilter.CompareOp compareOp, WritableByteArrayComparable comparator, byte[] data, int offset, int length)
           
static ArrayList extractArguments(ArrayList<byte[]> filterArguments)
           
 WritableByteArrayComparable getComparator()
           
 CompareFilter.CompareOp getOperator()
           
 void readFields(DataInput in)
           
 String toString()
          Return filter's info for debugging and logging purpose.
 void write(DataOutput out)
           
 
Methods inherited from class org.apache.hadoop.hbase.filter.FilterBase
createFilterFromArguments, filterAllRemaining, filterKeyValue, filterRow, filterRow, filterRowKey, getNextKeyHint, hasFilterRow, reset, transform
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

compareOp

protected CompareFilter.CompareOp compareOp

comparator

protected WritableByteArrayComparable comparator
Constructor Detail

CompareFilter

public CompareFilter()
Writable constructor, do not use.


CompareFilter

public CompareFilter(CompareFilter.CompareOp compareOp,
                     WritableByteArrayComparable comparator)
Constructor.

Parameters:
compareOp - the compare op for row matching
comparator - the comparator for row matching
Method Detail

getOperator

public CompareFilter.CompareOp getOperator()
Returns:
operator

getComparator

public WritableByteArrayComparable getComparator()
Returns:
the comparator

doCompare

protected boolean doCompare(CompareFilter.CompareOp compareOp,
                            WritableByteArrayComparable comparator,
                            byte[] data,
                            int offset,
                            int length)

extractArguments

public static ArrayList extractArguments(ArrayList<byte[]> filterArguments)

readFields

public void readFields(DataInput in)
                throws IOException
Throws:
IOException

write

public void write(DataOutput out)
           throws IOException
Throws:
IOException

toString

public String toString()
Description copied from class: FilterBase
Return filter's info for debugging and logging purpose.

Overrides:
toString in class FilterBase


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