Class ModificationStatement
java.lang.Object
org.apache.cassandra.cql3.statements.ModificationStatement
- All Implemented Interfaces:
CQLStatement,CQLStatement.SingleKeyspaceCqlStatement
- Direct Known Subclasses:
DeleteStatement,UpdateStatement
public abstract class ModificationStatement
extends Object
implements CQLStatement.SingleKeyspaceCqlStatement
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.apache.cassandra.cql3.CQLStatement
CQLStatement.Raw, CQLStatement.SingleKeyspaceCqlStatement -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final VariableSpecificationsstatic final ColumnIdentifierstatic final Stringprotected static final org.slf4j.Loggerfinal TableMetadataprotected final StatementType -
Constructor Summary
ConstructorsConstructorDescriptionModificationStatement(StatementType type, VariableSpecifications bindVariables, TableMetadata metadata, Operations operations, StatementRestrictions restrictions, Conditions conditions, Attributes attrs) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddConditions(Clustering<?> clustering, CQL3CasRequest request, QueryOptions options) voidaddFunctionsTo(List<Function> functions) abstract voidaddUpdateForKey(PartitionUpdate.Builder updateBuilder, Clustering<?> clustering, UpdateParameters params) abstract voidaddUpdateForKey(PartitionUpdate.Builder updateBuilder, Slice slice, UpdateParameters params) static booleanappliesOnlyToStaticColumns(Operations operation, Conditions conditions) Checks that the specified operations and conditions only apply to static columns.voidauthorize(ClientState state) Perform any access verification necessary for the statement.buildPartitionKeyNames(QueryOptions options, ClientState state) createClustering(QueryOptions options, ClientState state) createSlices(QueryOptions options) execute(QueryState queryState, QueryOptions options, Dispatcher.RequestTime requestTime) Execute the statement and return the resulting result or null if there is no result.executeInternalWithCondition(QueryState state, QueryOptions options) executeInternalWithoutCondition(QueryState queryState, QueryOptions options, Dispatcher.RequestTime requestTime) executeLocally(QueryState queryState, QueryOptions options) Variant of execute used for internal query against the system tables, and thus only query the local node.Returns all bind variables for the statementReturn an Iterable over all of the functions (both native and user-defined) used by any component of the statementshort[]Returns an array with the same length as the number of partition key columns for the table corresponding to table.longgetTimestamp(long now, QueryOptions options) intgetTimeToLive(QueryOptions options) booleanWhether or not this CQL Statement has LWT conditionsbooleanbooleanbooleanbooleanbooleanbooleanisView()booleankeyspace()metadata()booleantable()static SlicestoSlices(ClusteringComparator comparator, SortedSet<ClusteringBound<?>> startBounds, SortedSet<ClusteringBound<?>> endBounds) static SlicestoSlices(TableMetadata metadata, SortedSet<ClusteringBound<?>> startBounds, SortedSet<ClusteringBound<?>> endBounds) booleanbooleanvoidvalidate(ClientState state) Perform additional validation required by the statment.voidvalidateDiskUsage(QueryOptions options, ClientState state) voidvalidateTimestamp(QueryState queryState, QueryOptions options) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.cassandra.cql3.CQLStatement
getAuditLogContext
-
Field Details
-
logger
protected static final org.slf4j.Logger logger -
CUSTOM_EXPRESSIONS_NOT_ALLOWED
- See Also:
-
CAS_RESULT_COLUMN
-
type
-
bindVariables
-
metadata
-
-
Constructor Details
-
ModificationStatement
public ModificationStatement(StatementType type, VariableSpecifications bindVariables, TableMetadata metadata, Operations operations, StatementRestrictions restrictions, Conditions conditions, Attributes attrs)
-
-
Method Details
-
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
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)
-
addFunctionsTo
-
metadata
-
getRestrictions
-
addUpdateForKey
public abstract void addUpdateForKey(PartitionUpdate.Builder updateBuilder, Clustering<?> clustering, UpdateParameters params) -
addUpdateForKey
public abstract void addUpdateForKey(PartitionUpdate.Builder updateBuilder, Slice slice, UpdateParameters params) -
keyspace
- Specified by:
keyspacein interfaceCQLStatement.SingleKeyspaceCqlStatement
-
table
-
isCounter
public boolean isCounter() -
isView
public boolean isView() -
isVirtual
public boolean isVirtual() -
getTimestamp
- Throws:
InvalidRequestException
-
isTimestampSet
public boolean isTimestampSet() -
getTimeToLive
- Throws:
InvalidRequestException
-
authorize
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
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
-
validateDiskUsage
-
validateTimestamp
-
updatedColumns
-
conditionColumns
-
updatesRegularRows
public boolean updatesRegularRows() -
updatesStaticRow
public boolean updatesStaticRow() -
getRegularOperations
-
getStaticOperations
-
allOperations
-
getColumnsWithConditions
-
hasIfNotExistCondition
public boolean hasIfNotExistCondition() -
hasIfExistCondition
public boolean hasIfExistCondition() -
buildPartitionKeyNames
public List<ByteBuffer> buildPartitionKeyNames(QueryOptions options, ClientState state) throws InvalidRequestException - Throws:
InvalidRequestException
-
createClustering
public NavigableSet<Clustering<?>> createClustering(QueryOptions options, ClientState state) throws InvalidRequestException - Throws:
InvalidRequestException
-
appliesOnlyToStaticColumns
Checks that the specified operations and conditions only apply to static columns.- Returns:
trueif the specified operations and conditions only apply to static columns,falseotherwise.
-
requiresRead
public boolean requiresRead() -
hasConditions
public boolean hasConditions()Description copied from interface:CQLStatementWhether or not this CQL Statement has LWT conditions- Specified by:
hasConditionsin interfaceCQLStatement
-
hasSlices
public boolean hasSlices() -
execute
public ResultMessage execute(QueryState queryState, QueryOptions options, Dispatcher.RequestTime requestTime) throws RequestExecutionException, RequestValidationException 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;- Throws:
RequestExecutionExceptionRequestValidationException
-
addConditions
public void addConditions(Clustering<?> clustering, CQL3CasRequest request, QueryOptions options) throws InvalidRequestException - Throws:
InvalidRequestException
-
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
-
executeInternalWithoutCondition
public ResultMessage executeInternalWithoutCondition(QueryState queryState, QueryOptions options, Dispatcher.RequestTime requestTime) throws RequestValidationException, RequestExecutionException -
executeInternalWithCondition
-
createSlices
-
toSlices
public static Slices toSlices(TableMetadata metadata, SortedSet<ClusteringBound<?>> startBounds, SortedSet<ClusteringBound<?>> endBounds) -
toSlices
public static Slices toSlices(ClusteringComparator comparator, SortedSet<ClusteringBound<?>> startBounds, SortedSet<ClusteringBound<?>> endBounds)
-