org.apache.cassandra.db.rows

## Class Rows

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

-     public abstract class Rows
      extends java.lang.Object

  Static utilities to work on Row objects.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static Row` | `EMPTY_STATIC_ROW`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static int` | `collectStats(Row row, PartitionStatisticsCollector collector)` Collect statistics on a given row.
    `static Row.Builder` | `copy(Row row, Row.Builder builder)`
    `static void` | `diff(RowDiffListener diffListener, Row merged, Row... inputs)` Given the result (`merged`) of merging multiple `inputs`, signals the difference between each input and `merged` to `diffListener`.
    `static Row` | `merge(Row row1, Row row2, int nowInSec)`
    `static long` | `merge(Row existing, Row update, Row.Builder builder, int nowInSec)` Merges two rows into the given builder, mainly for merging memtable rows.
    `static Row` | `removeShadowedCells(Row existing, Row update, DeletionTime rangeDeletion, int nowInSec)` Returns a row that is obtained from the given existing row by removing everything that is shadowed by data in the update row.
    `static Row.SimpleBuilder` | `simpleBuilder(CFMetaData metadata, java.lang.Object... clusteringValues)` Creates a new simple row builder.

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

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

- - ### Field Detail

    - #### EMPTY_STATIC_ROW

          public static final Row EMPTY_STATIC_ROW

  - ### Method Detail

    - #### copy

          public static Row.Builder copy(Row row,
                                         Row.Builder builder)

    - #### simpleBuilder

          public static Row.SimpleBuilder simpleBuilder(CFMetaData metadata,
                                                        java.lang.Object... clusteringValues)

      Creates a new simple row builder.
      Parameters:
        `metadata` - the metadata of the table this is a row of.
        `clusteringValues` - the value for the clustering columns of the row to add to this build. There may be no values if either the table has no clustering column, or if you want to edit the static row. Note that as a shortcut it is also allowed to pass a `Clustering` object directly, in which case that should be the only argument.
      Returns:
        a newly created builder.

    - #### collectStats

          public static int collectStats(Row row,
                                         PartitionStatisticsCollector collector)

      Collect statistics on a given row.
      Parameters:
        `row` - the row for which to collect stats.
        `collector` - the stats collector.
      Returns:
        the total number of cells in `row`.

    - #### diff

          public static void diff(RowDiffListener diffListener,
                                  Row merged,
                                  Row... inputs)

      Given the result (`merged`) of merging multiple `inputs`, signals the difference between each input and `merged` to `diffListener`.

      Note that this method doesn't only emit cells etc where there's a difference. The listener is informed of every corresponding entity between the merged and input rows, including those that are equal.

      Parameters:
        `diffListener` - the listener to which to signal the differences between the inputs and the merged result.
        `merged` - the result of merging `inputs`.
        `inputs` - the inputs whose merge yielded `merged`.

    - #### merge

          public static Row merge(Row row1,
                                  Row row2,
                                  int nowInSec)

    - #### merge

          public static long merge(Row existing,
                                   Row update,
                                   Row.Builder builder,
                                   int nowInSec)

      Merges two rows into the given builder, mainly for merging memtable rows. In addition to reconciling the cells in each row, the liveness info, and deletion times for the row and complex columns are also merged.

      Note that this method assumes that the provided rows can meaningfully be reconciled together. That is, that the rows share the same clustering value, and belong to the same partition.

      Parameters:
        `existing` -
        `update` -
        `builder` - the row build to which the result of the reconciliation is written.
        `nowInSec` - the current time in seconds (which plays a role during reconciliation because deleted cells always have precedence on timestamp equality and deciding if a cell is a live or not depends on the current time due to expiring cells).
      Returns:
        the smallest timestamp delta between corresponding rows from existing and update. A timestamp delta being computed as the difference between the cells and DeletionTimes from `existing` and those in `existing`.

    - #### removeShadowedCells

          public static Row removeShadowedCells(Row existing,
                                                Row update,
                                                DeletionTime rangeDeletion,
                                                int nowInSec)

      Returns a row that is obtained from the given existing row by removing everything that is shadowed by data in the update row. In other words, produces the smallest result row such that `merge(result, update, nowInSec) == merge(existing, update, nowInSec)` after filtering by rangeDeletion.
      Parameters:
        `existing` - source row
        `update` - shadowing row
        `rangeDeletion` - extra `DeletionTime` from covering tombstone
        `nowInSec` - the current time in seconds (which plays a role during reconciliation because deleted cells always have precedence on timestamp equality and deciding if a cell is a live or not depends on the current time due to expiring cells).

Copyright © 2018 The Apache Software Foundation