@Test public void interleavedFiltersAreAdapted() throws IOException { FilterList filterList = makeFilterList(Operator.MUST_PASS_ONE); List<Filter> filters = filterList.getFilters(); Filters.Filter expectedFilter = adapt(filterList); Assert.assertEquals(filters.size(), expectedFilter.toProto().getInterleave().getFiltersCount()); for (int i = 0; i < filters.size(); i++) { Assert.assertEquals( adapt(filters.get(i)).toProto(), expectedFilter.toProto().getInterleave().getFilters(i)); } }
@Override public Filters.Filter adapt(FilterAdapterContext context, FilterList filter) throws IOException { try (ContextCloseable ignored = context.beginFilterList(filter)) { List<Filters.Filter> childFilters = collectChildFilters(context, filter); if (childFilters.isEmpty()) { return null; } else if (childFilters.size() == 1) { return childFilters.get(0); } else if (filter.getOperator() == Operator.MUST_PASS_ALL) { ChainFilter chain = FILTERS.chain(); for (Filters.Filter filterModel : childFilters) { chain.filter(filterModel); } return chain; } else { InterleaveFilter interleave = FILTERS.interleave(); for (Filters.Filter filterModel : childFilters) { interleave.filter(filterModel); } return interleave; } } }
FilterListAdapter extends TypedFilterAdapterBase<FilterList> implements UnsupportedStatusCollector<FilterList> { @Override public Filters.Filter adapt(FilterAdapterContext context, FilterList filter) throws IOException { try (ContextCloseable ignored = context.beginFilterList(filter)) { List<Filters.Filter> childFilters = collectChildFilters(context, filter); if (childFilters.isEmpty()) { return null; } else if (childFilters.size() == 1) { return childFilters.get(0); } else if (filter.getOperator() == Operator.MUST_PASS_ALL) { ChainFilter chain = FILTERS.chain(); for (Filters.Filter filterModel : childFilters) { chain.filter(filterModel); } return chain; } else { InterleaveFilter interleave = FILTERS.interleave(); for (Filters.Filter filterModel : childFilters) { interleave.filter(filterModel); } return interleave; } } } }
FilterListAdapter extends TypedFilterAdapterBase<FilterList> implements UnsupportedStatusCollector<FilterList> { @Override public Filters.Filter adapt(FilterAdapterContext context, FilterList filter) throws IOException { try (ContextCloseable ignored = context.beginFilterList(filter)) { List<Filters.Filter> childFilters = collectChildFilters(context, filter); if (childFilters.isEmpty()) { return null; } else if (childFilters.size() == 1) { return childFilters.get(0); } else if (filter.getOperator() == Operator.MUST_PASS_ALL) { ChainFilter chain = FILTERS.chain(); for (Filters.Filter filterModel : childFilters) { chain.filter(filterModel); } return chain; } else { InterleaveFilter interleave = FILTERS.interleave(); for (Filters.Filter filterModel : childFilters) { interleave.filter(filterModel); } return interleave; } } } FilterListAdapter(FilterAdapter subFilterAdapter); }
FilterListAdapter extends TypedFilterAdapterBase<FilterList> implements UnsupportedStatusCollector<FilterList> { @Override public Filters.Filter adapt(FilterAdapterContext context, FilterList filter) throws IOException { try (ContextCloseable ignored = context.beginFilterList(filter)) { List<Filters.Filter> childFilters = collectChildFilters(context, filter); if (childFilters.isEmpty()) { return null; } else if (childFilters.size() == 1) { return childFilters.get(0); } else if (filter.getOperator() == Operator.MUST_PASS_ALL) { ChainFilter chain = FILTERS.chain(); for (Filters.Filter filterModel : childFilters) { chain.filter(filterModel); } return chain; } else { InterleaveFilter interleave = FILTERS.interleave(); for (Filters.Filter filterModel : childFilters) { interleave.filter(filterModel); } return interleave; } } } FilterListAdapter(FilterAdapter subFilterAdapter); @Override Filters.Filter adapt(FilterAdapterContext context, FilterList filter); @Override FilterSupportStatus isFilterSupported(FilterAdapterContext context, FilterList filter); @Override void collectUnsupportedStatuses(
      FilterAdapterContext context,
      FilterList filter,
      List<FilterSupportStatus> unsupportedStatuses); @Override RangeSet<RowKeyWrapper> getIndexScanHint(FilterList filter); }
FilterListAdapter extends TypedFilterAdapterBase<FilterList> implements UnsupportedStatusCollector<FilterList> { @Override public Filters.Filter adapt(FilterAdapterContext context, FilterList filter) throws IOException { try (ContextCloseable ignored = context.beginFilterList(filter)) { List<Filters.Filter> childFilters = collectChildFilters(context, filter); if (childFilters.isEmpty()) { return null; } else if (childFilters.size() == 1) { return childFilters.get(0); } else if (filter.getOperator() == Operator.MUST_PASS_ALL) { ChainFilter chain = FILTERS.chain(); for (Filters.Filter filterModel : childFilters) { chain.filter(filterModel); } return chain; } else { InterleaveFilter interleave = FILTERS.interleave(); for (Filters.Filter filterModel : childFilters) { interleave.filter(filterModel); } return interleave; } } } FilterListAdapter(FilterAdapter subFilterAdapter); @Override Filters.Filter adapt(FilterAdapterContext context, FilterList filter); @Override FilterSupportStatus isFilterSupported(FilterAdapterContext context, FilterList filter); @Override void collectUnsupportedStatuses(
      FilterAdapterContext context,
      FilterList filter,
      List<FilterSupportStatus> unsupportedStatuses); @Override RangeSet<RowKeyWrapper> getIndexScanHint(FilterList filter);  }