Transformation (apache-cassandra API)
Date: 2018-02-14

org.apache.cassandra.db.transform

## Class Transformation<I extends BaseRowIterator<?>>

- java.lang.Object
- - org.apache.cassandra.db.transform.Transformation<I>

- Direct Known Subclasses:
    EmptyPartitionsDiscarder, EnsureOnHeap, Filter, PurgeFunction, StoppingTransformation, ThriftResultsMerger, WithOnlyQueriedData

      public abstract class Transformation<I extends BaseRowIterator<?>>
      extends java.lang.Object

  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
    Constructor and Description
    `Transformation()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static PartitionIterator` | `apply(PartitionIterator iterator, Transformation<? super RowIterator> transformation)`
    `static RowIterator` | `apply(RowIterator iterator, Transformation<?> transformation)`
    `static UnfilteredPartitionIterator` | `apply(UnfilteredPartitionIterator iterator, Transformation<? super UnfilteredRowIterator> transformation)`
    `static UnfilteredRowIterator` | `apply(UnfilteredRowIterator iterator, Transformation<?> transformation)`
    `protected DeletionTime` | `applyToDeletion(DeletionTime deletionTime)` Applied to the partition-level deletion of any rows iterator.
    `protected RangeTombstoneMarker` | `applyToMarker(RangeTombstoneMarker marker)` Applied to any RTM we encounter in a rows/unfiltered iterator
    `protected I` | `applyToPartition(I partition)` Applied to any rows iterator (partition) we encounter in a partitions iterator
    `protected PartitionColumns` | `applyToPartitionColumns(PartitionColumns columns)` Applied to the `PartitionColumns` of any rows iterator.
    `protected DecoratedKey` | `applyToPartitionKey(DecoratedKey key)` Applied to the partition key of any rows/unfiltered iterator we are applied to
    `protected Row` | `applyToRow(Row row)` Applied to any row we encounter in a rows iterator
    `protected Row` | `applyToStatic(Row row)` Applied to the static row of any rows iterator.
    `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
    `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

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Transformation

          public Transformation()

  - ### Method Detail

    - #### 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

          protected I applyToPartition(I partition)

      Applied to any rows iterator (partition) we encounter in a partitions iterator

    - #### applyToRow

          protected Row applyToRow(Row row)

      Applied to any row we encounter in a rows iterator

    - #### applyToMarker

          protected RangeTombstoneMarker applyToMarker(RangeTombstoneMarker marker)

      Applied to any RTM we encounter in a rows/unfiltered iterator

    - #### applyToPartitionKey

          protected DecoratedKey applyToPartitionKey(DecoratedKey key)

      Applied to the partition key of any rows/unfiltered iterator we are applied to

    - #### applyToStatic

          protected Row applyToStatic(Row row)

      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

          protected DeletionTime applyToDeletion(DeletionTime deletionTime)

      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

          protected PartitionColumns applyToPartitionColumns(PartitionColumns columns)

      Applied to the `PartitionColumns` of 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

          public static RowIterator apply(RowIterator iterator,
                                          Transformation<?> transformation)

Copyright © 2018 The Apache Software Foundation