Class TokenRestriction
java.lang.Object
org.apache.cassandra.cql3.restrictions.TokenRestriction
- All Implemented Interfaces:
Restriction,Restrictions
- Direct Known Subclasses:
TokenRestriction.EQRestriction,TokenRestriction.SliceRestriction
Restriction using the token function.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final List<ColumnMetadata>The definition of the columns to which apply the token restriction.protected final TableMetadata -
Constructor Summary
ConstructorsConstructorDescriptionTokenRestriction(TableMetadata metadata, List<ColumnMetadata> columnDefs) Creates a newTokenRestrictionthat apply to the specified columns. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddToRowFilter(RowFilter filter, IndexRegistry indexRegistry, QueryOptions options) Adds to the specified row filter the expressions corresponding to thisRestriction.bounds(Bound b, QueryOptions options) protected abstract org.apache.cassandra.cql3.restrictions.PartitionKeyRestrictionsdoMergeWith(TokenRestriction otherRestriction) Merges this restriction with the specifiedTokenRestriction.findSupportingIndex(IndexRegistry indexRegistry) Find first supporting index for current restrictionfindSupportingIndexFromQueryPlan(Index.QueryPlan indexQueryPlan) Find the first supporting index for the current restriction from anIndex.QueryPlan.Returns the column definitions in position order.protected final StringReturns the column names as a comma separatedString.Returns the definition of the first column.Returns the definition of the last column.getRestrictions(ColumnMetadata columnDef) Returns the restrictions applied to the specified column.booleanChecks if the specified bound is set or not.booleanhasIN()Checks if any of the underlying restriction is an IN.booleanChecks if all of the underlying restrictions are EQ or IN restrictions.booleanhasSlice()Checks if any of the underlying restrictions is a slice.booleanhasSupportingIndex(IndexRegistry indexRegistry) Check if the restriction is on indexed columns.booleanfinal booleanisEmpty()Checks if thisRestrictionsis empty or not.booleanisInclusive(Bound b) Checks if the specified bound is inclusive or not.final booleanfinal org.apache.cassandra.cql3.restrictions.PartitionKeyRestrictionsmergeWith(Restriction otherRestriction) booleanneedFiltering(TableMetadata table) booleanneedsFiltering(Index.Group indexGroup) Returns whether this restriction would need filtering if the specified index group were used.final intsize()Returns the number of columns that have a restriction.values(QueryOptions options, ClientState state) 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.restrictions.Restriction
addFunctionsToMethods inherited from interface org.apache.cassandra.cql3.restrictions.Restrictions
getColumnDefinitions, hasContains
-
Field Details
-
columnDefs
The definition of the columns to which apply the token restriction. -
metadata
-
-
Constructor Details
-
TokenRestriction
Creates a newTokenRestrictionthat apply to the specified columns.- Parameters:
columnDefs- the definition of the columns to which apply the token restriction
-
-
Method Details
-
hasIN
public boolean hasIN()Description copied from interface:RestrictionsChecks if any of the underlying restriction is an IN.- Specified by:
hasINin interfaceRestrictions- Returns:
trueif any of the underlying restriction is an IN,falseotherwise
-
hasOnlyEqualityRestrictions
public boolean hasOnlyEqualityRestrictions()Description copied from interface:RestrictionsChecks if all of the underlying restrictions are EQ or IN restrictions.- Specified by:
hasOnlyEqualityRestrictionsin interfaceRestrictions- Returns:
trueif all of the underlying restrictions are EQ or IN restrictions,falseotherwise
-
getRestrictions
Description copied from interface:RestrictionsReturns the restrictions applied to the specified column.- Specified by:
getRestrictionsin interfaceRestrictions- Parameters:
columnDef- the column definition- Returns:
- the restrictions applied to the specified column
-
isOnToken
public final boolean isOnToken()- Specified by:
isOnTokenin interfaceRestriction
-
needFiltering
-
hasSlice
public boolean hasSlice()Description copied from interface:RestrictionsChecks if any of the underlying restrictions is a slice.- Specified by:
hasSlicein interfaceRestrictions- Returns:
trueif any of the underlying restrictions is a slice,falseotherwise
-
hasUnrestrictedPartitionKeyComponents
-
getColumnDefs
Description copied from interface:RestrictionReturns the column definitions in position order.- Specified by:
getColumnDefsin interfaceRestriction- Returns:
- the column definitions in position order.
-
getFirstColumn
Description copied from interface:RestrictionReturns the definition of the first column.- Specified by:
getFirstColumnin interfaceRestriction- Returns:
- the definition of the first column.
-
getLastColumn
Description copied from interface:RestrictionReturns the definition of the last column.- Specified by:
getLastColumnin interfaceRestriction- Returns:
- the definition of the last column.
-
hasSupportingIndex
Description copied from interface:RestrictionCheck if the restriction is on indexed columns.- Specified by:
hasSupportingIndexin interfaceRestriction- Parameters:
indexRegistry- the index registry- Returns:
trueif the restriction is on indexed columns,false
-
addToRowFilter
Description copied from interface:RestrictionAdds to the specified row filter the expressions corresponding to thisRestriction.- Specified by:
addToRowFilterin interfaceRestriction- Parameters:
filter- the row filter to add expressions toindexRegistry- the index registryoptions- the query options
-
findSupportingIndex
Description copied from interface:RestrictionFind first supporting index for current restriction- Specified by:
findSupportingIndexin interfaceRestriction- Parameters:
indexRegistry- the index registry- Returns:
indexif the restriction is on indexed columns,null
-
findSupportingIndexFromQueryPlan
Description copied from interface:RestrictionFind the first supporting index for the current restriction from anIndex.QueryPlan.- Specified by:
findSupportingIndexFromQueryPlanin interfaceRestriction- Parameters:
indexQueryPlan- the index query plan- Returns:
indexif the restriction is on indexed columns,null
-
needsFiltering
Description copied from interface:RestrictionReturns whether this restriction would need filtering if the specified index group were used.- Specified by:
needsFilteringin interfaceRestriction- Parameters:
indexGroup- an index group- Returns:
trueif this would need filtering ifindexGroupwere used,falseotherwise
-
isEmpty
public final boolean isEmpty()Description copied from interface:RestrictionsChecks if thisRestrictionsis empty or not.- Specified by:
isEmptyin interfaceRestrictions- Returns:
trueif thisRestrictionsis empty,falseotherwise.
-
size
public final int size()Description copied from interface:RestrictionsReturns the number of columns that have a restriction.- Specified by:
sizein interfaceRestrictions- Returns:
- the number of columns that have a restriction.
-
getColumnNamesAsString
Returns the column names as a comma separatedString.- Returns:
- the column names as a comma separated
String.
-
mergeWith
public final org.apache.cassandra.cql3.restrictions.PartitionKeyRestrictions mergeWith(Restriction otherRestriction) throws InvalidRequestException - Throws:
InvalidRequestException
-
doMergeWith
protected abstract org.apache.cassandra.cql3.restrictions.PartitionKeyRestrictions doMergeWith(TokenRestriction otherRestriction) throws InvalidRequestException Merges this restriction with the specifiedTokenRestriction.- Parameters:
otherRestriction- theTokenRestrictionto merge with.- Throws:
InvalidRequestException
-
values
-
bounds
-
hasBound
Checks if the specified bound is set or not.- Parameters:
b- the bound type- Returns:
trueif the specified bound is set,falseotherwise
-
isInclusive
Checks if the specified bound is inclusive or not.- Parameters:
b- the bound type- Returns:
trueif the specified bound is inclusive,falseotherwise
-