@Test public void simpleWrappedFilter() throws IOException { ValueFilter valueFilter = new ValueFilter(CompareFilter.CompareOp.LESS, new BinaryComparator(Bytes.toBytes("12"))); WhileMatchFilter filter = new WhileMatchFilter(valueFilter); Filters.Filter actualFilter = instance.adapt(emptyScanContext, filter); Filters.Filter expectedFilter = buildExpectedRowFilter( filterAdapter.adaptFilter(emptyScanContext, valueFilter).get(), emptyScanContext.getCurrentUniqueId()); assertEquals(expectedFilter.toProto(), actualFilter.toProto()); }
@Override public Filters.Filter adapt(FilterAdapterContext context, WhileMatchFilter filter) throws IOException { checkArgument( context.getNumberOfWhileMatchFilters() == 0, "More than one WhileMatchFilter is not supported."); checkNotNull(filter.getFilter(), "The wrapped filter for a WhileMatchFilter cannot be null."); Optional<Filters.Filter> wrappedFilter = subFilterAdapter.adaptFilter(context, filter.getFilter()); checkArgument( wrappedFilter.isPresent(), "Unable to adapted the wrapped filter: " + filter.getFilter()); String whileMatchFilterId = context.getNextUniqueId(); Filters.Filter inLabel = FILTERS.label(whileMatchFilterId + IN_LABEL_SUFFIX); Filters.Filter inLabelAndSink = FILTERS.chain().filter(inLabel).filter(FILTERS.sink()); Filters.Filter outLabel = FILTERS.label(whileMatchFilterId + OUT_LABEL_SUFFIX); Filters.Filter outLabelAndSink = FILTERS.chain().filter(outLabel).filter(FILTERS.sink()); Filters.Filter outInterleave = FILTERS.interleave().filter(outLabelAndSink).filter(FILTERS.pass()); Filters.Filter outChain = FILTERS.chain().filter(wrappedFilter.get()).filter(outInterleave); Filters.Filter finalFilter = FILTERS.interleave().filter(inLabelAndSink).filter(outChain); context.addWhileMatchFilter(filter); return finalFilter; }
WhileMatchFilterAdapter extends TypedFilterAdapterBase<WhileMatchFilter> { @Override public Filters.Filter adapt(FilterAdapterContext context, WhileMatchFilter filter) throws IOException { checkArgument( context.getNumberOfWhileMatchFilters() == 0, "More than one WhileMatchFilter is not supported."); checkNotNull(filter.getFilter(), "The wrapped filter for a WhileMatchFilter cannot be null."); Optional<Filters.Filter> wrappedFilter = subFilterAdapter.adaptFilter(context, filter.getFilter()); checkArgument( wrappedFilter.isPresent(), "Unable to adapted the wrapped filter: " + filter.getFilter()); String whileMatchFilterId = context.getNextUniqueId(); Filters.Filter inLabel = FILTERS.label(whileMatchFilterId + IN_LABEL_SUFFIX); Filters.Filter inLabelAndSink = FILTERS.chain().filter(inLabel).filter(FILTERS.sink()); Filters.Filter outLabel = FILTERS.label(whileMatchFilterId + OUT_LABEL_SUFFIX); Filters.Filter outLabelAndSink = FILTERS.chain().filter(outLabel).filter(FILTERS.sink()); Filters.Filter outInterleave = FILTERS.interleave().filter(outLabelAndSink).filter(FILTERS.pass()); Filters.Filter outChain = FILTERS.chain().filter(wrappedFilter.get()).filter(outInterleave); Filters.Filter finalFilter = FILTERS.interleave().filter(inLabelAndSink).filter(outChain); context.addWhileMatchFilter(filter); return finalFilter; } }
WhileMatchFilterAdapter extends TypedFilterAdapterBase<WhileMatchFilter> { @Override public Filters.Filter adapt(FilterAdapterContext context, WhileMatchFilter filter) throws IOException { checkArgument( context.getNumberOfWhileMatchFilters() == 0, "More than one WhileMatchFilter is not supported."); checkNotNull(filter.getFilter(), "The wrapped filter for a WhileMatchFilter cannot be null."); Optional<Filters.Filter> wrappedFilter = subFilterAdapter.adaptFilter(context, filter.getFilter()); checkArgument( wrappedFilter.isPresent(), "Unable to adapted the wrapped filter: " + filter.getFilter()); String whileMatchFilterId = context.getNextUniqueId(); Filters.Filter inLabel = FILTERS.label(whileMatchFilterId + IN_LABEL_SUFFIX); Filters.Filter inLabelAndSink = FILTERS.chain().filter(inLabel).filter(FILTERS.sink()); Filters.Filter outLabel = FILTERS.label(whileMatchFilterId + OUT_LABEL_SUFFIX); Filters.Filter outLabelAndSink = FILTERS.chain().filter(outLabel).filter(FILTERS.sink()); Filters.Filter outInterleave = FILTERS.interleave().filter(outLabelAndSink).filter(FILTERS.pass()); Filters.Filter outChain = FILTERS.chain().filter(wrappedFilter.get()).filter(outInterleave); Filters.Filter finalFilter = FILTERS.interleave().filter(inLabelAndSink).filter(outChain); context.addWhileMatchFilter(filter); return finalFilter; } WhileMatchFilterAdapter(FilterAdapter subFilterAdapter); }
WhileMatchFilterAdapter extends TypedFilterAdapterBase<WhileMatchFilter> { @Override public Filters.Filter adapt(FilterAdapterContext context, WhileMatchFilter filter) throws IOException { checkArgument( context.getNumberOfWhileMatchFilters() == 0, "More than one WhileMatchFilter is not supported."); checkNotNull(filter.getFilter(), "The wrapped filter for a WhileMatchFilter cannot be null."); Optional<Filters.Filter> wrappedFilter = subFilterAdapter.adaptFilter(context, filter.getFilter()); checkArgument( wrappedFilter.isPresent(), "Unable to adapted the wrapped filter: " + filter.getFilter()); String whileMatchFilterId = context.getNextUniqueId(); Filters.Filter inLabel = FILTERS.label(whileMatchFilterId + IN_LABEL_SUFFIX); Filters.Filter inLabelAndSink = FILTERS.chain().filter(inLabel).filter(FILTERS.sink()); Filters.Filter outLabel = FILTERS.label(whileMatchFilterId + OUT_LABEL_SUFFIX); Filters.Filter outLabelAndSink = FILTERS.chain().filter(outLabel).filter(FILTERS.sink()); Filters.Filter outInterleave = FILTERS.interleave().filter(outLabelAndSink).filter(FILTERS.pass()); Filters.Filter outChain = FILTERS.chain().filter(wrappedFilter.get()).filter(outInterleave); Filters.Filter finalFilter = FILTERS.interleave().filter(inLabelAndSink).filter(outChain); context.addWhileMatchFilter(filter); return finalFilter; } WhileMatchFilterAdapter(FilterAdapter subFilterAdapter); @Override Filters.Filter adapt(FilterAdapterContext context, WhileMatchFilter filter); @Override FilterSupportStatus isFilterSupported(
      FilterAdapterContext context, WhileMatchFilter filter); }
WhileMatchFilterAdapter extends TypedFilterAdapterBase<WhileMatchFilter> { @Override public Filters.Filter adapt(FilterAdapterContext context, WhileMatchFilter filter) throws IOException { checkArgument( context.getNumberOfWhileMatchFilters() == 0, "More than one WhileMatchFilter is not supported."); checkNotNull(filter.getFilter(), "The wrapped filter for a WhileMatchFilter cannot be null."); Optional<Filters.Filter> wrappedFilter = subFilterAdapter.adaptFilter(context, filter.getFilter()); checkArgument( wrappedFilter.isPresent(), "Unable to adapted the wrapped filter: " + filter.getFilter()); String whileMatchFilterId = context.getNextUniqueId(); Filters.Filter inLabel = FILTERS.label(whileMatchFilterId + IN_LABEL_SUFFIX); Filters.Filter inLabelAndSink = FILTERS.chain().filter(inLabel).filter(FILTERS.sink()); Filters.Filter outLabel = FILTERS.label(whileMatchFilterId + OUT_LABEL_SUFFIX); Filters.Filter outLabelAndSink = FILTERS.chain().filter(outLabel).filter(FILTERS.sink()); Filters.Filter outInterleave = FILTERS.interleave().filter(outLabelAndSink).filter(FILTERS.pass()); Filters.Filter outChain = FILTERS.chain().filter(wrappedFilter.get()).filter(outInterleave); Filters.Filter finalFilter = FILTERS.interleave().filter(inLabelAndSink).filter(outChain); context.addWhileMatchFilter(filter); return finalFilter; } WhileMatchFilterAdapter(FilterAdapter subFilterAdapter); @Override Filters.Filter adapt(FilterAdapterContext context, WhileMatchFilter filter); @Override FilterSupportStatus isFilterSupported(
      FilterAdapterContext context, WhileMatchFilter filter);  }