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 class
ModificationStatement.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 VariableSpecifications
bindVariables
static java.lang.String
CUSTOM_EXPRESSIONS_NOT_ALLOWED
protected static org.slf4j.Logger
logger
TableMetadata
metadata
protected StatementType
type
-
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 void
addConditions(Clustering<?> clustering, CQL3CasRequest request, QueryOptions options)
void
addFunctionsTo(java.util.List<Function> functions)
abstract void
addUpdateForKey(PartitionUpdate.Builder updateBuilder, Clustering<?> clustering, UpdateParameters params)
abstract void
addUpdateForKey(PartitionUpdate.Builder updateBuilder, Slice slice, UpdateParameters params)
java.lang.Iterable<Operation>
allOperations()
static boolean
appliesOnlyToStaticColumns(Operations operation, Conditions conditions)
Checks that the specified operations and conditions only apply to static columns.void
authorize(ClientState state)
Perform any access verification necessary for the statement.java.util.List<java.nio.ByteBuffer>
buildPartitionKeyNames(QueryOptions options, ClientState state)
RegularAndStaticColumns
conditionColumns()
java.util.NavigableSet<Clustering<?>>
createClustering(QueryOptions options, ClientState state)
Slices
createSlices(QueryOptions options)
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
executeInternalWithCondition(QueryState state, QueryOptions options)
ResultMessage
executeInternalWithoutCondition(QueryState queryState, QueryOptions options, Dispatcher.RequestTime requestTime)
ResultMessage
executeLocally(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()
StatementRestrictions
getRestrictions()
java.util.List<Operation>
getStaticOperations()
long
getTimestamp(long now, QueryOptions options)
int
getTimeToLive(QueryOptions options)
boolean
hasConditions()
Whether or not this CQL Statement has LWT conditionsboolean
hasIfExistCondition()
boolean
hasIfNotExistCondition()
boolean
hasSlices()
boolean
isCounter()
boolean
isTimestampSet()
boolean
isView()
boolean
isVirtual()
java.lang.String
keyspace()
TableMetadata
metadata()
boolean
requiresRead()
java.lang.String
table()
static Slices
toSlices(ClusteringComparator comparator, java.util.SortedSet<ClusteringBound<?>> startBounds, java.util.SortedSet<ClusteringBound<?>> endBounds)
static Slices
toSlices(TableMetadata metadata, java.util.SortedSet<ClusteringBound<?>> startBounds, java.util.SortedSet<ClusteringBound<?>> endBounds)
RegularAndStaticColumns
updatedColumns()
boolean
updatesRegularRows()
boolean
updatesStaticRow()
void
validate(ClientState state)
Perform additional validation required by the statment.void
validateDiskUsage(QueryOptions options, ClientState state)
void
validateTimestamp(QueryState queryState, QueryOptions options)
-
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: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)
-
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:
keyspace
in 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: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(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
-
validateDiskUsage
public void validateDiskUsage(QueryOptions options, ClientState state)
-
validateTimestamp
public void validateTimestamp(QueryState queryState, QueryOptions options)
-
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:
true
if the specified operations and conditions only apply to static columns,false
otherwise.
-
requiresRead
public boolean requiresRead()
-
hasConditions
public boolean hasConditions()
Description copied from interface:CQLStatement
Whether or not this CQL Statement has LWT conditions- Specified by:
hasConditions
in interfaceCQLStatement
-
hasSlices
public boolean hasSlices()
-
execute
public ResultMessage execute(QueryState queryState, QueryOptions options, Dispatcher.RequestTime requestTime) 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 interfaceCQLStatement
- Parameters:
queryState
- the current query stateoptions
- options for this query (consistency, variables, pageSize, ...)requestTime
- request enqueue / and start times;- Throws:
RequestExecutionException
RequestValidationException
-
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: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
-
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)
-
-