RowFilterAdapter extends TypedFilterAdapterBase<org.apache.hadoop.hbase.filter.RowFilter> { @Override public FilterSupportStatus isFilterSupported( FilterAdapterContext context, org.apache.hadoop.hbase.filter.RowFilter filter) { ByteArrayComparable comparator = filter.getComparator(); if (!(comparator instanceof RegexStringComparator) && !(comparator instanceof BinaryComparator)) { return FilterSupportStatus.newNotSupported( comparator.getClass().getName() + " comparator is not supported"); } if (filter.getOperator() != CompareFilter.CompareOp.EQUAL) { return FilterSupportStatus.newNotSupported( filter.getOperator() + " operator is not supported"); } return FilterSupportStatus.SUPPORTED; }  @Override Filter adapt(FilterAdapterContext context, org.apache.hadoop.hbase.filter.RowFilter filter); @Override FilterSupportStatus isFilterSupported(
      FilterAdapterContext context, org.apache.hadoop.hbase.filter.RowFilter filter);  }
@Test public void testNotSupported_RegexNotEquals() { String regexp = "^.*hello world.*$"; RegexStringComparator comparator = new RegexStringComparator(regexp); org.apache.hadoop.hbase.filter.RowFilter filter = new org.apache.hadoop.hbase.filter.RowFilter( CompareFilter.CompareOp.GREATER_OR_EQUAL, comparator); Assert.assertFalse(adapter.isFilterSupported(context, filter).isSupported()); }
@Test public void testSupported_BinaryComparatorEquals() { BinaryComparator comparator = new BinaryComparator(new byte[] {0, 1, 2}); org.apache.hadoop.hbase.filter.RowFilter filter = new org.apache.hadoop.hbase.filter.RowFilter(CompareFilter.CompareOp.EQUAL, comparator); Assert.assertTrue(adapter.isFilterSupported(context, filter).isSupported()); }
@Test public void testNotSupported_BinaryNotEquals() { BinaryComparator comparator = new BinaryComparator(new byte[] {0, 1, 2}); org.apache.hadoop.hbase.filter.RowFilter filter = new org.apache.hadoop.hbase.filter.RowFilter( CompareFilter.CompareOp.GREATER_OR_EQUAL, comparator); Assert.assertFalse(adapter.isFilterSupported(context, filter).isSupported()); }
@Test public void testNotSupported_OtherComparator() { ByteArrayComparable comparator = new LongComparator(1L); org.apache.hadoop.hbase.filter.RowFilter filter = new org.apache.hadoop.hbase.filter.RowFilter(CompareFilter.CompareOp.EQUAL, comparator); Assert.assertFalse(adapter.isFilterSupported(context, filter).isSupported()); }