Class VirtualTableReadQuery
- java.lang.Object
-
- org.apache.cassandra.db.monitoring.MonitorableImpl
-
- org.apache.cassandra.db.VirtualTableReadQuery
-
- All Implemented Interfaces:
Monitorable
,ReadQuery
- Direct Known Subclasses:
VirtualTablePartitionRangeReadQuery
,VirtualTableSinglePartitionReadQuery
public abstract class VirtualTableReadQuery extends MonitorableImpl
Base class for theReadQuery
implementations use to query virtual tables.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
VirtualTableReadQuery(TableMetadata metadata, int nowInSec, ColumnFilter columnFilter, RowFilter rowFilter, DataLimits limits)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
appendCQLWhereClause(java.lang.StringBuilder sb)
ColumnFilter
columnFilter()
A filter on which (non-PK) columns must be returned by the query.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.DataLimits
limits()
The limits for the query.TableMetadata
metadata()
The metadata for the table this is a query on.java.lang.String
name()
int
nowInSec()
The time in seconds to use as "now" for this query.protected abstract UnfilteredPartitionIterator
queryVirtualTable()
RowFilter
rowFilter()
Filters/Resrictions on CQL rows.java.lang.String
toCQLString()
Recreate the CQL string corresponding to this query.-
Methods inherited from class org.apache.cassandra.db.monitoring.MonitorableImpl
abort, complete, creationTimeNanos, isAborted, isCompleted, isCrossNode, isInProgress, isSlow, setMonitoringTime, slowTimeoutNanos, timeoutNanos
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.cassandra.db.ReadQuery
getPager, isEmpty, maybeValidateIndex, selectsClustering, selectsFullPartition, selectsKey
-
-
-
-
Constructor Detail
-
VirtualTableReadQuery
protected VirtualTableReadQuery(TableMetadata metadata, int nowInSec, ColumnFilter columnFilter, RowFilter rowFilter, DataLimits limits)
-
-
Method Detail
-
executionController
public ReadExecutionController executionController()
Description copied from interface:ReadQuery
Starts a new read operation.This must be called before
ReadQuery.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
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
- theClientState
for the query. In practice, this can be null unlessconsistency
is a serial consistency.- Returns:
- the result of the query.
- Throws:
RequestExecutionException
-
executeLocally
public UnfilteredPartitionIterator executeLocally(ReadExecutionController executionController)
Description copied from interface:ReadQuery
Execute the query locally. This is similar toReadQuery.executeInternal(ReadExecutionController)
but it returns an unfiltered partition iterator that can be merged later on.- Parameters:
executionController
- theReadExecutionController
protecting the read.- Returns:
- the result of the read query.
-
queryVirtualTable
protected abstract UnfilteredPartitionIterator queryVirtualTable()
-
metadata
public TableMetadata metadata()
Description copied from interface:ReadQuery
The metadata for the table this is a query on.
-
name
public java.lang.String name()
- Specified by:
name
in interfaceMonitorable
-
executeInternal
public PartitionIterator executeInternal(ReadExecutionController controller)
Description copied from interface:ReadQuery
Execute the query for internal queries (that is, it basically executes the query locally).- Specified by:
executeInternal
in interfaceReadQuery
- Parameters:
controller
- theReadExecutionController
protecting the read.- Returns:
- the result of the query.
-
limits
public DataLimits limits()
Description copied from interface:ReadQuery
The limits for the query.
-
nowInSec
public int nowInSec()
Description copied from interface:ReadQuery
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).
-
rowFilter
public RowFilter rowFilter()
Description copied from interface:ReadQuery
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.
-
columnFilter
public ColumnFilter columnFilter()
Description copied from interface:ReadQuery
A filter on which (non-PK) columns must be returned by the query.- Specified by:
columnFilter
in interfaceReadQuery
- Returns:
- which columns must be fetched by this query.
-
toCQLString
public java.lang.String toCQLString()
Recreate the CQL string corresponding to this query.Note that in general the returned string will not be exactly the original user string, first because there isn't always a single syntax for a given query, but also because we don't have all the information needed (we know the non-PK columns queried but not the PK ones as internally we query them all). So this shouldn't be relied too strongly, but this should be good enough for debugging purpose which is what this is for.
-
appendCQLWhereClause
protected abstract void appendCQLWhereClause(java.lang.StringBuilder sb)
-
-