public SearchIterator<Clustering, Row> searchIterator(final ColumnFilter columns, final boolean reversed) { // TODO: we could optimize comparison for "NativeRow" à la #6755 final Holder current = holder(); return new SearchIterator<Clustering, Row>() { private final SearchIterator<Clustering, Row> rawIter = new BTreeSearchIterator<>(current.tree, metadata.comparator, desc(reversed)); private final DeletionTime partitionDeletion = current.deletionInfo.getPartitionDeletion(); public boolean hasNext() { return rawIter.hasNext(); } public Row next(Clustering clustering) { if (clustering == Clustering.STATIC_CLUSTERING) return staticRow(current, columns, true); Row row = rawIter.next(clustering); RangeTombstone rt = current.deletionInfo.rangeCovering(clustering); // A search iterator only return a row, so it doesn't allow to directly account for deletion that should apply to to row // (the partition deletion or the deletion of a range tombstone that covers it). So if needs be, reuse the row deletion // to carry the proper deletion on the row. DeletionTime activeDeletion = partitionDeletion; if (rt != null && rt.deletionTime().supersedes(activeDeletion)) activeDeletion = rt.deletionTime(); if (row == null) return activeDeletion.isLive() ? null : BTreeRow.emptyDeletedRow(clustering, Row.Deletion.regular(activeDeletion)); return row.filter(columns, activeDeletion, true, metadata); } }; }
public SearchIterator<Clustering, Row> searchIterator(final ColumnFilter columns, final boolean reversed) { // TODO: we could optimize comparison for "NativeRow" à la #6755 final Holder current = holder(); return new SearchIterator<Clustering, Row>() { private final SearchIterator<Clustering, Row> rawIter = new BTreeSearchIterator<>(current.tree, metadata.comparator, desc(reversed)); private final DeletionTime partitionDeletion = current.deletionInfo.getPartitionDeletion(); public Row next(Clustering clustering) { if (clustering == Clustering.STATIC_CLUSTERING) return staticRow(current, columns, true); Row row = rawIter.next(clustering); RangeTombstone rt = current.deletionInfo.rangeCovering(clustering); // A search iterator only return a row, so it doesn't allow to directly account for deletion that should apply to to row // (the partition deletion or the deletion of a range tombstone that covers it). So if needs be, reuse the row deletion // to carry the proper deletion on the row. DeletionTime activeDeletion = partitionDeletion; if (rt != null && rt.deletionTime().supersedes(activeDeletion)) activeDeletion = rt.deletionTime(); if (row == null) return activeDeletion.isLive() ? null : BTreeRow.emptyDeletedRow(clustering, Row.Deletion.regular(activeDeletion)); return row.filter(columns, activeDeletion, true, metadata); } }; }
public SearchIterator<Clustering, Row> searchIterator(final ColumnFilter columns, final boolean reversed) { // TODO: we could optimize comparison for "NativeRow" à la #6755 final Holder current = holder(); return new SearchIterator<Clustering, Row>() { private final SearchIterator<Clustering, Row> rawIter = new BTreeSearchIterator<>(current.tree, metadata.comparator, desc(reversed)); private final DeletionTime partitionDeletion = current.deletionInfo.getPartitionDeletion(); public Row next(Clustering clustering) { if (clustering == Clustering.STATIC_CLUSTERING) return staticRow(current, columns, true); Row row = rawIter.next(clustering); RangeTombstone rt = current.deletionInfo.rangeCovering(clustering); // A search iterator only return a row, so it doesn't allow to directly account for deletion that should apply to to row // (the partition deletion or the deletion of a range tombstone that covers it). So if needs be, reuse the row deletion // to carry the proper deletion on the row. DeletionTime activeDeletion = partitionDeletion; if (rt != null && rt.deletionTime().supersedes(activeDeletion)) activeDeletion = rt.deletionTime(); if (row == null) return activeDeletion.isLive() ? null : BTreeRow.emptyDeletedRow(clustering, Row.Deletion.regular(activeDeletion)); return row.filter(columns, activeDeletion, true, metadata); } }; }
public SearchIterator<Clustering, Row> searchIterator(final ColumnFilter columns, final boolean reversed) { // TODO: we could optimize comparison for "NativeRow" à la #6755 final Holder current = holder(); return new SearchIterator<Clustering, Row>() { private final SearchIterator<Clustering, Row> rawIter = new BTreeSearchIterator<>(current.tree, metadata.comparator, desc(reversed)); private final DeletionTime partitionDeletion = current.deletionInfo.getPartitionDeletion(); public Row next(Clustering clustering) { if (clustering == Clustering.STATIC_CLUSTERING) return staticRow(current, columns, true); Row row = rawIter.next(clustering); RangeTombstone rt = current.deletionInfo.rangeCovering(clustering); // A search iterator only return a row, so it doesn't allow to directly account for deletion that should apply to to row // (the partition deletion or the deletion of a range tombstone that covers it). So if needs be, reuse the row deletion // to carry the proper deletion on the row. DeletionTime activeDeletion = partitionDeletion; if (rt != null && rt.deletionTime().supersedes(activeDeletion)) activeDeletion = rt.deletionTime(); if (row == null) return activeDeletion.isLive() ? null : BTreeRow.emptyDeletedRow(clustering, Row.Deletion.regular(activeDeletion)); return row.filter(columns, activeDeletion, true, metadata); } }; }
private UnfilteredRowIterator sliceIterator(ColumnFilter selection, Slice slice, boolean reversed, Holder current, Row staticRow) { ClusteringBound start = slice.start() == ClusteringBound.BOTTOM ? null : slice.start(); ClusteringBound end = slice.end() == ClusteringBound.TOP ? null : slice.end(); Iterator<Row> rowIter = BTree.slice(current.tree, metadata.comparator, start, true, end, true, desc(reversed)); Iterator<RangeTombstone> deleteIter = current.deletionInfo.rangeIterator(slice, reversed); return merge(rowIter, deleteIter, selection, reversed, current, staticRow); }
private UnfilteredRowIterator sliceIterator(ColumnFilter selection, Slice slice, boolean reversed, Holder current, Row staticRow) { ClusteringBound start = slice.start() == ClusteringBound.BOTTOM ? null : slice.start(); ClusteringBound end = slice.end() == ClusteringBound.TOP ? null : slice.end(); Iterator<Row> rowIter = BTree.slice(current.tree, metadata.comparator, start, true, end, true, desc(reversed)); Iterator<RangeTombstone> deleteIter = current.deletionInfo.rangeIterator(slice, reversed); return merge(rowIter, deleteIter, selection, reversed, current, staticRow); }
private UnfilteredRowIterator sliceIterator(ColumnFilter selection, Slice slice, boolean reversed, Holder current, Row staticRow) { ClusteringBound start = slice.start() == ClusteringBound.BOTTOM ? null : slice.start(); ClusteringBound end = slice.end() == ClusteringBound.TOP ? null : slice.end(); Iterator<Row> rowIter = BTree.slice(current.tree, metadata.comparator, start, true, end, true, desc(reversed)); Iterator<RangeTombstone> deleteIter = current.deletionInfo.rangeIterator(slice, reversed); return merge(rowIter, deleteIter, selection, reversed, current, staticRow); }
private UnfilteredRowIterator sliceIterator(ColumnFilter selection, Slice slice, boolean reversed, Holder current, Row staticRow) { ClusteringBound start = slice.start() == ClusteringBound.BOTTOM ? null : slice.start(); ClusteringBound end = slice.end() == ClusteringBound.TOP ? null : slice.end(); Iterator<Row> rowIter = BTree.slice(current.tree, metadata.comparator, start, true, end, true, desc(reversed)); Iterator<RangeTombstone> deleteIter = current.deletionInfo.rangeIterator(slice, reversed); return merge(rowIter, deleteIter, selection, reversed, current, staticRow); }