org.apache.cassandra.cql3.statements

## Class SelectStatement

- java.lang.Object
- - org.apache.cassandra.cql3.statements.SelectStatement

All Implemented Interfaces:
  CQLStatement

    public class SelectStatement
    extends java.lang.Object
    implements CQLStatement

Encapsulates a completely parsed SELECT query, including the target column family, expression, result count, and ordering clause. A number of public methods here are only used internally. However, many of these are made accessible for the benefit of custom QueryHandler implementations, so before reducing their accessibility due consideration should be given.

### Nested Class Summary

Nested Classes
`static class` `SelectStatement.Parameters`
`static class` `SelectStatement.RawStatement`

### Field Summary

Fields
`CFMetaData` `cfm`
`SelectStatement.Parameters` `parameters`

### Constructor Summary

Constructors
Constructor and Description
`SelectStatement(CFMetaData cfm, int boundTerms, SelectStatement.Parameters parameters, Selection selection, StatementRestrictions restrictions, boolean isReversed, java.util.Comparator<java.util.List<java.nio.ByteBuffer>> orderingComparator, Term limit)`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `checkAccess(ClientState state)` Perform any access verification necessary for the statement.
`java.lang.String` `columnFamily()`
`ResultMessage.Rows` `execute(QueryState state, QueryOptions options)` 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, long now)`
`int` `getBoundTerms()` Returns the number of bound terms in this statement.
`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)` May be used by custom QueryHandler implementations
`Pageable` `getPageableCommand(QueryOptions options)`
`StatementRestrictions` `getRestrictions()` May be used by custom QueryHandler implementations
`ResultSet.ResultMetadata` `getResultMetadata()`
`Selection` `getSelection()` May be used by custom QueryHandler implementations
`java.util.List<IndexExpression>` `getValidatedIndexExpressions(QueryOptions options)` May be used by custom QueryHandler implementations
`java.lang.String` `keyspace()`
`ResultSet` `process(java.util.List<Row> rows)`
`ResultMessage.Rows` `processResults(java.util.List<Row> rows, QueryOptions options, int limit, long now)`
`void` `validate(ClientState state)` Perform additional validation required by the statment.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### cfm

    public final CFMetaData cfm

#### parameters

    public final SelectStatement.Parameters parameters

### Constructor Detail

#### SelectStatement

    public SelectStatement(CFMetaData cfm,
                           int boundTerms,
                           SelectStatement.Parameters parameters,
                           Selection selection,
                           StatementRestrictions restrictions,
                           boolean isReversed,
                           java.util.Comparator<java.util.List<java.nio.ByteBuffer>> orderingComparator,
                           Term limit)

### Method Detail

#### getFunctions

    public java.lang.Iterable<Function> getFunctions()

Description copied from interface: `CQLStatement`
Return an Iterable over all of the functions (both native and user-defined) used by any component of the statement

Specified by:
  `getFunctions` in interface `CQLStatement`
Returns:
  functions all functions found (may contain duplicates)

#### getResultMetadata

    public ResultSet.ResultMetadata getResultMetadata()

#### getBoundTerms

    public int getBoundTerms()

Description copied from interface: `CQLStatement`
Returns the number of bound terms in this statement.

Specified by:
  `getBoundTerms` in interface `CQLStatement`

#### checkAccess

    public void checkAccess(ClientState state)
                     throws InvalidRequestException,
                            UnauthorizedException

Description copied from interface: `CQLStatement`
Perform any access verification necessary for the statement.

Specified by:
  `checkAccess` in interface `CQLStatement`
Parameters:
  `state` - the current client state
Throws:
  `InvalidRequestException`
  `UnauthorizedException`

#### validate

    public void validate(ClientState state)
                  throws InvalidRequestException

Description copied from interface: `CQLStatement`
Perform additional validation required by the statment. To be overriden by subclasses if needed.

Specified by:
  `validate` in interface `CQLStatement`
Parameters:
  `state` - the current client state
Throws:
  `InvalidRequestException`

#### execute

    public ResultMessage.Rows execute(QueryState state,
                                      QueryOptions options)
                               throws RequestExecutionException,
                                      RequestValidationException

Description copied from interface: `CQLStatement`
Execute the statement and return the resulting result or null if there is no result.

Specified by:
  `execute` in interface `CQLStatement`
Parameters:
  `state` - the current query state
  `options` - options for this query (consistency, variables, pageSize, ...)
Throws:
  `RequestExecutionException`
  `RequestValidationException`

#### getPageableCommand

    public Pageable getPageableCommand(QueryOptions options)
                                throws RequestValidationException

Throws:
  `RequestValidationException`

#### processResults

    public ResultMessage.Rows processResults(java.util.List<Row> rows,
                                             QueryOptions options,
                                             int limit,
                                             long now)
                                      throws RequestValidationException

Throws:
  `RequestValidationException`

#### executeInternal

    public ResultMessage.Rows executeInternal(QueryState state,
                                              QueryOptions options)
                                       throws RequestExecutionException,
                                              RequestValidationException

Description copied from interface: `CQLStatement`
Variant of execute used for internal query against the system tables, and thus only query the local node.

Specified by:
  `executeInternal` in interface `CQLStatement`
Parameters:
  `state` - the current query state
Throws:
  `RequestExecutionException`
  `RequestValidationException`

#### executeInternal

    public ResultMessage.Rows executeInternal(QueryState state,
                                              QueryOptions options,
                                              long now)
                                       throws RequestExecutionException,
                                              RequestValidationException

Throws:
  `RequestExecutionException`
  `RequestValidationException`

#### process

    public ResultSet process(java.util.List<Row> rows)
                      throws InvalidRequestException

Throws:
  `InvalidRequestException`

#### keyspace

    public java.lang.String keyspace()

#### columnFamily

    public java.lang.String columnFamily()

#### getSelection

    public Selection getSelection()

May be used by custom QueryHandler implementations

#### getRestrictions

    public StatementRestrictions getRestrictions()

May be used by custom QueryHandler implementations

#### getLimit

    public int getLimit(QueryOptions options)
                 throws InvalidRequestException

May be used by custom QueryHandler implementations

Throws:
  `InvalidRequestException`

#### getValidatedIndexExpressions

    public java.util.List<IndexExpression> getValidatedIndexExpressions(QueryOptions options)
                                                                 throws InvalidRequestException

May be used by custom QueryHandler implementations

Throws:
  `InvalidRequestException`