org.apache.hadoop.hbase.filter
Class FuzzyRowFilter

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

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 interface org.apache.hadoop.hbase.filter.Filter
Filter.ReturnCode
 
Constructor Summary
FuzzyRowFilter()
          Used internally for reflection, do NOT use it directly
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.
 void readFields(DataInput dataInput)
           
 String toString()
          Return filter's info for debugging and logging purpose.
 void write(DataOutput dataOutput)
           
 
Methods inherited from class org.apache.hadoop.hbase.filter.FilterBase
createFilterFromArguments, filterRow, filterRow, filterRowKey, hasFilterRow, isFamilyEssential, 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()
Used internally for reflection, do NOT use it directly


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.

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

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.

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.

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.

Specified by:
filterAllRemaining in interface Filter
Overrides:
filterAllRemaining in class FilterBase
Returns:
true to end scan, false to continue.

write

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

readFields

public void readFields(DataInput dataInput)
                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 © 2013 The Apache Software Foundation. All Rights Reserved.