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

org.apache.cassandra.db

## Class PartitionRangeReadCommand

- java.lang.Object
- - org.apache.cassandra.db.monitoring.MonitorableImpl
  - - org.apache.cassandra.db.ReadCommand
    - - org.apache.cassandra.db.PartitionRangeReadCommand

- All Implemented Interfaces:
    Monitorable, ReadQuery

      public class PartitionRangeReadCommand
      extends ReadCommand

  A read command that selects a (part of a) range of partitions.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.cassandra.db.ReadCommand

      `ReadCommand.CheckForAbort, ReadCommand.Kind, ReadCommand.SelectionDeserializer`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static ReadCommand.SelectionDeserializer` | `selectionDeserializer`

    - ### Fields inherited from class org.apache.cassandra.db.ReadCommand

      `legacyPagedRangeCommandSerializer, legacyRangeSliceCommandSerializer, legacyReadCommandSerializer, logger, pagedRangeSerializer, rangeSliceSerializer, readSerializer, serializer`

    - ### Fields inherited from interface org.apache.cassandra.db.ReadQuery

      `EMPTY`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static PartitionRangeReadCommand` | `allDataRead(CFMetaData metadata, int nowInSec)` Creates a new read command that query all the data in the table.
    `protected void` | `appendCQLWhereClause(java.lang.StringBuilder sb)`
    `ClusteringIndexFilter` | `clusteringIndexFilter(DecoratedKey key)` The clustering index filter this command to use for the provided key.
    `PartitionRangeReadCommand` | `copy()` Returns a copy of this command.
    `PartitionRangeReadCommand` | `copyAsDigestQuery()` Returns a copy of this command with isDigestQuery set to true.
    `static PartitionRangeReadCommand` | `create(boolean isForThrift, CFMetaData metadata, int nowInSec, ColumnFilter columnFilter, RowFilter rowFilter, DataLimits limits, DataRange dataRange)`
    `MessageOut<ReadCommand>` | `createMessage(int version)` Creates a message for this command.
    `DataRange` | `dataRange()`
    `PartitionIterator` | `execute(ConsistencyLevel consistency, ClientState clientState, long queryStartNanoTime)` Executes the query at the provided consistency level.
    `PartitionRangeReadCommand` | `forSubRange(AbstractBounds<PartitionPosition> range, boolean isRangeContinuation)` Returns an equivalent command but that only queries data within the provided range.
    `QueryPager` | `getPager(PagingState pagingState, ProtocolVersion protocolVersion)` Returns a pager for the query.
    `long` | `getTimeout()` The configured timeout for this command.
    `boolean` | `isLimitedToOnePartition()`
    `boolean` | `isNamesQuery()`
    `protected int` | `oldestUnrepairedTombstone()`
    `PartitionIterator` | `postReconciliationProcessing(PartitionIterator result)` Allow to post-process the result of the query after it has been reconciled on the coordinator but before it is passed to the CQL layer to return the ResultSet.
    `UnfilteredPartitionIterator` | `queryStorage(ColumnFamilyStore cfs, ReadExecutionController executionController)`
    `protected void` | `recordLatency(TableMetrics metric, long latencyNanos)`
    `protected long` | `selectionSerializedSize(int version)`
    `boolean` | `selectsClustering(DecoratedKey key, Clustering clustering)`
    `boolean` | `selectsFullPartition()` Checks if this `ReadQuery` selects full partitions, that is it has no filtering on clustering or regular columns.
    `boolean` | `selectsKey(DecoratedKey key)`
    `protected void` | `serializeSelection(DataOutputPlus out, int version)`
    `java.lang.String` | `toString()`
    `PartitionRangeReadCommand` | `withUpdatedDataRange(DataRange newDataRange)`
    `ReadCommand` | `withUpdatedLimit(DataLimits newLimits)` Creates a new `ReadCommand` instance with new limits.
    `PartitionRangeReadCommand` | `withUpdatedLimitsAndDataRange(DataLimits newLimits, DataRange newDataRange)`

    - ### Methods inherited from class org.apache.cassandra.db.ReadCommand

      `columnFilter, createResponse, digestVersion, executeInternal, executeLocally, executionController, getIndex, indexMetadata, isDigestQuery, isForThrift, limits, maybeValidateIndex, metadata, name, nowInSec, rowFilter, setDigestVersion, toCQLString, withoutPurgeableTombstones, withStateTracking`

    - ### Methods inherited from class org.apache.cassandra.db.monitoring.MonitorableImpl

      `abort, complete, constructionTime, isAborted, isCompleted, isCrossNode, isInProgress, isSlow, setMonitoringTime, slowTimeout, timeout`

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

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

- - ### Field Detail

    - #### selectionDeserializer

          protected static final ReadCommand.SelectionDeserializer selectionDeserializer

  - ### Method Detail

    - #### create

          public static PartitionRangeReadCommand create(boolean isForThrift,
                                                         CFMetaData metadata,
                                                         int nowInSec,
                                                         ColumnFilter columnFilter,
                                                         RowFilter rowFilter,
                                                         DataLimits limits,
                                                         DataRange dataRange)

    - #### allDataRead

          public static PartitionRangeReadCommand allDataRead(CFMetaData metadata,
                                                              int nowInSec)

      Creates a new read command that query all the data in the table.
      Parameters:
        `metadata` - the table to query.
        `nowInSec` - the time in seconds to use are "now" for this query.
      Returns:
        a newly created read command that queries everything in the table.

    - #### dataRange

          public DataRange dataRange()

    - #### clusteringIndexFilter

          public ClusteringIndexFilter clusteringIndexFilter(DecoratedKey key)

      Description copied from class: `ReadCommand`
      The clustering index filter this command to use for the provided key.

      Note that that method should only be called on a key actually queried by this command and in practice, this will almost always return the same filter, but for the sake of paging, the filter on the first key of a range command might be slightly different.

      Specified by:
        `clusteringIndexFilter` in class `ReadCommand`
      Parameters:
        `key` - a partition key queried by this command.
      Returns:
        the `ClusteringIndexFilter` to use for the partition of key `key`.

    - #### isNamesQuery

          public boolean isNamesQuery()

    - #### forSubRange

          public PartitionRangeReadCommand forSubRange(AbstractBounds<PartitionPosition> range,
                                                       boolean isRangeContinuation)

      Returns an equivalent command but that only queries data within the provided range.
      Parameters:
        `range` - the sub-range to restrict the command to. This method assumes that this is a proper sub-range of the command this is applied to.
        `isRangeContinuation` - whether `range` is a direct continuation of whatever previous range we have queried. This matters for the `DataLimits` that may contain states when we do paging and in the context of parallel queries: that state only make sense if the range queried is indeed the follow-up of whatever range we've previously query (that yield said state). In practice this means that ranges for which `isRangeContinuation` is false may have to be slightly pessimistic when counting data and may include a little bit than necessary, and this should be dealt with post-query (in the case of `StorageProxy.getRangeSlice()`, which uses this method for replica queries, this is dealt with by re-counting results on the coordinator). Note that if this is the first range we queried, then the `DataLimits` will have not state and the value of this parameter doesn't matter.

    - #### copy

          public PartitionRangeReadCommand copy()

      Description copied from class: `ReadCommand`
      Returns a copy of this command.
      Specified by:
        `copy` in class `ReadCommand`
      Returns:
        a copy of this command.

    - #### copyAsDigestQuery

          public PartitionRangeReadCommand copyAsDigestQuery()

      Description copied from class: `ReadCommand`
      Returns a copy of this command with isDigestQuery set to true.
      Specified by:
        `copyAsDigestQuery` in class `ReadCommand`

    - #### withUpdatedLimit

          public ReadCommand withUpdatedLimit(DataLimits newLimits)

      Description copied from class: `ReadCommand`
      Creates a new `ReadCommand` instance with new limits.
      Specified by:
        `withUpdatedLimit` in class `ReadCommand`
      Parameters:
        `newLimits` - the new limits
      Returns:
        a new `ReadCommand` with the updated limits

    - #### withUpdatedDataRange

          public PartitionRangeReadCommand withUpdatedDataRange(DataRange newDataRange)

    - #### withUpdatedLimitsAndDataRange

          public PartitionRangeReadCommand withUpdatedLimitsAndDataRange(DataLimits newLimits,
                                                                         DataRange newDataRange)

    - #### getTimeout

          public long getTimeout()

      Description copied from class: `ReadCommand`
      The configured timeout for this command.
      Specified by:
        `getTimeout` in class `ReadCommand`
      Returns:
        the configured timeout for this command.

    - #### selectsKey

          public boolean selectsKey(DecoratedKey key)

      Returns:
        true if the read query would select the given key, including checks against the row filter, if checkRowFilter is true

    - #### selectsClustering

          public boolean selectsClustering(DecoratedKey key,
                                           Clustering clustering)

      Returns:
        true if the read query would select the given clustering, including checks against the row filter, if checkRowFilter is true

    - #### execute

          public PartitionIterator execute(ConsistencyLevel consistency,
                                           ClientState clientState,
                                           long queryStartNanoTime)
                                    throws RequestExecutionException

      Description copied from interface: `ReadQuery`
      Executes the query at the provided consistency level.
      Parameters:
        `consistency` - the consistency level to achieve for the query.
        `clientState` - the `ClientState` for the query. In practice, this can be null unless `consistency` is a serial consistency.
      Returns:
        the result of the query.
      Throws:
        `RequestExecutionException`

    - #### getPager

          public QueryPager getPager(PagingState pagingState,
                                     ProtocolVersion protocolVersion)

      Description copied from interface: `ReadQuery`
      Returns a pager for the query.
      Parameters:
        `pagingState` - the `PagingState` to start from if this is a paging continuation. This can be `null` if this is the start of paging.
        `protocolVersion` - the protocol version to use for the paging state of that pager.
      Returns:
        a pager for the query.

    - #### recordLatency

          protected void recordLatency(TableMetrics metric,
                                       long latencyNanos)

      Specified by:
        `recordLatency` in class `ReadCommand`

    - #### queryStorage

          public UnfilteredPartitionIterator queryStorage(ColumnFamilyStore cfs,
                                                          ReadExecutionController executionController)

      Specified by:
        `queryStorage` in class `ReadCommand`

    - #### oldestUnrepairedTombstone

          protected int oldestUnrepairedTombstone()

      Specified by:
        `oldestUnrepairedTombstone` in class `ReadCommand`

    - #### createMessage

          public MessageOut<ReadCommand> createMessage(int version)

      Description copied from class: `ReadCommand`
      Creates a message for this command.
      Specified by:
        `createMessage` in class `ReadCommand`

    - #### appendCQLWhereClause

          protected void appendCQLWhereClause(java.lang.StringBuilder sb)

      Specified by:
        `appendCQLWhereClause` in class `ReadCommand`

    - #### postReconciliationProcessing

          public PartitionIterator postReconciliationProcessing(PartitionIterator result)

      Allow to post-process the result of the query after it has been reconciled on the coordinator but before it is passed to the CQL layer to return the ResultSet. See CASSANDRA-8717 for why this exists.

    - #### selectsFullPartition

          public boolean selectsFullPartition()

      Description copied from interface: `ReadQuery`
      Checks if this `ReadQuery` selects full partitions, that is it has no filtering on clustering or regular columns.
      Returns:
        `true` if this `ReadQuery` selects full partitions, `false` otherwise.

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### serializeSelection

          protected void serializeSelection(DataOutputPlus out,
                                            int version)
                                     throws java.io.IOException

      Specified by:
        `serializeSelection` in class `ReadCommand`
      Throws:
        `java.io.IOException`

    - #### selectionSerializedSize

          protected long selectionSerializedSize(int version)

      Specified by:
        `selectionSerializedSize` in class `ReadCommand`

    - #### isLimitedToOnePartition

          public boolean isLimitedToOnePartition()

      Specified by:
        `isLimitedToOnePartition` in class `ReadCommand`

Copyright © 2018 The Apache Software Foundation