Source:
private void deleteOnSingleHost(final InetSocketAddress host, final TableReference tableRef, final Map<Cell, Collection<Long>> cellVersionsMap) { try { clientPool.runWithRetryOnHost(host, new FunctionCheckedException<CassandraClient, Void, Exception>() { private int numVersions = 0; @Override public Void apply(CassandraClient client) throws Exception { Map<Integer, MutationMap> mutationMaps = Maps.newTreeMap(); for (Map.Entry<Cell, Collection<Long>> cellVersions : cellVersionsMap.entrySet()) { int mapIndex = 0; for (long ts : Ordering.natural().immutableSortedCopy(cellVersions.getValue())) { if (!mutationMaps.containsKey(mapIndex)) { mutationMaps.put(mapIndex, new MutationMap()); } MutationMap mutationMap = mutationMaps.get(mapIndex); ByteBuffer colName = CassandraKeyValueServices.makeCompositeBuffer( cellVersions.getKey().getColumnName(), ts); SlicePredicate pred = new SlicePredicate(); pred.setColumn_names(Arrays.asList(colName)); Deletion del = new Deletion(); del.setPredicate(pred); del.setTimestamp(deleteTimestampGetter.apply(ts)); Mutation mutation = new Mutation(); mutation.setDeletion(del); mutationMap.addMutationForCell(cellVersions.getKey(), tableRef, mutation); mapIndex++; numVersions += cellVersions.getValue().size(); } } for (MutationMap map : mutationMaps.values()) { wrappingQueryRunner.batchMutate("delete", client, ImmutableSet.of(tableRef), map, deleteConsistency); } return null; } @Override public String toString() { return "delete_batch_mutate(" + host + ", " + tableRef.getQualifiedName() + ", " + numVersions + " total versions of " + cellVersionsMap.size() + " keys)"; } }); } catch (UnavailableException e) { throw new InsufficientConsistencyException("Deleting requires all Cassandra nodes to be up and available.", e); } catch (Exception e) { throw QosAwareThrowables.unwrapAndThrowRateLimitExceededOrAtlasDbDependencyException(e); } }

Target:
private void deleteOnSingleHost(final InetSocketAddress host, final TableReference tableRef, final Map<Cell, Collection<Long>> cellVersionsMap) { try { clientPool.runWithRetryOnHost(host, new FunctionCheckedException<CassandraClient, Void, Exception>() { private int numVersions = 0; @Override public Void apply(CassandraClient client) throws Exception { Map<Integer, MutationMap> mutationMaps = Maps.newTreeMap(); for (Map.Entry<Cell, Collection<Long>> cellVersions : cellVersionsMap.entrySet()) { int mapIndex = 0; for (long ts : Ordering.natural().immutableSortedCopy(cellVersions.getValue())) { if (!mutationMaps.containsKey(mapIndex)) { mutationMaps.put(mapIndex, new MutationMap()); } MutationMap mutationMap = mutationMaps.get(mapIndex); ByteBuffer colName = CassandraKeyValueServices.makeCompositeBuffer( cellVersions.getKey().getColumnName(), ts); SlicePredicate pred = new SlicePredicate(); pred.setColumn_names(Collections.singletonList(colName)); Deletion del = new Deletion(); del.setPredicate(pred); del.setTimestamp(deleteTimestampGetter.applyAsLong(ts)); Mutation mutation = new Mutation(); mutation.setDeletion(del); mutationMap.addMutationForCell(cellVersions.getKey(), tableRef, mutation); mapIndex++; numVersions += cellVersions.getValue().size(); } } for (MutationMap map : mutationMaps.values()) { wrappingQueryRunner.batchMutate("delete", client, ImmutableSet.of(tableRef), map, deleteConsistency); } return null; } @Override public String toString() { return "delete_batch_mutate(" + host + ", " + tableRef.getQualifiedName() + ", " + numVersions + " total versions of " + cellVersionsMap.size() + " keys)"; } }); } catch (UnavailableException e) { throw new InsufficientConsistencyException("Deleting requires all Cassandra nodes to be up and available.", e); } catch (Exception e) { throw QosAwareThrowables.unwrapAndThrowRateLimitExceededOrAtlasDbDependencyException(e); } }