public class SelectStatement extends java.lang.Object implements CQLStatement.SingleKeyspaceCqlStatement
Modifier and Type | Class and Description |
---|---|
static class |
SelectStatement.Parameters |
static class |
SelectStatement.RawStatement |
CQLStatement.Raw, CQLStatement.SingleKeyspaceCqlStatement
Modifier and Type | Field and Description |
---|---|
VariableSpecifications |
bindVariables |
static int |
DEFAULT_PAGE_SIZE |
SelectStatement.Parameters |
parameters |
TableMetadata |
table |
Constructor and Description |
---|
SelectStatement(TableMetadata table,
VariableSpecifications bindVariables,
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 |
authorize(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,
int nowInSec,
long queryStartNanoTime) |
ResultMessage.Rows |
executeLocally(QueryState state,
QueryOptions options)
Variant of execute used for internal query against the system tables, and thus only query the local node.
|
AuditLogContext |
getAuditLogContext()
Provides the context needed for audit logging statements.
|
java.util.List<ColumnSpecification> |
getBindVariables()
Returns all bind variables for the statement
|
static java.nio.ByteBuffer[] |
getComponents(TableMetadata metadata,
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.
|
short[] |
getPartitionKeyBindVariableIndexes()
Returns an array with the same length as the number of partition key columns for the table corresponding
to table.
|
int |
getPerPartitionLimit(QueryOptions options)
Returns the per partition limit specified by the user.
|
ReadQuery |
getQuery(QueryOptions options,
ColumnFilter columnFilter,
int nowInSec,
int userLimit,
int perPartitionLimit,
int pageSize) |
ReadQuery |
getQuery(QueryOptions options,
int nowInSec) |
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() |
Slices |
makeSlices(QueryOptions options) |
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). |
java.lang.String |
toString() |
void |
validate(ClientState state)
Perform additional validation required by the statment.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
hasConditions
public static final int DEFAULT_PAGE_SIZE
public final VariableSpecifications bindVariables
public final TableMetadata table
public final SelectStatement.Parameters parameters
public SelectStatement(TableMetadata table, VariableSpecifications bindVariables, 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.util.List<ColumnSpecification> getBindVariables()
CQLStatement
getBindVariables
in interface CQLStatement
public short[] getPartitionKeyBindVariableIndexes()
CQLStatement
getPartitionKeyBindVariableIndexes
in interface CQLStatement
public java.lang.Iterable<Function> getFunctions()
CQLStatement
getFunctions
in interface CQLStatement
public ColumnFilter queriedColumns()
public ResultSet.ResultMetadata getResultMetadata()
public void authorize(ClientState state) throws InvalidRequestException, UnauthorizedException
CQLStatement
authorize
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)
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 receivedpublic ReadQuery getQuery(QueryOptions options, int nowInSec) throws RequestValidationException
RequestValidationException
public ReadQuery getQuery(QueryOptions options, ColumnFilter columnFilter, int nowInSec, int userLimit, int perPartitionLimit, int pageSize)
public AuditLogContext getAuditLogContext()
CQLStatement
getAuditLogContext
in interface CQLStatement
public ResultMessage.Rows executeLocally(QueryState state, QueryOptions options) throws RequestExecutionException, RequestValidationException
CQLStatement
executeLocally
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()
keyspace
in interface CQLStatement.SingleKeyspaceCqlStatement
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 Slices makeSlices(QueryOptions options) throws InvalidRequestException
InvalidRequestException
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(TableMetadata metadata, DecoratedKey dk)
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2009- The Apache Software Foundation