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

org.apache.cassandra.thrift

## Class ThriftResultsMerger

- java.lang.Object
- - org.apache.cassandra.db.transform.Transformation<UnfilteredRowIterator>
  - - org.apache.cassandra.thrift.ThriftResultsMerger

-     public class ThriftResultsMerger
      extends Transformation<UnfilteredRowIterator>

  Given an iterator on a partition of a compact table, this return an iterator that merges the static row columns with the other results. Compact tables stores thrift column_metadata as static columns (see CompactTables for details). When reading for thrift however, we want to merge those static values with other results because: 1) on thrift, all "columns" are sorted together, whether or not they are declared column_metadata. 2) it's possible that a table add a value for a "dynamic" column, and later that column is statically defined. Merging "static" and "dynamic" columns make sure we don't miss a value prior to the column declaration. For example, if a thrift table declare 2 columns "c1" and "c5" and the results from a query is: Partition: static: { c1: 3, c5: 4 } "a" : { value : 2 } "c3": { value : 8 } "c7": { value : 1 } then this class transform it into: Partition: "a" : { value : 2 } "c1": { value : 3 } "c3": { value : 8 } "c5": { value : 4 } "c7": { value : 1 }

- - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `UnfilteredRowIterator` | `applyToPartition(UnfilteredRowIterator iter)` Applied to any rows iterator (partition) we encounter in a partitions iterator
    `static UnfilteredPartitionIterator` | `maybeWrap(UnfilteredPartitionIterator iterator, CFMetaData metadata, int nowInSec)`
    `static UnfilteredRowIterator` | `maybeWrap(UnfilteredRowIterator iterator, int nowInSec)`

    - ### Methods inherited from class org.apache.cassandra.db.transform.Transformation

      `apply, apply, apply, apply, applyToDeletion, applyToMarker, applyToPartitionColumns, applyToPartitionKey, applyToRow, applyToStatic, onClose, onPartitionClose`

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

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

- - ### Method Detail

    - #### maybeWrap

          public static UnfilteredPartitionIterator maybeWrap(UnfilteredPartitionIterator iterator,
                                                              CFMetaData metadata,
                                                              int nowInSec)

    - #### maybeWrap

          public static UnfilteredRowIterator maybeWrap(UnfilteredRowIterator iterator,
                                                        int nowInSec)

    - #### applyToPartition

          public UnfilteredRowIterator applyToPartition(UnfilteredRowIterator iter)

      Description copied from class: `Transformation`
      Applied to any rows iterator (partition) we encounter in a partitions iterator
      Overrides:
        `applyToPartition` in class `Transformation<UnfilteredRowIterator>`

Copyright © 2018 The Apache Software Foundation