@Test public void testDeleteMarkerForCellsWithLowerOrEqualTimestamp() { long timestamp = 10000L; List<Cell> cells = Lists.newArrayList( HBaseCellUtils.createDataCell(ROW_KEY, COLUMN_FAMILY, QUALIFIER, timestamp), HBaseCellUtils.createDataCell(ROW_KEY, COLUMN_FAMILY, QUALIFIER, timestamp - 1), HBaseCellUtils.createDataCell(ROW_KEY, COLUMN_FAMILY, QUALIFIER, timestamp + 1)); Predicate<Cell> predicate = predicateMaker.apply( HBaseCellUtils.deleteMarkerForCellsWithLowerOrEqualTimestamp( ROW_KEY, COLUMN_FAMILY, QUALIFIER, timestamp)); assertEquals( Sets.newHashSet(cells.get(0), cells.get(1)), Sets.newHashSet(Iterables.filter(cells, predicate))); predicate = predicateMaker.apply( HBaseCellUtils.deleteMarkerForCellsWithLowerOrEqualTimestamp( ROW_KEY, COLUMN_FAMILY, ANOTHER_QUALIFIER, timestamp)); assertTrue(Iterables.isEmpty(Iterables.filter(cells, predicate))); }
@Override public Predicate<Cell> apply(Cell deleteMarker) { checkArgument(CellUtil.isDelete(deleteMarker), "expecting delete marker cell."); switch (KeyValue.Type.codeToType(deleteMarker.getTypeByte())) { case Delete: return Predicates.and( new MatchQualifier(deleteMarker), new MatchExactTimestamp(deleteMarker)); case DeleteFamilyVersion: return new MatchExactTimestamp(deleteMarker); case DeleteColumn: return Predicates.and( new MatchQualifier(deleteMarker), new MatchTimestampRangeByUpperBound(deleteMarker)); case DeleteFamily: return new MatchTimestampRangeByUpperBound(deleteMarker); default: throw new IllegalStateException("Unexpected type byte: " + deleteMarker.getTypeByte()); } }
DataCellPredicateFactory implements Function<Cell, Predicate<Cell>> { @Override public Predicate<Cell> apply(Cell deleteMarker) { checkArgument(CellUtil.isDelete(deleteMarker), "expecting delete marker cell."); switch (KeyValue.Type.codeToType(deleteMarker.getTypeByte())) { case Delete: return Predicates.and( new MatchQualifier(deleteMarker), new MatchExactTimestamp(deleteMarker)); case DeleteFamilyVersion: return new MatchExactTimestamp(deleteMarker); case DeleteColumn: return Predicates.and( new MatchQualifier(deleteMarker), new MatchTimestampRangeByUpperBound(deleteMarker)); case DeleteFamily: return new MatchTimestampRangeByUpperBound(deleteMarker); default: throw new IllegalStateException("Unexpected type byte: " + deleteMarker.getTypeByte()); } } }
DataCellPredicateFactory implements Function<Cell, Predicate<Cell>> { @Override public Predicate<Cell> apply(Cell deleteMarker) { checkArgument(CellUtil.isDelete(deleteMarker), "expecting delete marker cell."); switch (KeyValue.Type.codeToType(deleteMarker.getTypeByte())) { case Delete: return Predicates.and( new MatchQualifier(deleteMarker), new MatchExactTimestamp(deleteMarker)); case DeleteFamilyVersion: return new MatchExactTimestamp(deleteMarker); case DeleteColumn: return Predicates.and( new MatchQualifier(deleteMarker), new MatchTimestampRangeByUpperBound(deleteMarker)); case DeleteFamily: return new MatchTimestampRangeByUpperBound(deleteMarker); default: throw new IllegalStateException("Unexpected type byte: " + deleteMarker.getTypeByte()); } }  }
DataCellPredicateFactory implements Function<Cell, Predicate<Cell>> { @Override public Predicate<Cell> apply(Cell deleteMarker) { checkArgument(CellUtil.isDelete(deleteMarker), "expecting delete marker cell."); switch (KeyValue.Type.codeToType(deleteMarker.getTypeByte())) { case Delete: return Predicates.and( new MatchQualifier(deleteMarker), new MatchExactTimestamp(deleteMarker)); case DeleteFamilyVersion: return new MatchExactTimestamp(deleteMarker); case DeleteColumn: return Predicates.and( new MatchQualifier(deleteMarker), new MatchTimestampRangeByUpperBound(deleteMarker)); case DeleteFamily: return new MatchTimestampRangeByUpperBound(deleteMarker); default: throw new IllegalStateException("Unexpected type byte: " + deleteMarker.getTypeByte()); } }  @Override Predicate<Cell> apply(Cell deleteMarker); }
DataCellPredicateFactory implements Function<Cell, Predicate<Cell>> { @Override public Predicate<Cell> apply(Cell deleteMarker) { checkArgument(CellUtil.isDelete(deleteMarker), "expecting delete marker cell."); switch (KeyValue.Type.codeToType(deleteMarker.getTypeByte())) { case Delete: return Predicates.and( new MatchQualifier(deleteMarker), new MatchExactTimestamp(deleteMarker)); case DeleteFamilyVersion: return new MatchExactTimestamp(deleteMarker); case DeleteColumn: return Predicates.and( new MatchQualifier(deleteMarker), new MatchTimestampRangeByUpperBound(deleteMarker)); case DeleteFamily: return new MatchTimestampRangeByUpperBound(deleteMarker); default: throw new IllegalStateException("Unexpected type byte: " + deleteMarker.getTypeByte()); } }  @Override Predicate<Cell> apply(Cell deleteMarker);  }