@Test public void testIncrementTimeRange() throws IOException { byte[] rowKey = dataHelper.randomData("rk1-"); Increment incr = new Increment(rowKey); incr.setTimeRange(0, 10); expectedException.expect(UnsupportedOperationException.class); expectedException.expectMessage("Setting the time range in an Increment is not implemented"); ReadModifyWriteRow readModifyWriteRow = ReadModifyWriteRow.create(TABLE_ID, ByteString.copyFrom(rowKey)); incrementAdapter.adapt(incr, readModifyWriteRow); }
@Override public void adapt(Increment operation, ReadModifyWriteRow readModifyWriteRow) { if (!operation.getTimeRange().isAllTime()) { throw new UnsupportedOperationException( "Setting the time range in an Increment is not implemented"); } for (Map.Entry<byte[], NavigableMap<byte[], Long>> familyEntry : operation.getFamilyMapOfLongs().entrySet()) { String familyName = Bytes.toString(familyEntry.getKey()); List<Cell> mutationCells = CellDeduplicationHelper.deduplicateFamily(operation, familyEntry.getKey()); for (Cell cell : mutationCells) { readModifyWriteRow.increment( familyName, ByteString.copyFrom( cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength()), Bytes.toLong(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength())); } } }
IncrementAdapter implements OperationAdapter<Increment, ReadModifyWriteRow> { @Override public void adapt(Increment operation, ReadModifyWriteRow readModifyWriteRow) { if (!operation.getTimeRange().isAllTime()) { throw new UnsupportedOperationException( "Setting the time range in an Increment is not implemented"); } for (Map.Entry<byte[], NavigableMap<byte[], Long>> familyEntry : operation.getFamilyMapOfLongs().entrySet()) { String familyName = Bytes.toString(familyEntry.getKey()); List<Cell> mutationCells = CellDeduplicationHelper.deduplicateFamily(operation, familyEntry.getKey()); for (Cell cell : mutationCells) { readModifyWriteRow.increment( familyName, ByteString.copyFrom( cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength()), Bytes.toLong(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength())); } } } }
IncrementAdapter implements OperationAdapter<Increment, ReadModifyWriteRow> { @Override public void adapt(Increment operation, ReadModifyWriteRow readModifyWriteRow) { if (!operation.getTimeRange().isAllTime()) { throw new UnsupportedOperationException( "Setting the time range in an Increment is not implemented"); } for (Map.Entry<byte[], NavigableMap<byte[], Long>> familyEntry : operation.getFamilyMapOfLongs().entrySet()) { String familyName = Bytes.toString(familyEntry.getKey()); List<Cell> mutationCells = CellDeduplicationHelper.deduplicateFamily(operation, familyEntry.getKey()); for (Cell cell : mutationCells) { readModifyWriteRow.increment( familyName, ByteString.copyFrom( cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength()), Bytes.toLong(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength())); } } }  }
IncrementAdapter implements OperationAdapter<Increment, ReadModifyWriteRow> { @Override public void adapt(Increment operation, ReadModifyWriteRow readModifyWriteRow) { if (!operation.getTimeRange().isAllTime()) { throw new UnsupportedOperationException( "Setting the time range in an Increment is not implemented"); } for (Map.Entry<byte[], NavigableMap<byte[], Long>> familyEntry : operation.getFamilyMapOfLongs().entrySet()) { String familyName = Bytes.toString(familyEntry.getKey()); List<Cell> mutationCells = CellDeduplicationHelper.deduplicateFamily(operation, familyEntry.getKey()); for (Cell cell : mutationCells) { readModifyWriteRow.increment( familyName, ByteString.copyFrom( cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength()), Bytes.toLong(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength())); } } }  @Override void adapt(Increment operation, ReadModifyWriteRow readModifyWriteRow); }
IncrementAdapter implements OperationAdapter<Increment, ReadModifyWriteRow> { @Override public void adapt(Increment operation, ReadModifyWriteRow readModifyWriteRow) { if (!operation.getTimeRange().isAllTime()) { throw new UnsupportedOperationException( "Setting the time range in an Increment is not implemented"); } for (Map.Entry<byte[], NavigableMap<byte[], Long>> familyEntry : operation.getFamilyMapOfLongs().entrySet()) { String familyName = Bytes.toString(familyEntry.getKey()); List<Cell> mutationCells = CellDeduplicationHelper.deduplicateFamily(operation, familyEntry.getKey()); for (Cell cell : mutationCells) { readModifyWriteRow.increment( familyName, ByteString.copyFrom( cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength()), Bytes.toLong(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength())); } } }  @Override void adapt(Increment operation, ReadModifyWriteRow readModifyWriteRow);  }