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 java.lang.Object implements CQLStatement.SingleKeyspaceCqlStatement
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classModificationStatement.Parsed-
Nested classes/interfaces inherited from interface org.apache.cassandra.cql3.CQLStatement
CQLStatement.Raw, CQLStatement.SingleKeyspaceCqlStatement
-
-
Field Summary
Fields Modifier and Type Field Description protected VariableSpecificationsbindVariablesstatic java.lang.StringCUSTOM_EXPRESSIONS_NOT_ALLOWEDprotected static org.slf4j.LoggerloggerTableMetadatametadataprotected StatementTypetype
-
Constructor Summary
Constructors Constructor Description ModificationStatement(StatementType type, VariableSpecifications bindVariables, TableMetadata metadata, Operations operations, StatementRestrictions restrictions, Conditions conditions, Attributes attrs)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddConditions(Clustering<?> clustering, CQL3CasRequest request, QueryOptions options)voidaddFunctionsTo(java.util.List<Function> functions)abstract voidaddUpdateForKey(PartitionUpdate.Builder updateBuilder, Clustering<?> clustering, UpdateParameters params)abstract voidaddUpdateForKey(PartitionUpdate.Builder updateBuilder, Slice slice, UpdateParameters params)java.lang.Iterable<Operation>allOperations()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.java.util.List<java.nio.ByteBuffer>buildPartitionKeyNames(QueryOptions options, ClientState state)RegularAndStaticColumnsconditionColumns()java.util.NavigableSet<Clustering<?>>createClustering(QueryOptions options, ClientState state)SlicescreateSlices(QueryOptions options)ResultMessageexecute(QueryState queryState, QueryOptions options, Dispatcher.RequestTime requestTime)Execute the statement and return the resulting result or null if there is no result.ResultMessageexecuteInternalWithCondition(QueryState state, QueryOptions options)ResultMessageexecuteInternalWithoutCondition(QueryState queryState, QueryOptions options, Dispatcher.RequestTime requestTime)ResultMessageexecuteLocally(QueryState queryState, QueryOptions options)Variant of execute used for internal query against the system tables, and thus only query the local node.java.util.List<ColumnSpecification>getBindVariables()Returns all bind variables for the statementjava.lang.Iterable<ColumnMetadata>getColumnsWithConditions()java.lang.Iterable<Function>getFunctions()Return an Iterable over all of the functions (both native and user-defined) used by any component of the statementshort[]getPartitionKeyBindVariableIndexes()Returns an array with the same length as the number of partition key columns for the table corresponding to table.java.util.List<Operation>getRegularOperations()StatementRestrictionsgetRestrictions()java.util.List<Operation>getStaticOperations()longgetTimestamp(long now, QueryOptions options)intgetTimeToLive(QueryOptions options)booleanhasConditions()Whether or not this CQL Statement has LWT conditionsbooleanhasIfExistCondition()booleanhasIfNotExistCondition()booleanhasSlices()booleanisCounter()booleanisTimestampSet()booleanisView()booleanisVirtual()java.lang.Stringkeyspace()TableMetadatametadata()booleanrequiresRead()java.lang.Stringtable()static SlicestoSlices(ClusteringComparator comparator, java.util.SortedSet<ClusteringBound<?>> startBounds, java.util.SortedSet<ClusteringBound<?>> endBounds)static SlicestoSlices(TableMetadata metadata, java.util.SortedSet<ClusteringBound<?>> startBounds, java.util.SortedSet<ClusteringBound<?>> endBounds)RegularAndStaticColumnsupdatedColumns()booleanupdatesRegularRows()booleanupdatesStaticRow()voidvalidate(ClientState state)Perform additional validation required by the statment.voidvalidateDiskUsage(QueryOptions options, ClientState state)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.cassandra.cql3.CQLStatement
getAuditLogContext
-
-
-
-
Field Detail
-
logger
protected static final org.slf4j.Logger logger
-
CUSTOM_EXPRESSIONS_NOT_ALLOWED
public static final java.lang.String CUSTOM_EXPRESSIONS_NOT_ALLOWED
- See Also:
- Constant Field Values
-
type
protected final StatementType type
-
bindVariables
protected final VariableSpecifications bindVariables
-
metadata
public final TableMetadata metadata
-
-
Constructor Detail
-
ModificationStatement
public ModificationStatement(StatementType type, VariableSpecifications bindVariables, TableMetadata metadata, Operations operations, StatementRestrictions restrictions, Conditions conditions, Attributes attrs)
-
-
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)
-
addFunctionsTo
public void addFunctionsTo(java.util.List<Function> functions)
-
metadata
public TableMetadata metadata()
-
getRestrictions
public StatementRestrictions 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
public java.lang.String keyspace()
- Specified by:
keyspacein interfaceCQLStatement.SingleKeyspaceCqlStatement
-
table
public java.lang.String table()
-
isCounter
public boolean isCounter()
-
isView
public boolean isView()
-
isVirtual
public boolean isVirtual()
-
getTimestamp
public long getTimestamp(long now, QueryOptions options) throws InvalidRequestException- Throws:
InvalidRequestException
-
isTimestampSet
public boolean isTimestampSet()
-
getTimeToLive
public int getTimeToLive(QueryOptions options) throws InvalidRequestException
- Throws:
InvalidRequestException
-
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(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
-
validateDiskUsage
public void validateDiskUsage(QueryOptions options, ClientState state)
-
updatedColumns
public RegularAndStaticColumns updatedColumns()
-
conditionColumns
public RegularAndStaticColumns conditionColumns()
-
updatesRegularRows
public boolean updatesRegularRows()
-
updatesStaticRow
public boolean updatesStaticRow()
-
getRegularOperations
public java.util.List<Operation> getRegularOperations()
-
getStaticOperations
public java.util.List<Operation> getStaticOperations()
-
allOperations
public java.lang.Iterable<Operation> allOperations()
-
getColumnsWithConditions
public java.lang.Iterable<ColumnMetadata> getColumnsWithConditions()
-
hasIfNotExistCondition
public boolean hasIfNotExistCondition()
-
hasIfExistCondition
public boolean hasIfExistCondition()
-
buildPartitionKeyNames
public java.util.List<java.nio.ByteBuffer> buildPartitionKeyNames(QueryOptions options, ClientState state) throws InvalidRequestException
- Throws:
InvalidRequestException
-
createClustering
public java.util.NavigableSet<Clustering<?>> createClustering(QueryOptions options, ClientState state) throws InvalidRequestException
- Throws:
InvalidRequestException
-
appliesOnlyToStaticColumns
public static boolean appliesOnlyToStaticColumns(Operations operation, Conditions conditions)
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
public ResultMessage executeInternalWithCondition(QueryState state, QueryOptions options)
-
createSlices
public Slices createSlices(QueryOptions options)
-
toSlices
public static Slices toSlices(TableMetadata metadata, java.util.SortedSet<ClusteringBound<?>> startBounds, java.util.SortedSet<ClusteringBound<?>> endBounds)
-
toSlices
public static Slices toSlices(ClusteringComparator comparator, java.util.SortedSet<ClusteringBound<?>> startBounds, java.util.SortedSet<ClusteringBound<?>> endBounds)
-
-