Class VirtualTableSinglePartitionReadQuery
- java.lang.Object
-
- org.apache.cassandra.db.monitoring.MonitorableImpl
-
- org.apache.cassandra.db.VirtualTableReadQuery
-
- org.apache.cassandra.db.VirtualTableSinglePartitionReadQuery
-
- All Implemented Interfaces:
Monitorable
,ReadQuery
,SinglePartitionReadQuery
public class VirtualTableSinglePartitionReadQuery extends VirtualTableReadQuery implements SinglePartitionReadQuery
A read query that selects a (part of a) single partition of a virtual table.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
VirtualTableSinglePartitionReadQuery.Group
Groups multiple single partition read queries.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
appendCQLWhereClause(java.lang.StringBuilder sb)
ClusteringIndexFilter
clusteringIndexFilter()
ColumnFilter
columnFilter()
A filter on which (non-PK) columns must be returned by the query.static VirtualTableSinglePartitionReadQuery
create(TableMetadata metadata, int nowInSec, ColumnFilter columnFilter, RowFilter rowFilter, DataLimits limits, DecoratedKey partitionKey, ClusteringIndexFilter clusteringIndexFilter)
Creates a new read query on a single partition.PartitionIterator
executeInternal(ReadExecutionController controller)
Execute the query for internal queries (that is, it basically executes the query locally).SinglePartitionReadQuery
forPaging(Clustering<?> lastReturned, DataLimits limits)
Returns a newSinglePartitionReadQuery
suitable to paging from the last returned row.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.DecoratedKey
partitionKey()
Returns the key of the partition queried by thisReadQuery
protected UnfilteredPartitionIterator
queryVirtualTable()
RowFilter
rowFilter()
Filters/Resrictions on CQL rows.boolean
selectsFullPartition()
Checks if thisReadQuery
selects full partitions, that is it has no filtering on clustering or regular columns.java.lang.String
toCQLString()
Recreate the CQL string corresponding to this query.SinglePartitionReadQuery
withUpdatedLimit(DataLimits newLimits)
Creates a newSinglePartitionReadQuery
with the specified limits.-
Methods inherited from class org.apache.cassandra.db.VirtualTableReadQuery
execute, executeLocally, executionController
-
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
columnFilter, execute, executeInternal, executeLocally, executionController, isEmpty, limits, maybeValidateIndex, metadata, nowInSec, rowFilter
-
Methods inherited from interface org.apache.cassandra.db.SinglePartitionReadQuery
getPager, selectsClustering, selectsKey
-
-
-
-
Method Detail
-
create
public static VirtualTableSinglePartitionReadQuery create(TableMetadata metadata, int nowInSec, ColumnFilter columnFilter, RowFilter rowFilter, DataLimits limits, DecoratedKey partitionKey, ClusteringIndexFilter clusteringIndexFilter)
Description copied from interface:SinglePartitionReadQuery
Creates a new read query on a single partition.- Parameters:
metadata
- the table to query.nowInSec
- the time in seconds to use are "now" for this query.columnFilter
- the column filter to use for the query.rowFilter
- the row filter to use for the query.limits
- the limits to use for the query.partitionKey
- the partition key for the partition to query.clusteringIndexFilter
- the clustering index filter to use for the query.- Returns:
- a newly created read query.
-
appendCQLWhereClause
protected void appendCQLWhereClause(java.lang.StringBuilder sb)
-
clusteringIndexFilter
public ClusteringIndexFilter clusteringIndexFilter()
- Specified by:
clusteringIndexFilter
in interfaceSinglePartitionReadQuery
-
selectsFullPartition
public boolean selectsFullPartition()
Description copied from interface:ReadQuery
Checks if thisReadQuery
selects full partitions, that is it has no filtering on clustering or regular columns.- Specified by:
selectsFullPartition
in interfaceReadQuery
- Returns:
true
if thisReadQuery
selects full partitions,false
otherwise.
-
partitionKey
public DecoratedKey partitionKey()
Description copied from interface:SinglePartitionReadQuery
Returns the key of the partition queried by thisReadQuery
- Specified by:
partitionKey
in interfaceSinglePartitionReadQuery
- Returns:
- the key of the partition queried
-
withUpdatedLimit
public SinglePartitionReadQuery withUpdatedLimit(DataLimits newLimits)
Description copied from interface:SinglePartitionReadQuery
Creates a newSinglePartitionReadQuery
with the specified limits.- Specified by:
withUpdatedLimit
in interfaceSinglePartitionReadQuery
- Parameters:
newLimits
- the new limits- Returns:
- the new
SinglePartitionReadQuery
-
forPaging
public SinglePartitionReadQuery forPaging(Clustering<?> lastReturned, DataLimits limits)
Description copied from interface:SinglePartitionReadQuery
Returns a newSinglePartitionReadQuery
suitable to paging from the last returned row.- Specified by:
forPaging
in interfaceSinglePartitionReadQuery
- Parameters:
lastReturned
- the last row returned by the previous page. The newly created query will only query row that comes after this (in query order). This can benull
if this is the first page.limits
- the limits to use for the page to query.- Returns:
- the newly create query.
-
queryVirtualTable
protected UnfilteredPartitionIterator queryVirtualTable()
- Specified by:
queryVirtualTable
in classVirtualTableReadQuery
-
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.
-
-