Class BatchStatement
- java.lang.Object
-
- org.apache.cassandra.cql3.statements.BatchStatement
-
- All Implemented Interfaces:
CQLStatement
public class BatchStatement extends java.lang.Object implements CQLStatement
ABATCHstatement parsed from a CQL query.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classBatchStatement.Parsedstatic classBatchStatement.Type-
Nested classes/interfaces inherited from interface org.apache.cassandra.cql3.CQLStatement
CQLStatement.Raw, CQLStatement.SingleKeyspaceCqlStatement
-
-
Field Summary
Fields Modifier and Type Field Description static BatchMetricsmetricsBatchStatement.Typetype
-
Constructor Summary
Constructors Constructor Description BatchStatement(BatchStatement.Type type, VariableSpecifications bindVariables, java.util.List<ModificationStatement> statements, Attributes attrs)Creates a new BatchStatement.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidauthorize(ClientState state)Perform any access verification necessary for the statement.ResultMessageexecute(QueryState queryState, BatchQueryOptions options, Dispatcher.RequestTime requestTime)ResultMessageexecute(QueryState queryState, QueryOptions options, Dispatcher.RequestTime requestTime)Execute the statement and return the resulting result or null if there is no result.ResultMessageexecuteLocally(QueryState queryState, QueryOptions options)Variant of execute used for internal query against the system tables, and thus only query the local node.AuditLogContextgetAuditLogContext()Provides the context needed for audit logging statements.java.util.List<ColumnSpecification>getBindVariables()Returns all bind variables for the statementjava.lang.Iterable<Function>getFunctions()Return an Iterable over all of the functions (both native and user-defined) used by any component of the statementjava.util.List<? extends IMutation>getMutations(ClientState state, BatchQueryOptions options, boolean local, long batchTimestamp, int nowInSeconds, Dispatcher.RequestTime requestTime)short[]getPartitionKeyBindVariableIndexes()Returns an array with the same length as the number of partition key columns for the table corresponding to table.java.util.List<ModificationStatement>getStatements()booleanhasConditions()Whether or not this CQL Statement has LWT conditionsjava.lang.StringtoString()voidvalidate()voidvalidate(ClientState state)Perform additional validation required by the statment.
-
-
-
Field Detail
-
type
public final BatchStatement.Type type
-
metrics
public static final BatchMetrics metrics
-
-
Constructor Detail
-
BatchStatement
public BatchStatement(BatchStatement.Type type, VariableSpecifications bindVariables, java.util.List<ModificationStatement> statements, Attributes attrs)
Creates a new BatchStatement.- Parameters:
type- type of the batchstatements- the list of statements in the batchattrs- additional attributes for statement (CL, timestamp, timeToLive)
-
-
Method Detail
-
getBindVariables
public java.util.List<ColumnSpecification> getBindVariables()
Description copied from interface:CQLStatementReturns all bind variables for the statement- Specified by:
getBindVariablesin interfaceCQLStatement
-
getPartitionKeyBindVariableIndexes
public short[] getPartitionKeyBindVariableIndexes()
Description copied from interface:CQLStatementReturns an array with the same length as the number of partition key columns for the table corresponding to table. Each short in the array represents the bind index of the marker that holds the value for that partition key column. If there are no bind markers for any of the partition key columns, null is returned.- Specified by:
getPartitionKeyBindVariableIndexesin interfaceCQLStatement
-
getFunctions
public java.lang.Iterable<Function> getFunctions()
Description copied from interface:CQLStatementReturn an Iterable over all of the functions (both native and user-defined) used by any component of the statement- Specified by:
getFunctionsin interfaceCQLStatement- Returns:
- functions all functions found (may contain duplicates)
-
authorize
public void authorize(ClientState state) throws InvalidRequestException, UnauthorizedException
Description copied from interface:CQLStatementPerform any access verification necessary for the statement.- Specified by:
authorizein interfaceCQLStatement- Parameters:
state- the current client state- Throws:
InvalidRequestExceptionUnauthorizedException
-
validate
public void validate() throws InvalidRequestException- Throws:
InvalidRequestException
-
validate
public void validate(ClientState state) throws InvalidRequestException
Description copied from interface:CQLStatementPerform additional validation required by the statment. To be overriden by subclasses if needed.- Specified by:
validatein interfaceCQLStatement- Parameters:
state- the current client state- Throws:
InvalidRequestException
-
getStatements
public java.util.List<ModificationStatement> getStatements()
-
getMutations
public java.util.List<? extends IMutation> getMutations(ClientState state, BatchQueryOptions options, boolean local, long batchTimestamp, int nowInSeconds, Dispatcher.RequestTime requestTime)
-
execute
public ResultMessage execute(QueryState queryState, QueryOptions options, Dispatcher.RequestTime requestTime)
Description copied from interface:CQLStatementExecute the statement and return the resulting result or null if there is no result.- Specified by:
executein interfaceCQLStatement- Parameters:
queryState- the current query stateoptions- options for this query (consistency, variables, pageSize, ...)requestTime- request enqueue / and start times
-
execute
public ResultMessage execute(QueryState queryState, BatchQueryOptions options, Dispatcher.RequestTime requestTime)
-
hasConditions
public boolean hasConditions()
Description copied from interface:CQLStatementWhether or not this CQL Statement has LWT conditions- Specified by:
hasConditionsin interfaceCQLStatement
-
executeLocally
public ResultMessage executeLocally(QueryState queryState, QueryOptions options) throws RequestValidationException, RequestExecutionException
Description copied from interface:CQLStatementVariant of execute used for internal query against the system tables, and thus only query the local node.- Specified by:
executeLocallyin interfaceCQLStatement- Parameters:
queryState- the current query state- Throws:
RequestValidationExceptionRequestExecutionException
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getAuditLogContext
public AuditLogContext getAuditLogContext()
Description copied from interface:CQLStatementProvides the context needed for audit logging statements.- Specified by:
getAuditLogContextin interfaceCQLStatement
-
-