This is inspired by HBase's 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.