Class BatchStatement
- java.lang.Object
-
- org.apache.cassandra.cql3.statements.BatchStatement
-
- All Implemented Interfaces:
CQLStatement
public class BatchStatement extends java.lang.Object implements CQLStatement
ABATCH
statement parsed from a CQL query.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BatchStatement.Parsed
static class
BatchStatement.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 BatchMetrics
metrics
BatchStatement.Type
type
-
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 void
authorize(ClientState state)
Perform any access verification necessary for the statement.ResultMessage
execute(QueryState queryState, BatchQueryOptions options, Dispatcher.RequestTime requestTime)
ResultMessage
execute(QueryState queryState, QueryOptions options, Dispatcher.RequestTime requestTime)
Execute the statement and return the resulting result or null if there is no result.ResultMessage
executeLocally(QueryState queryState, 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 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, long 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()
boolean
hasConditions()
Whether or not this CQL Statement has LWT conditionsjava.lang.String
toString()
void
validate()
void
validate(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:CQLStatement
Returns all bind variables for the statement- Specified by:
getBindVariables
in interfaceCQLStatement
-
getPartitionKeyBindVariableIndexes
public short[] getPartitionKeyBindVariableIndexes()
Description copied from interface:CQLStatement
Returns 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:
getPartitionKeyBindVariableIndexes
in interfaceCQLStatement
-
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 interfaceCQLStatement
- Returns:
- functions all functions found (may contain duplicates)
-
authorize
public void authorize(ClientState state) throws InvalidRequestException, UnauthorizedException
Description copied from interface:CQLStatement
Perform any access verification necessary for the statement.- Specified by:
authorize
in interfaceCQLStatement
- Parameters:
state
- the current client state- Throws:
InvalidRequestException
UnauthorizedException
-
validate
public void validate() throws InvalidRequestException
- Throws:
InvalidRequestException
-
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 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, long nowInSeconds, Dispatcher.RequestTime requestTime)
-
execute
public ResultMessage execute(QueryState queryState, QueryOptions options, Dispatcher.RequestTime requestTime)
Description copied from interface:CQLStatement
Execute the statement and return the resulting result or null if there is no result.- Specified by:
execute
in 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:CQLStatement
Whether or not this CQL Statement has LWT conditions- Specified by:
hasConditions
in interfaceCQLStatement
-
executeLocally
public ResultMessage executeLocally(QueryState queryState, QueryOptions options) throws RequestValidationException, RequestExecutionException
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:
executeLocally
in interfaceCQLStatement
- Parameters:
queryState
- the current query state- Throws:
RequestValidationException
RequestExecutionException
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getAuditLogContext
public AuditLogContext getAuditLogContext()
Description copied from interface:CQLStatement
Provides the context needed for audit logging statements.- Specified by:
getAuditLogContext
in interfaceCQLStatement
-
-