org.apache.hadoop.hbase.filter
Class ColumnPrefixFilter

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.ColumnPrefixFilter

@InterfaceAudience.Public
@InterfaceStability.Stable
public class ColumnPrefixFilter
extends org.apache.hadoop.hbase.filter.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 with columns like 'and', 'anti' but not keys with columns like 'ball', 'act'.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.hadoop.hbase.filter.Filter
Filter.ReturnCode
 
Field Summary
protected  byte[] prefix
           
 
Fields inherited from class org.apache.hadoop.hbase.filter.Filter
reversed
 
Constructor Summary
ColumnPrefixFilter(byte[] prefix)
           
 
Method Summary
static Filter createFilterFromArguments(ArrayList<byte[]> filterArguments)
           
 Filter.ReturnCode filterColumn(byte[] buffer, int qualifierOffset, int qualifierLength)
           
 Filter.ReturnCode filterKeyValue(Cell kv)
          Filters that dont filter by key value can inherit this implementation that includes all Cells.
 Cell getNextCellHint(Cell kv)
          Filters that are not sure which key must be next seeked to, can inherit this implementation that, by default, returns a null Cell.
 byte[] getPrefix()
           
static ColumnPrefixFilter 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, filterRowCells, filterRowKey, getNextKeyHint, hasFilterRow, isFamilyEssential, reset, transform, transformCell
 
Methods inherited from class org.apache.hadoop.hbase.filter.Filter
isReversed, setReversed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

prefix

protected byte[] prefix
Constructor Detail

ColumnPrefixFilter

public ColumnPrefixFilter(byte[] prefix)
Method Detail

getPrefix

public byte[] getPrefix()

filterKeyValue

public Filter.ReturnCode filterKeyValue(Cell kv)
Description copied from class: org.apache.hadoop.hbase.filter.FilterBase
Filters that dont filter by key value can inherit this implementation that includes all Cells.

Overrides:
filterKeyValue in class org.apache.hadoop.hbase.filter.FilterBase
Parameters:
kv - the Cell in question
Returns:
code as described below
See Also:
Filter.ReturnCode

filterColumn

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

createFilterFromArguments

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

toByteArray

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

Overrides:
toByteArray in class org.apache.hadoop.hbase.filter.FilterBase
Returns:
The filter serialized using pb

parseFrom

public static ColumnPrefixFilter parseFrom(byte[] pbBytes)
                                    throws org.apache.hadoop.hbase.exceptions.DeserializationException
Parameters:
pbBytes - A pb serialized ColumnPrefixFilter instance
Returns:
An instance of ColumnPrefixFilter made from bytes
Throws:
org.apache.hadoop.hbase.exceptions.DeserializationException
See Also:
toByteArray()

getNextCellHint

public Cell getNextCellHint(Cell kv)
Description copied from class: org.apache.hadoop.hbase.filter.FilterBase
Filters that are not sure which key must be next seeked to, can inherit this implementation that, by default, returns a null Cell.

Overrides:
getNextCellHint in class org.apache.hadoop.hbase.filter.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: org.apache.hadoop.hbase.filter.FilterBase
Return filter's info for debugging and logging purpose.

Overrides:
toString in class org.apache.hadoop.hbase.filter.FilterBase


Copyright © 2015 The Apache Software Foundation. All rights reserved.