org.apache.cassandra.db.compaction

## Class LazilyCompactedRow

- java.lang.Object
- - org.apache.cassandra.db.compaction.AbstractCompactedRow
  - - org.apache.cassandra.db.compaction.LazilyCompactedRow

- All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, java.lang.Iterable<OnDiskAtom>

      public class LazilyCompactedRow
      extends AbstractCompactedRow
      implements java.lang.Iterable<OnDiskAtom>

  LazilyCompactedRow only computes the row bloom filter and column index in memory (at construction time); it does this by reading one column at a time from each of the rows being compacted, and merging them as it does so. So the most we have in memory at a time is the bloom filter, the index, and one column from each pre-compaction row. When write() or update() is called, a second pass is made over the pre-compaction rows to write the merged columns or update the hash, again with at most one column from each row deserialized at a time.

- - ### Field Summary

    - ### Fields inherited from class org.apache.cassandra.db.compaction.AbstractCompactedRow

      `key`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `LazilyCompactedRow(CompactionController controller, java.util.List<? extends ICountableColumnIterator> rows)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `ColumnStats` | `columnStats()`
    `DeletionInfo` | `deletionInfo()`
    `AbstractType<?>` | `getComparator()`
    `int` | `getEstimatedColumnCount()`
    `ColumnIndex` | `index()`
    `boolean` | `isEmpty()`
    `java.util.Iterator<OnDiskAtom>` | `iterator()`
    `void` | `update(java.security.MessageDigest digest)` update @param digest with the data bytes of the row (not including row key or row size).
    `long` | `write(java.io.DataOutput out)` write the row (size + column index + filter + column data, but NOT row key) to @param out.

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

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

- - ### Constructor Detail

    - #### LazilyCompactedRow

          public LazilyCompactedRow(CompactionController controller,
                            java.util.List<? extends ICountableColumnIterator> rows)

  - ### Method Detail

    - #### write

          public long write(java.io.DataOutput out)
                     throws java.io.IOException

      Description copied from class: `AbstractCompactedRow`
      write the row (size + column index + filter + column data, but NOT row key) to @param out. It is an error to call this if isEmpty is false. (Because the key is appended first, so we'd have an incomplete row written.) write() may change internal state; it is NOT valid to call write() or update() a second time.
      Specified by:
        `write` in class `AbstractCompactedRow`
      Throws:
        `java.io.IOException`

    - #### update

          public void update(java.security.MessageDigest digest)

      Description copied from class: `AbstractCompactedRow`
      update @param digest with the data bytes of the row (not including row key or row size). May be called even if empty. update() may change internal state; it is NOT valid to call write() or update() a second time.
      Specified by:
        `update` in class `AbstractCompactedRow`

    - #### isEmpty

          public boolean isEmpty()

      Specified by:
        `isEmpty` in class `AbstractCompactedRow`
      Returns:
        true if there are no columns in the row AND there are no row-level tombstones to be preserved

    - #### getEstimatedColumnCount

          public int getEstimatedColumnCount()

    - #### getComparator

          public AbstractType<?> getComparator()

    - #### iterator

          public java.util.Iterator<OnDiskAtom> iterator()

      Specified by:
        `iterator` in interface `java.lang.Iterable<OnDiskAtom>`

    - #### columnStats

          public ColumnStats columnStats()

      Specified by:
        `columnStats` in class `AbstractCompactedRow`
      Returns:
        aggregate information about the columns in this row. Some fields may contain default values if computing them value would require extra effort we're not willing to make.

    - #### close

          public void close()

      Specified by:
        `close` in interface `java.io.Closeable`
      Specified by:
        `close` in interface `java.lang.AutoCloseable`

    - #### deletionInfo

          public DeletionInfo deletionInfo()

      Specified by:
        `deletionInfo` in class `AbstractCompactedRow`
      Returns:
        the compacted row deletion infos.

    - #### index

          public ColumnIndex index()

      Specified by:
        `index` in class `AbstractCompactedRow`
      Returns:
        the column index for this row.

Copyright © 2014 The Apache Software Foundation