org.apache.hadoop.hbase.filter
Class ColumnPrefixFilter

java.lang.Object
  extended by org.apache.hadoop.hbase.filter.FilterBase
      extended by org.apache.hadoop.hbase.filter.ColumnPrefixFilter
All Implemented Interfaces:
Filter, org.apache.hadoop.io.Writable

public class ColumnPrefixFilter
extends FilterBase

This filter is used for selecting only those keys with columns that matches a particular prefix. For example, if prefix is 'an', it will pass keys will columns like 'and', 'anti' but not keys with columns like 'ball', 'act'.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.hadoop.hbase.filter.Filter
Filter.ReturnCode
 
Field Summary
protected  byte[] prefix
           
 
Constructor Summary
ColumnPrefixFilter()
           
ColumnPrefixFilter(byte[] prefix)
           
 
Method Summary
 Filter.ReturnCode filterColumn(byte[] buffer, int qualifierOffset, int qualifierLength)
           
 Filter.ReturnCode filterKeyValue(KeyValue kv)
          Filters that dont filter by key value can inherit this implementation that includes all KeyValues.
 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.
 byte[] getPrefix()
           
 void readFields(DataInput in)
           
 void write(DataOutput out)
           
 
Methods inherited from class org.apache.hadoop.hbase.filter.FilterBase
filterAllRemaining, filterRow, filterRow, filterRowKey, hasFilterRow, reset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

prefix

protected byte[] prefix
Constructor Detail

ColumnPrefixFilter

public ColumnPrefixFilter()

ColumnPrefixFilter

public ColumnPrefixFilter(byte[] prefix)
Method Detail

getPrefix

public byte[] getPrefix()

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.

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

filterColumn

public Filter.ReturnCode filterColumn(byte[] buffer,
                                      int qualifierOffset,
                                      int qualifierLength)

write

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

readFields

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

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.

Specified by:
getNextKeyHint in interface Filter
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.


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