org.apache.hadoop.hbase.filter
Class FuzzyRowFilter
java.lang.Object
org.apache.hadoop.hbase.filter.Filter
org.apache.hadoop.hbase.filter.FilterBase
org.apache.hadoop.hbase.filter.FuzzyRowFilter
@InterfaceAudience.Public
@InterfaceStability.Evolving
public class FuzzyRowFilter
- extends org.apache.hadoop.hbase.filter.FilterBase
This is optimized version of a standard FuzzyRowFilter 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:
- 0 - means that this byte in provided row key is fixed, i.e. row key's byte at same position
must match
- 1 - means that this byte in provided row key is NOT fixed, i.e. row key's byte at this
position can be different from the one in provided row key
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.
Fields inherited from class org.apache.hadoop.hbase.filter.Filter |
reversed |
Method Summary |
boolean |
filterAllRemaining()
Filters that never filter all remaining can inherit this implementation that
never stops the filter early. |
Filter.ReturnCode |
filterKeyValue(Cell c)
Filters that dont filter by key value can inherit this implementation that
includes all Cells. |
Cell |
getNextCellHint(Cell currentCell)
Filters that are not sure which key must be next seeked to, can inherit
this implementation that, by default, returns a null Cell. |
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, filterRowCells, filterRowKey, getNextKeyHint, hasFilterRow, isFamilyEssential, reset, transform, transformCell |
FuzzyRowFilter
public FuzzyRowFilter(List<Pair<byte[],byte[]>> fuzzyKeysData)
filterKeyValue
public Filter.ReturnCode filterKeyValue(Cell c)
- 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:
c
- the Cell in question
- Returns:
- code as described below
- See Also:
Filter.ReturnCode
getNextCellHint
public Cell getNextCellHint(Cell currentCell)
- 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.
filterAllRemaining
public boolean filterAllRemaining()
- Description copied from class:
org.apache.hadoop.hbase.filter.FilterBase
- Filters that never filter all remaining can inherit this implementation that
never stops the filter early.
- Overrides:
filterAllRemaining
in class org.apache.hadoop.hbase.filter.FilterBase
- Returns:
- true to end scan, false to continue.
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 FuzzyRowFilter parseFrom(byte[] pbBytes)
throws org.apache.hadoop.hbase.exceptions.DeserializationException
- Parameters:
pbBytes
- A pb serialized FuzzyRowFilter
instance
- Returns:
- An instance of
FuzzyRowFilter
made from bytes
- Throws:
org.apache.hadoop.hbase.exceptions.DeserializationException
- See Also:
toByteArray()
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.