@Test public void integerLimitsAreApplied() throws IOException { ColumnPaginationFilter filter = new ColumnPaginationFilter(10, 20); Filters.Filter adaptedFilter = adapter.adapt(new FilterAdapterContext(new Scan(), null), filter); Filters.Filter expected = FILTERS .chain() .filter(FILTERS.limit().cellsPerColumn(1)) .filter(FILTERS.offset().cellsPerRow(20)) .filter(FILTERS.limit().cellsPerRow(10)); Assert.assertEquals(expected.toProto(), adaptedFilter.toProto()); }
@Override public Filter adapt(FilterAdapterContext context, ColumnPaginationFilter filter) throws IOException { if (filter.getColumnOffset() != null) { byte[] family = context.getScan().getFamilies()[0]; ByteString startQualifier = ByteString.copyFrom(filter.getColumnOffset()); return createChain( filter, FILTERS .qualifier() .rangeWithinFamily(Bytes.toString(family)) .startClosed(startQualifier)); } else if (filter.getOffset() > 0) { return createChain(filter, FILTERS.offset().cellsPerRow(filter.getOffset())); } else { return createChain(filter, null); } }
ColumnPaginationFilterAdapter extends TypedFilterAdapterBase<ColumnPaginationFilter> { @Override public Filter adapt(FilterAdapterContext context, ColumnPaginationFilter filter) throws IOException { if (filter.getColumnOffset() != null) { byte[] family = context.getScan().getFamilies()[0]; ByteString startQualifier = ByteString.copyFrom(filter.getColumnOffset()); return createChain( filter, FILTERS .qualifier() .rangeWithinFamily(Bytes.toString(family)) .startClosed(startQualifier)); } else if (filter.getOffset() > 0) { return createChain(filter, FILTERS.offset().cellsPerRow(filter.getOffset())); } else { return createChain(filter, null); } } }
ColumnPaginationFilterAdapter extends TypedFilterAdapterBase<ColumnPaginationFilter> { @Override public Filter adapt(FilterAdapterContext context, ColumnPaginationFilter filter) throws IOException { if (filter.getColumnOffset() != null) { byte[] family = context.getScan().getFamilies()[0]; ByteString startQualifier = ByteString.copyFrom(filter.getColumnOffset()); return createChain( filter, FILTERS .qualifier() .rangeWithinFamily(Bytes.toString(family)) .startClosed(startQualifier)); } else if (filter.getOffset() > 0) { return createChain(filter, FILTERS.offset().cellsPerRow(filter.getOffset())); } else { return createChain(filter, null); } }  }
ColumnPaginationFilterAdapter extends TypedFilterAdapterBase<ColumnPaginationFilter> { @Override public Filter adapt(FilterAdapterContext context, ColumnPaginationFilter filter) throws IOException { if (filter.getColumnOffset() != null) { byte[] family = context.getScan().getFamilies()[0]; ByteString startQualifier = ByteString.copyFrom(filter.getColumnOffset()); return createChain( filter, FILTERS .qualifier() .rangeWithinFamily(Bytes.toString(family)) .startClosed(startQualifier)); } else if (filter.getOffset() > 0) { return createChain(filter, FILTERS.offset().cellsPerRow(filter.getOffset())); } else { return createChain(filter, null); } }  @Override Filter adapt(FilterAdapterContext context, ColumnPaginationFilter filter); @Override FilterSupportStatus isFilterSupported(
      FilterAdapterContext context, ColumnPaginationFilter filter); }
ColumnPaginationFilterAdapter extends TypedFilterAdapterBase<ColumnPaginationFilter> { @Override public Filter adapt(FilterAdapterContext context, ColumnPaginationFilter filter) throws IOException { if (filter.getColumnOffset() != null) { byte[] family = context.getScan().getFamilies()[0]; ByteString startQualifier = ByteString.copyFrom(filter.getColumnOffset()); return createChain( filter, FILTERS .qualifier() .rangeWithinFamily(Bytes.toString(family)) .startClosed(startQualifier)); } else if (filter.getOffset() > 0) { return createChain(filter, FILTERS.offset().cellsPerRow(filter.getOffset())); } else { return createChain(filter, null); } }  @Override Filter adapt(FilterAdapterContext context, ColumnPaginationFilter filter); @Override FilterSupportStatus isFilterSupported(
      FilterAdapterContext context, ColumnPaginationFilter filter);  }