FuzzyRowFilterAdapter extends TypedFilterAdapterBase<FuzzyRowFilter> { @Override public Filter adapt(FilterAdapterContext context, FuzzyRowFilter filter) throws IOException { List<Pair<byte[], byte[]>> pairs = extractFuzzyRowFilterPairs(filter); if (pairs.isEmpty()) { return FILTERS.pass(); } InterleaveFilter interleave = FILTERS.interleave(); for (Pair<byte[], byte[]> pair : pairs) { Preconditions.checkArgument( pair.getFirst().length == pair.getSecond().length, "Fuzzy info and match mask must have the same length"); interleave.filter(createSingleRowFilter(pair.getFirst(), pair.getSecond())); } return interleave; }  @Override Filter adapt(FilterAdapterContext context, FuzzyRowFilter filter); @Override FilterSupportStatus isFilterSupported(
      FilterAdapterContext context, FuzzyRowFilter filter);  }
@Test public void fuzzyKeysAreTranslatedToRegularExpressions() throws IOException { List<Pair<byte[], byte[]>> testPairs = ImmutableList.<Pair<byte[], byte[]>>builder() .add(new Pair<>(Bytes.toBytes("abcd"), new byte[] {-1, -1, -1, -1})) .add(new Pair<>(Bytes.toBytes(".fgh"), new byte[] {0, 0, 1, 0})) .add(new Pair<>(Bytes.toBytes("ijkl"), new byte[] {1, 1, 1, 1})) .build(); FuzzyRowFilter filter = new FuzzyRowFilter(testPairs); Filters.Filter adaptedFilter = adapter.adapt(context, filter); Filters.Filter expected = FILTERS .interleave() .filter(FILTERS.key().regex("abcd\\C*")) .filter(FILTERS.key().regex("\\.f\\Ch\\C*")) .filter(FILTERS.key().regex("\\C\\C\\C\\C\\C*")); Assert.assertEquals(expected.toProto(), adaptedFilter.toProto()); }