Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Abandoned
-
0.94.11
-
None
-
None
-
Issue is not dependent upon environment.
Description
The case that getNextForFuzzyRule() fails is when the result (fuzzy key) is extended in length (zero padded) to match the current row for comparisons. If the hint is returned with zero padded bytes, the next seek may skip over a valid match. See the example below.
/**
- The code below circumvents the following situation.
- fuzzy.key = visitor,session,Logon
- fuzzy.mask = 000000001111111000000
- example hbase row data:
- visitor,session,AddToCart
- " " FacebookLike
- " " Logon
- " " MobileSpecial
- ...
- For row "visitor,sessionAddToCart", the current code would
- return a hint of "visitor,session,Logon\0\0\0\0" (zero padded).
- The next seek would skip "visitor,session,Logon" and jump
- to "visitor,session,MobileSpecial".
*/
// trim trailing zeros that were not part of the original fuzzy key
int i = result.length;
for (; i > fuzzyKeyBytes.length; i--)
if (i != result.length)
{ result = Arrays.copyOf(result, i); }The code above added to the end of getNextFuzzyRule() will circumvent the issue. I tested my scenario and it produces the correct results. There may be a better solution.
Thanks.