Package 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 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 Description static UnfilteredRowIterator
concat(Unfiltered first, UnfilteredRowIterator rest)
Returns an iterator that concatenate the specified atom with the iterator.static UnfilteredRowIterator
concat(UnfilteredRowIterator iter1, UnfilteredRowIterator iter2)
Returns an iterator that concatenate two atom iterators.static void
digest(UnfilteredRowIterator iterator, Digest 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)
Returns an iterator that is the result of merging other iterators.static UnfilteredRowIterator
merge(java.util.List<UnfilteredRowIterator> iterators, UnfilteredRowIterators.MergeListener mergeListener)
Returns an iterator that is the result of merging other iterators, and (optionally) using specific MergeListener.static UnfilteredRowIterator
noRowsIterator(TableMetadata metadata, DecoratedKey partitionKey, Row staticRow, DeletionTime partitionDeletion, boolean isReverseOrder)
Returns an empty unfiltered iterator for a given partition.static UnfilteredRowIterator
singleton(Unfiltered unfiltered, TableMetadata metadata, DecoratedKey partitionKey, DeletionTime partitionLevelDeletion, RegularAndStaticColumns columns, Row staticRow, boolean isReverseOrder, EncodingStats encodingStats)
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.
-
-
-
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)
Returns an iterator that is the result of merging other iterators.
-
merge
public static UnfilteredRowIterator merge(java.util.List<UnfilteredRowIterator> iterators, 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(TableMetadata metadata, DecoratedKey partitionKey, Row staticRow, DeletionTime partitionDeletion, boolean isReverseOrder)
Returns an empty unfiltered iterator for a given partition.
-
singleton
public static UnfilteredRowIterator singleton(Unfiltered unfiltered, TableMetadata metadata, DecoratedKey partitionKey, DeletionTime partitionLevelDeletion, RegularAndStaticColumns columns, Row staticRow, boolean isReverseOrder, EncodingStats encodingStats)
-
digest
public static void digest(UnfilteredRowIterator iterator, Digest digest, int version)
Digests the partition represented by the provided iterator.- Parameters:
iterator
- the iterator to digest.digest
- theDigest
to use.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
- theColumnFilter
to use when deciding which columns are the one queried by the user. This should be the filter that was used when queryingiterator
.- 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 fromiter2
come after the ones ofiter1
(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 aCorruptedSSTableException
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.
-
-