@InterfaceAudience.Public public class FuzzyRowFilter extends FilterBase
Modifier and Type | Class and Description |
---|---|
private static class |
FuzzyRowFilter.Order
Abstracts directional comparisons based on scan direction.
|
private class |
FuzzyRowFilter.RowTracker
If we have multiple fuzzy keys, row tracker should improve overall performance.
|
(package private) static class |
FuzzyRowFilter.SatisfiesCode |
Filter.ReturnCode
Modifier and Type | Field and Description |
---|---|
private boolean |
done |
private List<Pair<byte[],byte[]>> |
fuzzyKeysData |
private int |
lastFoundIndex
The index of a last successfully found matching fuzzy string (in fuzzyKeysData).
|
private FuzzyRowFilter.RowTracker |
tracker
Row tracker (keeps all next rows after SEEK_NEXT_USING_HINT was returned)
|
private static boolean |
UNSAFE_UNALIGNED |
Constructor and Description |
---|
FuzzyRowFilter(List<Pair<byte[],byte[]>> fuzzyKeysData) |
Modifier and Type | Method and Description |
---|---|
(package private) boolean |
areSerializedFieldsEqual(Filter o)
Default implementation so that writers of custom filters aren't forced to implement.
|
boolean |
equals(Object obj) |
boolean |
filterAllRemaining()
Filters that never filter all remaining can inherit this implementation that
never stops the filter early.
|
Filter.ReturnCode |
filterCell(Cell c)
A way to filter based on the column family, column qualifier and/or the column value.
|
Filter.ReturnCode |
filterKeyValue(Cell c)
Deprecated.
|
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.
|
(package private) static byte[] |
getNextForFuzzyRule(boolean reverse,
byte[] row,
byte[] fuzzyKeyBytes,
byte[] fuzzyKeyMeta) |
(package private) static byte[] |
getNextForFuzzyRule(boolean reverse,
byte[] row,
int offset,
int length,
byte[] fuzzyKeyBytes,
byte[] fuzzyKeyMeta) |
(package private) static byte[] |
getNextForFuzzyRule(byte[] row,
byte[] fuzzyKeyBytes,
byte[] fuzzyKeyMeta) |
int |
hashCode() |
private boolean |
isPreprocessedMask(byte[] mask) |
static FuzzyRowFilter |
parseFrom(byte[] pbBytes) |
private byte[] |
preprocessMask(byte[] mask)
We need to preprocess mask array, as since we treat 2's as unfixed positions and -1 (0xff) as
fixed positions
|
private void |
preprocessSearchKey(Pair<byte[],byte[]> p) |
(package private) static FuzzyRowFilter.SatisfiesCode |
satisfies(boolean reverse,
byte[] row,
byte[] fuzzyKeyBytes,
byte[] fuzzyKeyMeta) |
(package private) static FuzzyRowFilter.SatisfiesCode |
satisfies(boolean reverse,
byte[] row,
int offset,
int length,
byte[] fuzzyKeyBytes,
byte[] fuzzyKeyMeta) |
(package private) static FuzzyRowFilter.SatisfiesCode |
satisfies(byte[] row,
byte[] fuzzyKeyBytes,
byte[] fuzzyKeyMeta) |
(package private) static FuzzyRowFilter.SatisfiesCode |
satisfiesNoUnsafe(boolean reverse,
byte[] row,
int offset,
int length,
byte[] fuzzyKeyBytes,
byte[] fuzzyKeyMeta) |
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.
|
private static byte[] |
trimTrailingZeroes(byte[] result,
byte[] fuzzyKeyMeta,
int toInc)
For forward scanner, next cell hint should not contain any trailing zeroes
unless they are part of fuzzyKeyMeta
hint = '\x01\x01\x01\x00\x00'
will skip valid row '\x01\x01\x01'
|
createFilterFromArguments, filterRow, filterRowCells, filterRowKey, filterRowKey, hasFilterRow, isFamilyEssential, reset, transformCell
isReversed, setReversed
private static final boolean UNSAFE_UNALIGNED
private List<Pair<byte[],byte[]>> fuzzyKeysData
private boolean done
private int lastFoundIndex
private FuzzyRowFilter.RowTracker tracker
public FuzzyRowFilter(List<Pair<byte[],byte[]>> fuzzyKeysData)
private void preprocessSearchKey(Pair<byte[],byte[]> p)
private byte[] preprocessMask(byte[] mask)
mask
- private boolean isPreprocessedMask(byte[] mask)
@Deprecated public Filter.ReturnCode filterKeyValue(Cell c)
Filter
ReturnCode.NEXT_ROW
, it should return
ReturnCode.NEXT_ROW
until Filter.reset()
is called just in case the caller calls
for the next row.
Concrete implementers can signal a failure condition in their code by throwing an
IOException
.filterKeyValue
in class Filter
c
- the Cell in questionFilter.ReturnCode
public Filter.ReturnCode filterCell(Cell c)
Filter
ReturnCode.NEXT_ROW
, it should return
ReturnCode.NEXT_ROW
until Filter.reset()
is called just in case the caller calls
for the next row.
Concrete implementers can signal a failure condition in their code by throwing an
IOException
.filterCell
in class Filter
c
- the Cell in questionFilter.ReturnCode
public Cell getNextCellHint(Cell currentCell)
FilterBase
IOException
.getNextCellHint
in class FilterBase
public boolean filterAllRemaining()
FilterBase
IOException
.filterAllRemaining
in class FilterBase
public byte[] toByteArray()
FilterBase
toByteArray
in class FilterBase
public static FuzzyRowFilter parseFrom(byte[] pbBytes) throws DeserializationException
pbBytes
- A pb serialized FuzzyRowFilter
instanceFuzzyRowFilter
made from bytes
DeserializationException
toByteArray()
public String toString()
FilterBase
toString
in class FilterBase
static FuzzyRowFilter.SatisfiesCode satisfies(byte[] row, byte[] fuzzyKeyBytes, byte[] fuzzyKeyMeta)
static FuzzyRowFilter.SatisfiesCode satisfies(boolean reverse, byte[] row, byte[] fuzzyKeyBytes, byte[] fuzzyKeyMeta)
static FuzzyRowFilter.SatisfiesCode satisfies(boolean reverse, byte[] row, int offset, int length, byte[] fuzzyKeyBytes, byte[] fuzzyKeyMeta)
static FuzzyRowFilter.SatisfiesCode satisfiesNoUnsafe(boolean reverse, byte[] row, int offset, int length, byte[] fuzzyKeyBytes, byte[] fuzzyKeyMeta)
static byte[] getNextForFuzzyRule(byte[] row, byte[] fuzzyKeyBytes, byte[] fuzzyKeyMeta)
static byte[] getNextForFuzzyRule(boolean reverse, byte[] row, byte[] fuzzyKeyBytes, byte[] fuzzyKeyMeta)
static byte[] getNextForFuzzyRule(boolean reverse, byte[] row, int offset, int length, byte[] fuzzyKeyBytes, byte[] fuzzyKeyMeta)
private static byte[] trimTrailingZeroes(byte[] result, byte[] fuzzyKeyMeta, int toInc)
result
- fuzzyKeyMeta
- toInc
- - position of incremented byteboolean areSerializedFieldsEqual(Filter o)
FilterBase
areSerializedFieldsEqual
in class FilterBase
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.