Source:
<code>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 { <START> boolean isStaticClustering = dataIter.metadata().hasStaticColumns(); <END> 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()); }</code><technical_language>is effectively a bit hard read. I done like: boolean hasStaticColumns = dataIter.metadata().hasStaticColumns(); // COMPACT COMPOSITE tables support null values in clustering key // tables do support static columns. consequence if a table // some static columns clustering key elements null // means partition exists contains static data if (!hasStaticColumns() || !containsOnlyNullValues(indexedEntryClustering) staleEntries.add(entry); do think</technical_language>

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()); }