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

org.apache.cassandra.db

## Interface ReadQuery

- All Known Implementing Classes:
    PartitionRangeReadCommand, ReadCommand, SinglePartitionReadCommand, SinglePartitionReadCommand.Group

      public interface ReadQuery

  Generic abstraction for read queries.

  The main implementation of this is `ReadCommand` but we have this interface because `SinglePartitionReadCommand.Group` is also consider as a "read query" but is not a `ReadCommand`.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static ReadQuery` | `EMPTY`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `PartitionIterator` | `execute(ConsistencyLevel consistency, ClientState clientState, long queryStartNanoTime)` Executes the query at the provided consistency level.
    `PartitionIterator` | `executeInternal(ReadExecutionController controller)` Execute the query for internal queries (that is, it basically executes the query locally).
    `UnfilteredPartitionIterator` | `executeLocally(ReadExecutionController executionController)` Execute the query locally.
    `ReadExecutionController` | `executionController()` Starts a new read operation.
    `QueryPager` | `getPager(PagingState pagingState, ProtocolVersion protocolVersion)` Returns a pager for the query.
    `DataLimits` | `limits()` The limits for the query.
    `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)`

- - ### Field Detail

    - #### EMPTY

          static final ReadQuery EMPTY

  - ### Method Detail

    - #### executionController

          ReadExecutionController executionController()

      Starts a new read operation.

      This must be called before `executeInternal` and passed to it to protect the read. The returned object must be closed on all path and it is thus strongly advised to use it in a try-with-ressource construction.

      Returns:
        a newly started execution controller for this `ReadQuery`.

    - #### execute

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

      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`

    - #### executeInternal

          PartitionIterator executeInternal(ReadExecutionController controller)

      Execute the query for internal queries (that is, it basically executes the query locally).
      Parameters:
        `controller` - the `ReadExecutionController` protecting the read.
      Returns:
        the result of the query.

    - #### executeLocally

          UnfilteredPartitionIterator executeLocally(ReadExecutionController executionController)

      Execute the query locally. This is similar to `executeInternal(ReadExecutionController)` but it returns an unfiltered partition iterator that can be merged later on.
      Parameters:
        `controller` - the `ReadExecutionController` protecting the read.
      Returns:
        the result of the read query.

    - #### getPager

          QueryPager getPager(PagingState pagingState,
                              ProtocolVersion protocolVersion)

      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.

    - #### limits

          DataLimits limits()

      The limits for the query.
      Returns:
        The limits for the query.

    - #### selectsKey

          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

          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

    - #### selectsFullPartition

          boolean selectsFullPartition()

      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.

Copyright © 2018 The Apache Software Foundation