public abstract class SinglePartitionReadCommand<F extends ClusteringIndexFilter> extends ReadCommand
| Modifier and Type | Class and Description |
|---|---|
static class |
SinglePartitionReadCommand.Group
Groups multiple single partition read commands.
|
ReadCommand.Kind, ReadCommand.SelectionDeserializer| Modifier and Type | Field and Description |
|---|---|
protected static ReadCommand.SelectionDeserializer |
selectionDeserializer |
logger, serializer| Modifier | Constructor and Description |
|---|---|
protected |
SinglePartitionReadCommand(boolean isDigest,
boolean isForThrift,
CFMetaData metadata,
int nowInSec,
ColumnFilter columnFilter,
RowFilter rowFilter,
DataLimits limits,
DecoratedKey partitionKey,
F clusteringIndexFilter) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
appendCQLWhereClause(java.lang.StringBuilder sb) |
F |
clusteringIndexFilter() |
ClusteringIndexFilter |
clusteringIndexFilter(DecoratedKey key)
The clustering index filter this command to use for the provided key.
|
static SinglePartitionReadCommand<?> |
create(boolean isForThrift,
CFMetaData metadata,
int nowInSec,
ColumnFilter columnFilter,
RowFilter rowFilter,
DataLimits limits,
DecoratedKey partitionKey,
ClusteringIndexFilter clusteringIndexFilter)
Creates a new read command on a single partition for thrift.
|
static SinglePartitionReadCommand<?> |
create(CFMetaData metadata,
int nowInSec,
ColumnFilter columnFilter,
RowFilter rowFilter,
DataLimits limits,
DecoratedKey partitionKey,
ClusteringIndexFilter clusteringIndexFilter)
Creates a new read command on a single partition.
|
static SinglePartitionReadCommand<?> |
create(CFMetaData metadata,
int nowInSec,
DecoratedKey key,
ColumnFilter columnFilter,
ClusteringIndexFilter filter)
Creates a new read command on a single partition.
|
PartitionIterator |
execute(ConsistencyLevel consistency,
ClientState clientState)
Executes the query at the provided consistency level.
|
SinglePartitionReadCommand |
forPaging(Clustering lastReturned,
int pageSize)
Returns a new command suitable to paging from the last returned row.
|
static SinglePartitionReadCommand |
fullPartitionRead(CFMetaData metadata,
int nowInSec,
DecoratedKey key)
Creates a new read command that queries a single partition in its entirety.
|
SinglePartitionPager |
getPager(PagingState pagingState)
Returns a pager for the query.
|
long |
getTimeout()
The configured timeout for this command.
|
DecoratedKey |
partitionKey() |
UnfilteredRowIterator |
queryMemtableAndDisk(ColumnFamilyStore cfs,
OpOrder.Group readOp)
Queries both memtable and sstables to fetch the result of this query.
|
protected abstract UnfilteredRowIterator |
queryMemtableAndDiskInternal(ColumnFamilyStore cfs,
boolean copyOnHeap) |
protected UnfilteredPartitionIterator |
queryStorage(ColumnFamilyStore cfs,
ReadOrderGroup orderGroup) |
protected void |
recordLatency(TableMetrics metric,
long latencyNanos) |
protected long |
selectionSerializedSize(int version) |
boolean |
selects(DecoratedKey partitionKey,
Clustering clustering)
Whether the provided row, identified by its primary key components, is selected by
this read command.
|
protected void |
serializeSelection(DataOutputPlus out,
int version) |
java.lang.String |
toString() |
columnFilter, copy, createMessage, createResponse, executeInternal, executeLocally, getIndexSearcher, isDigestQuery, isForThrift, limits, metadata, nowInSec, rowFilter, setIsDigestQuery, startOrderGroup, toCQLString, withoutPurgeableTombstonesprotected static final ReadCommand.SelectionDeserializer selectionDeserializer
protected SinglePartitionReadCommand(boolean isDigest,
boolean isForThrift,
CFMetaData metadata,
int nowInSec,
ColumnFilter columnFilter,
RowFilter rowFilter,
DataLimits limits,
DecoratedKey partitionKey,
F clusteringIndexFilter)
public static SinglePartitionReadCommand<?> create(CFMetaData metadata, int nowInSec, ColumnFilter columnFilter, RowFilter rowFilter, DataLimits limits, DecoratedKey partitionKey, ClusteringIndexFilter clusteringIndexFilter)
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.public static SinglePartitionReadCommand<?> create(boolean isForThrift, CFMetaData metadata, int nowInSec, ColumnFilter columnFilter, RowFilter rowFilter, DataLimits limits, DecoratedKey partitionKey, ClusteringIndexFilter clusteringIndexFilter)
isForThrift - whether the query is for thrift or not.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.public static SinglePartitionReadCommand<?> create(CFMetaData metadata, int nowInSec, DecoratedKey key, ColumnFilter columnFilter, ClusteringIndexFilter filter)
metadata - the table to query.nowInSec - the time in seconds to use are "now" for this query.key - the partition key for the partition to query.columnFilter - the column filter to use for the query.filter - the clustering index filter to use for the query.public static SinglePartitionReadCommand fullPartitionRead(CFMetaData metadata, int nowInSec, DecoratedKey key)
metadata - the table to query.nowInSec - the time in seconds to use are "now" for this query.key - the partition key for the partition to query.key.public DecoratedKey partitionKey()
public F clusteringIndexFilter()
public ClusteringIndexFilter clusteringIndexFilter(DecoratedKey key)
ReadCommandNote 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.
clusteringIndexFilter in class ReadCommandkey - a partition key queried by this command.ClusteringIndexFilter to use for the partition of key key.public long getTimeout()
ReadCommandgetTimeout in class ReadCommandpublic boolean selects(DecoratedKey partitionKey, Clustering clustering)
ReadCommandselects in class ReadCommandpartitionKey - the partition key for the row to test.clustering - the clustering for the row to test.partitionKey and clustering
clustering is selected by this command.public SinglePartitionReadCommand forPaging(Clustering lastReturned, int pageSize)
lastReturned - the last row returned by the previous page. The newly created command
will only query row that comes after this (in query order). This can be null if this
is the first page.pageSize - the size to use for the page to query.public PartitionIterator execute(ConsistencyLevel consistency, ClientState clientState) throws RequestExecutionException
ReadQueryconsistency - 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.RequestExecutionExceptionpublic SinglePartitionPager getPager(PagingState pagingState)
ReadQuerypagingState - the PagingState to start from if this is a paging continuation. This can be
null if this is the start of paging.protected void recordLatency(TableMetrics metric, long latencyNanos)
recordLatency in class ReadCommandprotected UnfilteredPartitionIterator queryStorage(ColumnFamilyStore cfs, ReadOrderGroup orderGroup)
queryStorage in class ReadCommandpublic UnfilteredRowIterator queryMemtableAndDisk(ColumnFamilyStore cfs, OpOrder.Group readOp)
Please note that this method:
1) does not check the row cache.
2) does not apply the query limit, nor the row filter (and so ignore 2ndary indexes).
Those are applied in ReadCommand.executeLocally(org.apache.cassandra.db.ReadOrderGroup).
3) does not record some of the read metrics (latency, scanned cells histograms) nor
throws TombstoneOverwhelmingException.
It is publicly exposed because there is a few places where that is exactly what we want,
but it should be used only where you know you don't need thoses things.
Also note that one must have "started" a OpOrder.Group on the queried table, and that is
to enforce that that it is required as parameter, even though it's not explicitlly used by the method.
protected abstract UnfilteredRowIterator queryMemtableAndDiskInternal(ColumnFamilyStore cfs, boolean copyOnHeap)
public java.lang.String toString()
toString in class java.lang.Objectprotected void appendCQLWhereClause(java.lang.StringBuilder sb)
appendCQLWhereClause in class ReadCommandprotected void serializeSelection(DataOutputPlus out, int version) throws java.io.IOException
serializeSelection in class ReadCommandjava.io.IOExceptionprotected long selectionSerializedSize(int version)
selectionSerializedSize in class ReadCommandCopyright © 2015 The Apache Software Foundation