Source:
private UnfilteredRowIterator filterStaleEntries(UnfilteredRowIterator dataIter, final ByteBuffer indexValue, final List<IndexEntry> entries, final OpOrder.Group writeOp, final int nowInSec) { final List<IndexEntry> staleEntries = new ArrayList<>(); if (!dataIter.partitionLevelDeletion().isLive()) { DeletionTime deletion = dataIter.partitionLevelDeletion(); entries.forEach(e -> { if (deletion.deletes(e.timestamp)) staleEntries.add(e); }); } ClusteringComparator comparator = dataIter.metadata().comparator; class Transform extends Transformation { private int entriesIdx; @Override public Row applyToRow(Row row) { IndexEntry entry = findEntry(row.clustering()); if (!index.isStale(row, indexValue, nowInSec)) return row; staleEntries.add(entry); return null; } private IndexEntry findEntry(Clustering clustering) { assert entriesIdx < entries.size(); while (entriesIdx < entries.size()) { IndexEntry entry = entries.get(entriesIdx++); Clustering indexedEntryClustering = entry.indexedEntryClustering; int cmp = comparator.compare(indexedEntryClustering, clustering); assert cmp <= 0; if (cmp == 0) return entry; else { boolean isStaticClustering = dataIter.metadata().hasStaticColumns(); if (isStaticClustering) { int i = 0; for (; i < indexedEntryClustering.size() && indexedEntryClustering.get(i) == null; i++); isStaticClustering = i == indexedEntryClustering.size(); } if (!isStaticClustering) staleEntries.add(entry); } } throw new AssertionError(); } @Override public void onPartitionClose() { deleteAllEntries(staleEntries, writeOp, nowInSec); } } return Transformation.apply(dataIter, new Transform()); }

Target:
private UnfilteredRowIterator filterStaleEntries(UnfilteredRowIterator dataIter, final ByteBuffer indexValue, final List<IndexEntry> entries, final OpOrder.Group writeOp, final int nowInSec) { final List<IndexEntry> staleEntries = new ArrayList<>(); if (!dataIter.partitionLevelDeletion().isLive()) { DeletionTime deletion = dataIter.partitionLevelDeletion(); entries.forEach(e -> { if (deletion.deletes(e.timestamp)) staleEntries.add(e); }); } ClusteringComparator comparator = dataIter.metadata().comparator; class Transform extends Transformation { private int entriesIdx; @Override public Row applyToRow(Row row) { IndexEntry entry = findEntry(row.clustering()); if (!index.isStale(row, indexValue, nowInSec)) return row; staleEntries.add(entry); return null; } private IndexEntry findEntry(Clustering clustering) { assert entriesIdx < entries.size(); while (entriesIdx < entries.size()) { IndexEntry entry = entries.get(entriesIdx++); Clustering indexedEntryClustering = entry.indexedEntryClustering; int cmp = comparator.compare(indexedEntryClustering, clustering); assert cmp <= 0; if (cmp == 0) return entry; else { if (!dataIter.metadata().hasStaticColumns() || !containsOnlyNullValues(indexedEntryClustering)) staleEntries.add(entry); } } throw new AssertionError(); } private boolean containsOnlyNullValues(Clustering indexedEntryClustering) { int i = 0; for (; i < indexedEntryClustering.size() && indexedEntryClustering.get(i) == null; i++); return i == indexedEntryClustering.size(); } @Override public void onPartitionClose() { deleteAllEntries(staleEntries, writeOp, nowInSec); } } return Transformation.apply(dataIter, new Transform()); }