/** Create a filter that will emit all cells in a row if a given qualifier has a given value. */ private RowFilter createEmitRowsWithValueFilter( FilterAdapterContext context, SingleColumnValueFilter filter) throws IOException { return RowFilter.newBuilder() .setCondition( Condition.newBuilder() .setPredicateFilter( RowFilter.newBuilder() .setChain( Chain.newBuilder() .addFilters(createColumnSpecFilter(filter)) .addFilters(createValueMatchFilter(context, filter)))) .setTrueFilter(ALL_VALUES_FILTER)) .build(); }
@Override public RowFilter adapt(FilterAdapterContext context, SingleColumnValueFilter filter) throws IOException { if (filter.getFilterIfMissing()) { return createEmitRowsWithValueFilter(context, filter); } else { return RowFilter.newBuilder() .setCondition( Condition.newBuilder() .setPredicateFilter(createColumnSpecFilter(filter)) .setTrueFilter(createEmitRowsWithValueFilter(context, filter)) .setFalseFilter(ALL_VALUES_FILTER)) .build(); } }