Class Transformation<I extends BaseRowIterator<?>>
java.lang.Object
org.apache.cassandra.db.transform.Transformation<I>
- Direct Known Subclasses:
DuplicateRowChecker,EmptyPartitionsDiscarder,EnsureOnHeap,Filter,PurgeFunction,RTBoundCloser,RTBoundValidator,ShortReadPartitionsProtection,StoppingTransformation,TopPartitionTracker.TombstoneCounter,WithOnlyQueriedData
We have a single common superclass for all Transformations to make implementation efficient.
we have a shared stack for all transformations, and can share the same transformation across partition and row
iterators, reducing garbage. Internal code is also simplified by always having a basic no-op implementation to invoke.
Only the necessary methods need be overridden. Early termination is provided by invoking the method's stop or stopInPartition
methods, rather than having their own abstract method to invoke, as this is both more efficient and simpler to reason about.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic PartitionIteratorapply(PartitionIterator iterator, Transformation<? super RowIterator> transformation) static UnfilteredPartitionIteratorapply(UnfilteredPartitionIterator iterator, Transformation<? super UnfilteredRowIterator> transformation) static RowIteratorapply(RowIterator iterator, Transformation<?> transformation) static UnfilteredRowIteratorapply(UnfilteredRowIterator iterator, Transformation<?> transformation) protected DeletionTimeapplyToDeletion(DeletionTime deletionTime) Applied to the partition-level deletion of any rows iterator.protected RangeTombstoneMarkerapplyToMarker(RangeTombstoneMarker marker) Applied to any RTM we encounter in a rows/unfiltered iteratorprotected IapplyToPartition(I partition) Applied to any rows iterator (partition) we encounter in a partitions iteratorprotected RegularAndStaticColumnsApplied to thePartitionColumnsof any rows iterator.protected DecoratedKeyApplied to the partition key of any rows/unfiltered iterator we are applied toprotected RowapplyToRow(Row row) Applied to any row we encounter in a rows iteratorprotected RowapplyToStatic(Row row) Applied to the static row of any rows iterator.protected voidonClose()Run on the close of any (logical) partitions iterator this function was applied to We stipulate logical, because if applied to a transformed iterator the lifetime of the iterator object may be longer than the lifetime of the "logical" iterator it was applied to; if the iterator is refilled with MoreContents, for instance, the iterator may outlive this functionprotected voidRun on the close of any (logical) rows iterator this function was applied to We stipulate logical, because if applied to a transformed iterator the lifetime of the iterator object may be longer than the lifetime of the "logical" iterator it was applied to; if the iterator is refilled with MoreContents, for instance, the iterator may outlive this function
-
Constructor Details
-
Transformation
public Transformation()
-
-
Method Details
-
onClose
protected void onClose()Run on the close of any (logical) partitions iterator this function was applied to We stipulate logical, because if applied to a transformed iterator the lifetime of the iterator object may be longer than the lifetime of the "logical" iterator it was applied to; if the iterator is refilled with MoreContents, for instance, the iterator may outlive this function -
onPartitionClose
protected void onPartitionClose()Run on the close of any (logical) rows iterator this function was applied to We stipulate logical, because if applied to a transformed iterator the lifetime of the iterator object may be longer than the lifetime of the "logical" iterator it was applied to; if the iterator is refilled with MoreContents, for instance, the iterator may outlive this function -
applyToPartition
Applied to any rows iterator (partition) we encounter in a partitions iterator -
applyToRow
Applied to any row we encounter in a rows iterator -
applyToMarker
Applied to any RTM we encounter in a rows/unfiltered iterator -
applyToPartitionKey
Applied to the partition key of any rows/unfiltered iterator we are applied to -
applyToStatic
Applied to the static row of any rows iterator. NOTE that this is only applied to the first iterator in any sequence of iterators filled by a MoreContents; the static data for such iterators is all expected to be equal -
applyToDeletion
Applied to the partition-level deletion of any rows iterator. NOTE that this is only applied to the first iterator in any sequence of iterators filled by a MoreContents; the static data for such iterators is all expected to be equal -
applyToPartitionColumns
Applied to thePartitionColumnsof any rows iterator. NOTE: same remark than for applyToDeletion: it is only applied to the first iterator in a sequence of iterators filled by MoreContents. -
apply
public static UnfilteredPartitionIterator apply(UnfilteredPartitionIterator iterator, Transformation<? super UnfilteredRowIterator> transformation) -
apply
public static PartitionIterator apply(PartitionIterator iterator, Transformation<? super RowIterator> transformation) -
apply
public static UnfilteredRowIterator apply(UnfilteredRowIterator iterator, Transformation<?> transformation) -
apply
-