Interface ReadQuery
-
- All Known Subinterfaces:
PartitionRangeReadQuery,SinglePartitionReadQuery
- All Known Implementing Classes:
PartitionRangeReadCommand,PartitionRangeReadCommand.VirtualTablePartitionRangeReadCommand,ReadCommand,SinglePartitionReadCommand,SinglePartitionReadCommand.Group,SinglePartitionReadCommand.VirtualTableGroup,SinglePartitionReadCommand.VirtualTableSinglePartitionReadCommand,SinglePartitionReadQuery.Group
public interface ReadQueryGeneric abstraction for read queries.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description ColumnFiltercolumnFilter()A filter on which (non-PK) columns must be returned by the query.static ReadQueryempty(TableMetadata metadata)PartitionIteratorexecute(ConsistencyLevel consistency, ClientState state, Dispatcher.RequestTime requestTime)Executes the query at the provided consistency level.PartitionIteratorexecuteInternal(ReadExecutionController controller)Execute the query for internal queries (that is, it basically executes the query locally).UnfilteredPartitionIteratorexecuteLocally(ReadExecutionController executionController)Execute the query locally.ReadExecutionControllerexecutionController()Starts a new read operation.QueryPagergetPager(PagingState pagingState, ProtocolVersion protocolVersion)Returns a pager for the query.default booleanisEmpty()Whether this query is known to return nothing upfront.DataLimitslimits()The limits for the query.default voidmaybeValidateIndex()If the index manager for the table determines that there's an applicable 2i that can be used to execute this query, call its (optional) validation method to check that nothing in this query's parameters violates the implementation specific validation rules.TableMetadatametadata()The metadata for the table this is a query on.intnowInSec()The time in seconds to use as "now" for this query.RowFilterrowFilter()Filters/Resrictions on CQL rows.booleanselectsClustering(DecoratedKey key, Clustering<?> clustering)booleanselectsFullPartition()Checks if thisReadQueryselects full partitions, that is it has no filtering on clustering or regular columns.booleanselectsKey(DecoratedKey key)default voidtrackWarnings()
-
-
-
Method Detail
-
empty
static ReadQuery empty(TableMetadata metadata)
-
metadata
TableMetadata metadata()
The metadata for the table this is a query on.- Returns:
- the metadata for the table this is a query on.
-
executionController
ReadExecutionController executionController()
Starts a new read operation.This must be called before
executeInternal(org.apache.cassandra.db.ReadExecutionController)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 state, Dispatcher.RequestTime requestTime) throws RequestExecutionException
Executes the query at the provided consistency level.- Parameters:
consistency- the consistency level to achieve for the query.state- client state- 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- theReadExecutionControllerprotecting the read.- Returns:
- the result of the query.
-
executeLocally
UnfilteredPartitionIterator executeLocally(ReadExecutionController executionController)
Execute the query locally. This is similar toexecuteInternal(ReadExecutionController)but it returns an unfiltered partition iterator that can be merged later on.- Parameters:
executionController- theReadExecutionControllerprotecting the read.- Returns:
- the result of the read query.
-
getPager
QueryPager getPager(PagingState pagingState, ProtocolVersion protocolVersion)
Returns a pager for the query.- Parameters:
pagingState- thePagingStateto start from if this is a paging continuation. This can benullif 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
-
nowInSec
int nowInSec()
The time in seconds to use as "now" for this query.We use the same time as "now" for the whole query to avoid considering different values as expired during the query, which would be buggy (would throw of counting amongst other things).
- Returns:
- the time (in seconds) to use as "now".
-
selectsFullPartition
boolean selectsFullPartition()
Checks if thisReadQueryselects full partitions, that is it has no filtering on clustering or regular columns.- Returns:
trueif thisReadQueryselects full partitions,falseotherwise.
-
rowFilter
RowFilter rowFilter()
Filters/Resrictions on CQL rows.This contains the restrictions that are not directly handled by the
ClusteringIndexFilter. More specifically, this includes any non-PK column restrictions and can include some PK columns restrictions when those can't be satisfied entirely by the clustering index filter (because not all clustering columns have been restricted for instance). If there is 2ndary indexes on the table, one of this restriction might be handled by a 2ndary index.- Returns:
- the filter holding the expression that rows must satisfy.
-
columnFilter
ColumnFilter columnFilter()
A filter on which (non-PK) columns must be returned by the query.- Returns:
- which columns must be fetched by this query.
-
isEmpty
default boolean isEmpty()
Whether this query is known to return nothing upfront.This is overridden by the
ReadQuerycreated throughempty(TableMetadata), and that's probably the only place that should override it.- Returns:
- if this method is guaranteed to return no results whatsoever.
-
maybeValidateIndex
default void maybeValidateIndex()
If the index manager for the table determines that there's an applicable 2i that can be used to execute this query, call its (optional) validation method to check that nothing in this query's parameters violates the implementation specific validation rules.
-
trackWarnings
default void trackWarnings()
-
-