org.apache.hadoop.hbase.filter
Class ColumnRangeFilter

java.lang.Object
  extended by org.apache.hadoop.hbase.filter.Filter
      extended by org.apache.hadoop.hbase.filter.FilterBase
          extended by org.apache.hadoop.hbase.filter.ColumnRangeFilter

@InterfaceAudience.Public
@InterfaceStability.Stable
public class ColumnRangeFilter
extends FilterBase

This filter is used for selecting only those keys with columns that are between minColumn to maxColumn. For example, if minColumn is 'an', and maxColumn is 'be', it will pass keys with columns like 'ana', 'bad', but not keys with columns like 'bed', 'eye' If minColumn is null, there is no lower bound. If maxColumn is null, there is no upper bound. minColumnInclusive and maxColumnInclusive specify if the ranges are inclusive or not.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.hadoop.hbase.filter.Filter
Filter.ReturnCode
 
Field Summary
protected  byte[] maxColumn
           
protected  boolean maxColumnInclusive
           
protected  byte[] minColumn
           
protected  boolean minColumnInclusive
           
 
Constructor Summary
ColumnRangeFilter(byte[] minColumn, boolean minColumnInclusive, byte[] maxColumn, boolean maxColumnInclusive)
          Create a filter to select those keys with columns that are between minColumn and maxColumn.
 
Method Summary
static Filter createFilterFromArguments(ArrayList<byte[]> filterArguments)
           
 Filter.ReturnCode filterKeyValue(KeyValue kv)
          Filters that dont filter by key value can inherit this implementation that includes all KeyValues.
 byte[] getMaxColumn()
           
 boolean getMaxColumnInclusive()
           
 byte[] getMinColumn()
           
 boolean getMinColumnInclusive()
           
 KeyValue getNextKeyHint(KeyValue kv)
          Filters that are not sure which key must be next seeked to, can inherit this implementation that, by default, returns a null KeyValue.
 boolean isMaxColumnInclusive()
           
 boolean isMinColumnInclusive()
           
static ColumnRangeFilter parseFrom(byte[] pbBytes)
           
 byte[] toByteArray()
          Return length 0 byte array for Filters that don't require special serialization
 String toString()
          Return filter's info for debugging and logging purpose.
 
Methods inherited from class org.apache.hadoop.hbase.filter.FilterBase
filterAllRemaining, filterRow, filterRow, filterRowKey, hasFilterRow, isFamilyEssential, reset, transform
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

minColumn

protected byte[] minColumn

minColumnInclusive

protected boolean minColumnInclusive

maxColumn

protected byte[] maxColumn

maxColumnInclusive

protected boolean maxColumnInclusive
Constructor Detail

ColumnRangeFilter

public ColumnRangeFilter(byte[] minColumn,
                         boolean minColumnInclusive,
                         byte[] maxColumn,
                         boolean maxColumnInclusive)
Create a filter to select those keys with columns that are between minColumn and maxColumn.

Parameters:
minColumn - minimum value for the column range. If if it's null, there is no lower bound.
minColumnInclusive - if true, include minColumn in the range.
maxColumn - maximum value for the column range. If it's null,
maxColumnInclusive - if true, include maxColumn in the range. there is no upper bound.
Method Detail

isMinColumnInclusive

public boolean isMinColumnInclusive()
Returns:
if min column range is inclusive.

isMaxColumnInclusive

public boolean isMaxColumnInclusive()
Returns:
if max column range is inclusive.

getMinColumn

public byte[] getMinColumn()
Returns:
the min column range for the filter

getMinColumnInclusive

public boolean getMinColumnInclusive()
Returns:
true if min column is inclusive, false otherwise

getMaxColumn

public byte[] getMaxColumn()
Returns:
the max column range for the filter

getMaxColumnInclusive

public boolean getMaxColumnInclusive()
Returns:
true if max column is inclusive, false otherwise

filterKeyValue

public Filter.ReturnCode filterKeyValue(KeyValue kv)
Description copied from class: FilterBase
Filters that dont filter by key value can inherit this implementation that includes all KeyValues.

Overrides:
filterKeyValue in class FilterBase
Parameters:
kv - the KeyValue in question
Returns:
code as described below
See Also:
Filter.ReturnCode

createFilterFromArguments

public static Filter createFilterFromArguments(ArrayList<byte[]> filterArguments)

toByteArray

public byte[] toByteArray()
Description copied from class: FilterBase
Return length 0 byte array for Filters that don't require special serialization

Overrides:
toByteArray in class FilterBase
Returns:
The filter serialized using pb

parseFrom

public static ColumnRangeFilter parseFrom(byte[] pbBytes)
                                   throws DeserializationException
Parameters:
pbBytes - A pb serialized ColumnRangeFilter instance
Returns:
An instance of ColumnRangeFilter made from bytes
Throws:
DeserializationException
See Also:
toByteArray()

getNextKeyHint

public KeyValue getNextKeyHint(KeyValue kv)
Description copied from class: FilterBase
Filters that are not sure which key must be next seeked to, can inherit this implementation that, by default, returns a null KeyValue.

Overrides:
getNextKeyHint in class FilterBase
Returns:
KeyValue which must be next seeked. return null if the filter is not sure which key to seek to next.

toString

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

Overrides:
toString in class FilterBase


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