public class SelectStatement extends java.lang.Object implements CQLStatement
Modifier and Type | Class and Description |
---|---|
static class |
SelectStatement.Parameters |
static class |
SelectStatement.RawStatement |
Modifier and Type | Field and Description |
---|---|
CFMetaData |
cfm |
static int |
DEFAULT_PAGE_SIZE |
SelectStatement.Parameters |
parameters |
Constructor and Description |
---|
SelectStatement(CFMetaData cfm,
int boundTerms,
SelectStatement.Parameters parameters,
Selection selection,
StatementRestrictions restrictions,
boolean isReversed,
AggregationSpecification aggregationSpec,
java.util.Comparator<java.util.List<java.nio.ByteBuffer>> orderingComparator,
Term limit,
Term perPartitionLimit) |
Modifier and Type | Method and Description |
---|---|
void |
checkAccess(ClientState state)
Perform any access verification necessary for the statement.
|
Slices |
clusteringIndexFilterAsSlices()
Returns the slices fetched by this SELECT, assuming an internal call (no bound values in particular).
|
java.lang.String |
columnFamily() |
ResultMessage.Rows |
execute(QueryState state,
QueryOptions options,
long queryStartNanoTime)
Execute the statement and return the resulting result or null if there is no result.
|
ResultMessage.Rows |
executeInternal(QueryState state,
QueryOptions options)
Variant of execute used for internal query against the system tables, and thus only query the local node.
|
ResultMessage.Rows |
executeInternal(QueryState state,
QueryOptions options,
int nowInSec,
long queryStartNanoTime) |
int |
getBoundTerms()
Returns the number of bound terms in this statement.
|
static java.nio.ByteBuffer[] |
getComponents(CFMetaData cfm,
DecoratedKey dk) |
java.lang.Iterable<Function> |
getFunctions()
Return an Iterable over all of the functions (both native and user-defined) used by any component
of the statement
|
int |
getLimit(QueryOptions options)
Returns the limit specified by the user.
|
int |
getPerPartitionLimit(QueryOptions options)
Returns the per partition limit specified by the user.
|
ReadQuery |
getQuery(QueryOptions options,
int nowInSec) |
ReadQuery |
getQuery(QueryOptions options,
int nowInSec,
int userLimit,
int perPartitionLimit,
int pageSize) |
StatementRestrictions |
getRestrictions()
May be used by custom QueryHandler implementations
|
ResultSet.ResultMetadata |
getResultMetadata() |
RowFilter |
getRowFilter(QueryOptions options)
May be used by custom QueryHandler implementations
|
Selection |
getSelection()
May be used by custom QueryHandler implementations
|
SinglePartitionReadCommand |
internalReadForView(DecoratedKey key,
int nowInSec)
Returns a read command that can be used internally to query all the rows queried by this SELECT for a
give key (used for materialized views).
|
java.lang.String |
keyspace() |
ResultSet |
process(PartitionIterator partitions,
int nowInSec) |
ColumnFilter |
queriedColumns()
The columns to fetch internally for this SELECT statement (which can be more than the one selected by the
user as it also include any restricted column in particular).
|
RowFilter |
rowFilterForInternalCalls()
The
RowFilter for this SELECT, assuming an internal call (no bound values in particular). |
void |
validate(ClientState state)
Perform additional validation required by the statment.
|
public static final int DEFAULT_PAGE_SIZE
public final CFMetaData cfm
public final SelectStatement.Parameters parameters
public SelectStatement(CFMetaData cfm, int boundTerms, SelectStatement.Parameters parameters, Selection selection, StatementRestrictions restrictions, boolean isReversed, AggregationSpecification aggregationSpec, java.util.Comparator<java.util.List<java.nio.ByteBuffer>> orderingComparator, Term limit, Term perPartitionLimit)
public java.lang.Iterable<Function> getFunctions()
CQLStatement
getFunctions
in interface CQLStatement
public ColumnFilter queriedColumns()
public ResultSet.ResultMetadata getResultMetadata()
public int getBoundTerms()
CQLStatement
getBoundTerms
in interface CQLStatement
public void checkAccess(ClientState state) throws InvalidRequestException, UnauthorizedException
CQLStatement
checkAccess
in interface CQLStatement
state
- the current client stateInvalidRequestException
UnauthorizedException
public void validate(ClientState state) throws InvalidRequestException
CQLStatement
validate
in interface CQLStatement
state
- the current client stateInvalidRequestException
public ResultMessage.Rows execute(QueryState state, QueryOptions options, long queryStartNanoTime) throws RequestExecutionException, RequestValidationException
CQLStatement
execute
in interface CQLStatement
state
- the current query stateoptions
- options for this query (consistency, variables, pageSize, ...)queryStartNanoTime
- the timestamp returned by System.nanoTime() when this statement was receivedRequestExecutionException
RequestValidationException
public ReadQuery getQuery(QueryOptions options, int nowInSec) throws RequestValidationException
RequestValidationException
public ReadQuery getQuery(QueryOptions options, int nowInSec, int userLimit, int perPartitionLimit, int pageSize)
public ResultMessage.Rows executeInternal(QueryState state, QueryOptions options) throws RequestExecutionException, RequestValidationException
CQLStatement
executeInternal
in interface CQLStatement
state
- the current query stateRequestExecutionException
RequestValidationException
public ResultMessage.Rows executeInternal(QueryState state, QueryOptions options, int nowInSec, long queryStartNanoTime) throws RequestExecutionException, RequestValidationException
public ResultSet process(PartitionIterator partitions, int nowInSec) throws InvalidRequestException
InvalidRequestException
public java.lang.String keyspace()
public java.lang.String columnFamily()
public Selection getSelection()
public StatementRestrictions getRestrictions()
public Slices clusteringIndexFilterAsSlices()
Note that if the SELECT intrinsically selects rows by names, we convert them into equivalent slices for the purpose of this method. This is used for MVs to restrict what needs to be read when we want to read everything that could be affected by a given view (and so, if the view SELECT statement has restrictions on the clustering columns, we can restrict what we read).
public SinglePartitionReadCommand internalReadForView(DecoratedKey key, int nowInSec)
public RowFilter rowFilterForInternalCalls()
RowFilter
for this SELECT, assuming an internal call (no bound values in particular).public int getLimit(QueryOptions options)
DataLimits.NO_LIMIT
if no value
as been specified.public int getPerPartitionLimit(QueryOptions options)
DataLimits.NO_LIMIT
if no value
as been specified.public RowFilter getRowFilter(QueryOptions options) throws InvalidRequestException
InvalidRequestException
public static java.nio.ByteBuffer[] getComponents(CFMetaData cfm, DecoratedKey dk)
Copyright © 2009- The Apache Software Foundation