org.apache.hadoop.hbase.filter
Class FuzzyRowFilter

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

@InterfaceAudience.Public
@InterfaceStability.Evolving
public class FuzzyRowFilter
extends FilterBase

Filters data based on fuzzy row key. Performs fast-forwards during scanning. It takes pairs (row key, fuzzy info) to match row keys. Where fuzzy info is a byte array with 0 or 1 as its values:

Example: Let's assume row key format is userId_actionId_year_month. Length of userId is fixed and is 4, length of actionId is 2 and year and month are 4 and 2 bytes long respectively. Let's assume that we need to fetch all users that performed certain action (encoded as "99") in Jan of any year. Then the pair (row key, fuzzy info) would be the following: row key = "????_99_????_01" (one can use any value instead of "?") fuzzy info = "\x01\x01\x01\x01\x00\x00\x00\x00\x01\x01\x01\x01\x00\x00\x00" I.e. fuzzy info tells the matching mask is "????_99_????_01", where at ? can be any value.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.hadoop.hbase.filter.Filter
Filter.ReturnCode
 
Constructor Summary
FuzzyRowFilter(List<Pair<byte[],byte[]>> fuzzyKeysData)
           
 
Method Summary
 boolean filterAllRemaining()
          Filters that never filter all remaining can inherit this implementation that never stops the filter early.
 Filter.ReturnCode filterKeyValue(KeyValue kv)
          Filters that dont filter by key value can inherit this implementation that includes all KeyValues.
 KeyValue getNextKeyHint(KeyValue currentKV)
          Filters that are not sure which key must be next seeked to, can inherit this implementation that, by default, returns a null KeyValue.
static FuzzyRowFilter 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
createFilterFromArguments, filterRow, filterRow, filterRowKey, hasFilterRow, isFamilyEssential, reset, transform
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FuzzyRowFilter

public FuzzyRowFilter(List<Pair<byte[],byte[]>> fuzzyKeysData)
Method Detail

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

getNextKeyHint

public KeyValue getNextKeyHint(KeyValue currentKV)
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.

filterAllRemaining

public boolean filterAllRemaining()
Description copied from class: FilterBase
Filters that never filter all remaining can inherit this implementation that never stops the filter early.

Overrides:
filterAllRemaining in class FilterBase
Returns:
true to end scan, false to continue.

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 FuzzyRowFilter parseFrom(byte[] pbBytes)
                                throws DeserializationException
Parameters:
pbBytes - A pb serialized FuzzyRowFilter instance
Returns:
An instance of FuzzyRowFilter made from bytes
Throws:
DeserializationException
See Also:
toByteArray()

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.