org.apache.cassandra.db.rows

## Class UnfilteredRowIterators

- java.lang.Object
- - org.apache.cassandra.db.rows.UnfilteredRowIterators

-     public abstract class UnfilteredRowIterators
      extends java.lang.Object

  Static methods to work with atom iterators.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static interface` | `UnfilteredRowIterators.MergeListener` Interface for a listener interested in the result of merging multiple versions of a given row.

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static UnfilteredRowIterator` | `concat(UnfilteredRowIterator iter1, UnfilteredRowIterator iter2)` Returns an iterator that concatenate two atom iterators.
    `static UnfilteredRowIterator` | `concat(Unfiltered first, UnfilteredRowIterator rest)` Returns an iterator that concatenate the specified atom with the iterator.
    `static void` | `digest(ReadCommand command, UnfilteredRowIterator iterator, java.security.MessageDigest digest, int version)` Digests the partition represented by the provided iterator.
    `static RowIterator` | `filter(UnfilteredRowIterator iter, int nowInSec)` Returns a iterator that only returns rows with only live content.
    `static UnfilteredRowIterator` | `loggingIterator(UnfilteredRowIterator iterator, java.lang.String id, boolean fullDetails)` Wraps the provided iterator so it logs the returned atoms for debugging purposes.
    `static UnfilteredRowIterator` | `merge(java.util.List<UnfilteredRowIterator> iterators, int nowInSec)` Returns an iterator that is the result of merging other iterators.
    `static UnfilteredRowIterator` | `merge(java.util.List<UnfilteredRowIterator> iterators, int nowInSec, UnfilteredRowIterators.MergeListener mergeListener)` Returns an iterator that is the result of merging other iterators, and (optionally) using specific MergeListener.
    `static UnfilteredRowIterator` | `noRowsIterator(CFMetaData cfm, DecoratedKey partitionKey, Row staticRow, DeletionTime partitionDeletion, boolean isReverseOrder)` Returns an empty unfiltered iterator for a given partition.
    `static UnfilteredRowIterator` | `withOnlyQueriedData(UnfilteredRowIterator iterator, ColumnFilter filter)` Filter the provided iterator to exclude cells that have been fetched but are not queried by the user (see ColumnFilter for detailes).
    `static UnfilteredRowIterator` | `withValidation(UnfilteredRowIterator iterator, java.lang.String filename)` Validate that the data of the provided iterator is valid, that is that the values it contains are valid for the type they represent, and more generally that the infos stored are sensible.

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

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

- - ### Method Detail

    - #### filter

          public static RowIterator filter(UnfilteredRowIterator iter,
                                           int nowInSec)

      Returns a iterator that only returns rows with only live content. This is mainly used in the CQL layer when we know we don't care about deletion infos (and since an UnfilteredRowIterator cannot shadow it's own data, we know everyting returned isn't shadowed by a tombstone).

    - #### merge

          public static UnfilteredRowIterator merge(java.util.List<UnfilteredRowIterator> iterators,
                                                    int nowInSec)

      Returns an iterator that is the result of merging other iterators.

    - #### merge

          public static UnfilteredRowIterator merge(java.util.List<UnfilteredRowIterator> iterators,
                                                    int nowInSec,
                                                    UnfilteredRowIterators.MergeListener mergeListener)

      Returns an iterator that is the result of merging other iterators, and (optionally) using specific MergeListener. Note that this method assumes that there is at least 2 iterators to merge.

    - #### noRowsIterator

          public static UnfilteredRowIterator noRowsIterator(CFMetaData cfm,
                                                             DecoratedKey partitionKey,
                                                             Row staticRow,
                                                             DeletionTime partitionDeletion,
                                                             boolean isReverseOrder)

      Returns an empty unfiltered iterator for a given partition.

    - #### digest

          public static void digest(ReadCommand command,
                                    UnfilteredRowIterator iterator,
                                    java.security.MessageDigest digest,
                                    int version)

      Digests the partition represented by the provided iterator.
      Parameters:
        `command` - the command that has yield `iterator`. This can be null if `version >= MessagingService.VERSION_30` as this is only used when producing digest to be sent to legacy nodes.
        `iterator` - the iterator to digest.
        `digest` - the `MessageDigest` to use for the digest.
        `version` - the messaging protocol to use when producing the digest.

    - #### withOnlyQueriedData

          public static UnfilteredRowIterator withOnlyQueriedData(UnfilteredRowIterator iterator,
                                                                  ColumnFilter filter)

      Filter the provided iterator to exclude cells that have been fetched but are not queried by the user (see ColumnFilter for detailes).
      Parameters:
        `iterator` - the iterator to filter.
        `filter` - the `ColumnFilter` to use when deciding which columns are the one queried by the user. This should be the filter that was used when querying `iterator`.
      Returns:
        the filtered iterator..

    - #### concat

          public static UnfilteredRowIterator concat(UnfilteredRowIterator iter1,
                                                     UnfilteredRowIterator iter2)

      Returns an iterator that concatenate two atom iterators. This method assumes that both iterator are from the same partition and that the atom from `iter2` come after the ones of `iter1` (that is, that concatenating the iterator make sense).

    - #### concat

          public static UnfilteredRowIterator concat(Unfiltered first,
                                                     UnfilteredRowIterator rest)

      Returns an iterator that concatenate the specified atom with the iterator.

    - #### withValidation

          public static UnfilteredRowIterator withValidation(UnfilteredRowIterator iterator,
                                                             java.lang.String filename)

      Validate that the data of the provided iterator is valid, that is that the values it contains are valid for the type they represent, and more generally that the infos stored are sensible. This is mainly used by scrubber to detect problems in sstables.
      Parameters:
        `iterator` - the partition to check.
        `filename` - the name of the file the data is comming from.
      Returns:
        an iterator that returns the same data than `iterator` but that checks said data and throws a `CorruptedSSTableException` if it detects invalid data.

    - #### loggingIterator

          public static UnfilteredRowIterator loggingIterator(UnfilteredRowIterator iterator,
                                                              java.lang.String id,
                                                              boolean fullDetails)

      Wraps the provided iterator so it logs the returned atoms for debugging purposes.

      Note that this is only meant for debugging as this can log a very large amount of logging at INFO.

Copyright © 2018 The Apache Software Foundation