Class TokenRestriction
- java.lang.Object
-
- org.apache.cassandra.cql3.restrictions.TokenRestriction
-
- All Implemented Interfaces:
Restriction,Restrictions
- Direct Known Subclasses:
TokenRestriction.EQRestriction,TokenRestriction.SliceRestriction
public abstract class TokenRestriction extends java.lang.ObjectRestrictionusing the token function.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTokenRestriction.EQRestrictionstatic classTokenRestriction.SliceRestriction
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<ColumnMetadata>columnDefsThe definition of the columns to which apply the token restriction.protected TableMetadatametadata
-
Constructor Summary
Constructors Constructor Description TokenRestriction(TableMetadata metadata, java.util.List<ColumnMetadata> columnDefs)Creates a newTokenRestrictionthat apply to the specified columns.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddRowFilterTo(RowFilter filter, IndexRegistry indexRegistry, QueryOptions options)Adds to the specified row filter the expressions corresponding to thisRestriction.java.util.List<java.nio.ByteBuffer>bounds(Bound b, QueryOptions options)protected abstract org.apache.cassandra.cql3.restrictions.PartitionKeyRestrictionsdoMergeWith(TokenRestriction otherRestriction)Merges this restriction with the specifiedTokenRestriction.java.util.List<ColumnMetadata>getColumnDefs()Returns the column definitions in position order.protected java.lang.StringgetColumnNamesAsString()Returns the column names as a comma separatedString.ColumnMetadatagetFirstColumn()Returns the definition of the first column.ColumnMetadatagetLastColumn()Returns the definition of the last column.java.util.Set<Restriction>getRestrictions(ColumnMetadata columnDef)Returns the restrictions applied to the specified column.booleanhasBound(Bound b)Checks if the specified bound is set or not.booleanhasIN()Checks if any of the underlying restriction is an IN.booleanhasOnlyEqualityRestrictions()Checks 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.booleanhasUnrestrictedPartitionKeyComponents(TableMetadata table)booleanisEmpty()Checks if thisRestrictionsis empty or not.booleanisInclusive(Bound b)Checks if the specified bound is inclusive or not.booleanisOnToken()org.apache.cassandra.cql3.restrictions.PartitionKeyRestrictionsmergeWith(Restriction otherRestriction)booleanneedFiltering(TableMetadata table)intsize()Returns the number of columns that have a restriction.java.util.List<java.nio.ByteBuffer>values(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.restrictions.Restriction
addFunctionsTo
-
Methods inherited from interface org.apache.cassandra.cql3.restrictions.Restrictions
hasContains
-
-
-
-
Field Detail
-
columnDefs
protected final java.util.List<ColumnMetadata> columnDefs
The definition of the columns to which apply the token restriction.
-
metadata
protected final TableMetadata metadata
-
-
Constructor Detail
-
TokenRestriction
public TokenRestriction(TableMetadata metadata, java.util.List<ColumnMetadata> columnDefs)
Creates a newTokenRestrictionthat apply to the specified columns.- Parameters:
columnDefs- the definition of the columns to which apply the token restriction
-
-
Method Detail
-
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
public java.util.Set<Restriction> getRestrictions(ColumnMetadata columnDef)
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
public boolean needFiltering(TableMetadata table)
-
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
public boolean hasUnrestrictedPartitionKeyComponents(TableMetadata table)
-
getColumnDefs
public java.util.List<ColumnMetadata> getColumnDefs()
Description copied from interface:RestrictionReturns the column definitions in position order.- Specified by:
getColumnDefsin interfaceRestriction- Returns:
- the column definitions in position order.
-
getFirstColumn
public ColumnMetadata getFirstColumn()
Description copied from interface:RestrictionReturns the definition of the first column.- Specified by:
getFirstColumnin interfaceRestriction- Returns:
- the definition of the first column.
-
getLastColumn
public ColumnMetadata getLastColumn()
Description copied from interface:RestrictionReturns the definition of the last column.- Specified by:
getLastColumnin interfaceRestriction- Returns:
- the definition of the last column.
-
hasSupportingIndex
public boolean hasSupportingIndex(IndexRegistry indexRegistry)
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
-
addRowFilterTo
public void addRowFilterTo(RowFilter filter, IndexRegistry indexRegistry, QueryOptions options)
Description copied from interface:RestrictionAdds to the specified row filter the expressions corresponding to thisRestriction.- Specified by:
addRowFilterToin interfaceRestriction- Parameters:
filter- the row filter to add expressions toindexRegistry- the index registryoptions- the query options
-
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
protected final java.lang.String 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
public abstract java.util.List<java.nio.ByteBuffer> values(QueryOptions options, ClientState state)
-
bounds
public abstract java.util.List<java.nio.ByteBuffer> bounds(Bound b, QueryOptions options)
-
hasBound
public abstract boolean hasBound(Bound b)
Checks if the specified bound is set or not.- Parameters:
b- the bound type- Returns:
trueif the specified bound is set,falseotherwise
-
isInclusive
public abstract boolean isInclusive(Bound b)
Checks if the specified bound is inclusive or not.- Parameters:
b- the bound type- Returns:
trueif the specified bound is inclusive,falseotherwise
-
-