@Test public void testAdapt_RegexAndEquals() throws IOException { 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.EQUAL, comparator); Assert.assertEquals( FILTERS.key().regex(regexp).toProto(), adapter.adapt(context, filter).toProto()); }
@Override public Filter adapt(FilterAdapterContext context, org.apache.hadoop.hbase.filter.RowFilter filter) throws IOException { CompareOp compareOp = filter.getOperator(); if (compareOp != CompareFilter.CompareOp.EQUAL) { throw new IllegalStateException( String.format( "Cannot adapt operator %s", compareOp == null ? null : compareOp.getClass().getCanonicalName())); } ByteArrayComparable comparator = filter.getComparator(); ByteString regexValue; if (comparator == null) { throw new IllegalStateException("Comparator cannot be null"); } else if (comparator instanceof RegexStringComparator) { regexValue = ByteString.copyFrom(comparator.getValue()); } else if (comparator instanceof BinaryComparator) { regexValue = ReaderExpressionHelper.quoteRegularExpression(comparator.getValue()); } else { throw new IllegalStateException( String.format("Cannot adapt comparator %s", comparator.getClass().getCanonicalName())); } return FILTERS.key().regex(regexValue); }
RowFilterAdapter extends TypedFilterAdapterBase<org.apache.hadoop.hbase.filter.RowFilter> { @Override public Filter adapt(FilterAdapterContext context, org.apache.hadoop.hbase.filter.RowFilter filter) throws IOException { CompareOp compareOp = filter.getOperator(); if (compareOp != CompareFilter.CompareOp.EQUAL) { throw new IllegalStateException( String.format( "Cannot adapt operator %s", compareOp == null ? null : compareOp.getClass().getCanonicalName())); } ByteArrayComparable comparator = filter.getComparator(); ByteString regexValue; if (comparator == null) { throw new IllegalStateException("Comparator cannot be null"); } else if (comparator instanceof RegexStringComparator) { regexValue = ByteString.copyFrom(comparator.getValue()); } else if (comparator instanceof BinaryComparator) { regexValue = ReaderExpressionHelper.quoteRegularExpression(comparator.getValue()); } else { throw new IllegalStateException( String.format("Cannot adapt comparator %s", comparator.getClass().getCanonicalName())); } return FILTERS.key().regex(regexValue); } }
RowFilterAdapter extends TypedFilterAdapterBase<org.apache.hadoop.hbase.filter.RowFilter> { @Override public Filter adapt(FilterAdapterContext context, org.apache.hadoop.hbase.filter.RowFilter filter) throws IOException { CompareOp compareOp = filter.getOperator(); if (compareOp != CompareFilter.CompareOp.EQUAL) { throw new IllegalStateException( String.format( "Cannot adapt operator %s", compareOp == null ? null : compareOp.getClass().getCanonicalName())); } ByteArrayComparable comparator = filter.getComparator(); ByteString regexValue; if (comparator == null) { throw new IllegalStateException("Comparator cannot be null"); } else if (comparator instanceof RegexStringComparator) { regexValue = ByteString.copyFrom(comparator.getValue()); } else if (comparator instanceof BinaryComparator) { regexValue = ReaderExpressionHelper.quoteRegularExpression(comparator.getValue()); } else { throw new IllegalStateException( String.format("Cannot adapt comparator %s", comparator.getClass().getCanonicalName())); } return FILTERS.key().regex(regexValue); }  }
RowFilterAdapter extends TypedFilterAdapterBase<org.apache.hadoop.hbase.filter.RowFilter> { @Override public Filter adapt(FilterAdapterContext context, org.apache.hadoop.hbase.filter.RowFilter filter) throws IOException { CompareOp compareOp = filter.getOperator(); if (compareOp != CompareFilter.CompareOp.EQUAL) { throw new IllegalStateException( String.format( "Cannot adapt operator %s", compareOp == null ? null : compareOp.getClass().getCanonicalName())); } ByteArrayComparable comparator = filter.getComparator(); ByteString regexValue; if (comparator == null) { throw new IllegalStateException("Comparator cannot be null"); } else if (comparator instanceof RegexStringComparator) { regexValue = ByteString.copyFrom(comparator.getValue()); } else if (comparator instanceof BinaryComparator) { regexValue = ReaderExpressionHelper.quoteRegularExpression(comparator.getValue()); } else { throw new IllegalStateException( String.format("Cannot adapt comparator %s", comparator.getClass().getCanonicalName())); } return FILTERS.key().regex(regexValue); }  @Override Filter adapt(FilterAdapterContext context, org.apache.hadoop.hbase.filter.RowFilter filter); @Override FilterSupportStatus isFilterSupported(
      FilterAdapterContext context, org.apache.hadoop.hbase.filter.RowFilter filter); }
RowFilterAdapter extends TypedFilterAdapterBase<org.apache.hadoop.hbase.filter.RowFilter> { @Override public Filter adapt(FilterAdapterContext context, org.apache.hadoop.hbase.filter.RowFilter filter) throws IOException { CompareOp compareOp = filter.getOperator(); if (compareOp != CompareFilter.CompareOp.EQUAL) { throw new IllegalStateException( String.format( "Cannot adapt operator %s", compareOp == null ? null : compareOp.getClass().getCanonicalName())); } ByteArrayComparable comparator = filter.getComparator(); ByteString regexValue; if (comparator == null) { throw new IllegalStateException("Comparator cannot be null"); } else if (comparator instanceof RegexStringComparator) { regexValue = ByteString.copyFrom(comparator.getValue()); } else if (comparator instanceof BinaryComparator) { regexValue = ReaderExpressionHelper.quoteRegularExpression(comparator.getValue()); } else { throw new IllegalStateException( String.format("Cannot adapt comparator %s", comparator.getClass().getCanonicalName())); } return FILTERS.key().regex(regexValue); }  @Override Filter adapt(FilterAdapterContext context, org.apache.hadoop.hbase.filter.RowFilter filter); @Override FilterSupportStatus isFilterSupported(
      FilterAdapterContext context, org.apache.hadoop.hbase.filter.RowFilter filter);  }