public abstract class TokenRestriction
extends java.lang.Object
Restriction using the token function.| Modifier and Type | Class and Description |
|---|---|
static class |
TokenRestriction.EQ |
static class |
TokenRestriction.Slice |
| Modifier and Type | Field and Description |
|---|---|
protected java.util.List<ColumnDefinition> |
columnDefs
The definition of the columns to which apply the token restriction.
|
protected CType |
ctype
The composite type.
|
| Constructor and Description |
|---|
TokenRestriction(CType ctype,
java.util.List<ColumnDefinition> columnDefs)
Creates a new
TokenRestriction that apply to the specified columns. |
| Modifier and Type | Method and Description |
|---|---|
void |
addIndexExpressionTo(java.util.List<IndexExpression> expressions,
SecondaryIndexManager indexManager,
QueryOptions options)
Adds to the specified list the
IndexExpressions corresponding to this Restriction. |
CompositesBuilder |
appendBoundTo(CFMetaData cfm,
CompositesBuilder builder,
Bound bound,
QueryOptions options)
Appends the values of the
Restriction for the specified bound to the specified builder. |
CompositesBuilder |
appendTo(CFMetaData cfm,
CompositesBuilder builder,
QueryOptions options)
Appends the values of this
Restriction to the specified builder. |
java.util.List<java.nio.ByteBuffer> |
bounds(CFMetaData cfm,
Bound b,
QueryOptions options) |
java.util.List<Composite> |
boundsAsComposites(CFMetaData cfm,
Bound bound,
QueryOptions options) |
protected abstract org.apache.cassandra.cql3.restrictions.PrimaryKeyRestrictions |
doMergeWith(TokenRestriction otherRestriction)
Merges this restriction with the specified
TokenRestriction. |
java.util.List<ColumnDefinition> |
getColumnDefs()
Returns the column definitions in position order.
|
protected java.lang.String |
getColumnNamesAsString()
Returns the column names as a comma separated
String. |
ColumnDefinition |
getFirstColumn()
Returns the definition of the first column.
|
java.lang.Iterable<Function> |
getFunctions()
Return an Iterable over all of the functions (both native and user-defined) used by any component
of the restrictions
|
ColumnDefinition |
getLastColumn()
Returns the definition of the last column.
|
boolean |
hasBound(Bound b)
Checks if the specified bound is set or not.
|
boolean |
hasSupportingIndex(SecondaryIndexManager secondaryIndexManager)
Check if the restriction is on indexed columns.
|
boolean |
isContains() |
boolean |
isEmpty()
Checks if this
PrimaryKeyRestrictionSet is empty or not. |
boolean |
isEQ() |
boolean |
isIN() |
boolean |
isInclusive(Bound b)
Checks if the specified bound is inclusive or not.
|
boolean |
isMultiColumn() |
boolean |
isNotReturningAnyRows(CFMetaData cfm,
QueryOptions options)
Checks if this restriction will prevent the query to return any rows.
|
boolean |
isOnToken() |
boolean |
isSlice() |
org.apache.cassandra.cql3.restrictions.PrimaryKeyRestrictions |
mergeWith(Restriction otherRestriction)
Merges this restriction with the specified one.
|
protected static Bound |
reverseBoundIfNeeded(ColumnDefinition columnDefinition,
Bound bound)
Reverses the specified bound if the column type is a reversed one.
|
int |
size()
Returns the number of columns that have a restriction.
|
protected static java.nio.ByteBuffer |
validateIndexedValue(ColumnSpecification columnSpec,
java.nio.ByteBuffer value) |
java.util.List<java.nio.ByteBuffer> |
values(CFMetaData cfm,
QueryOptions options) |
java.util.List<Composite> |
valuesAsComposites(CFMetaData cfm,
QueryOptions options) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitappendBoundTo, getFunctions, hasBound, isContains, isEQ, isIN, isInclusive, isMultiColumn, isNotReturningAnyRows, isSliceprotected final java.util.List<ColumnDefinition> columnDefs
protected final CType ctype
public TokenRestriction(CType ctype, java.util.List<ColumnDefinition> columnDefs)
TokenRestriction that apply to the specified columns.ctype - the composite typecolumnDefs - the definition of the columns to which apply the token restrictionpublic boolean isOnToken()
isOnToken in interface Restrictionpublic java.util.List<ColumnDefinition> getColumnDefs()
Restrictionpublic ColumnDefinition getFirstColumn()
Restrictionpublic ColumnDefinition getLastColumn()
Restrictionpublic boolean hasSupportingIndex(SecondaryIndexManager secondaryIndexManager)
RestrictionsecondaryIndexManager - the index managertrue if the restriction is on indexed columns, falsepublic final void addIndexExpressionTo(java.util.List<IndexExpression> expressions, SecondaryIndexManager indexManager, QueryOptions options)
RestrictionIndexExpressions corresponding to this Restriction.expressions - the list to add the IndexExpressions toindexManager - the secondary index manageroptions - the query optionspublic CompositesBuilder appendTo(CFMetaData cfm, CompositesBuilder builder, QueryOptions options)
RestrictionRestriction to the specified builder.cfm - the table metadatabuilder - the CompositesBuilder to append to.options - the query optionsCompositesBuilderpublic java.util.List<Composite> valuesAsComposites(CFMetaData cfm, QueryOptions options) throws InvalidRequestException
InvalidRequestExceptionpublic java.util.List<Composite> boundsAsComposites(CFMetaData cfm, Bound bound, QueryOptions options) throws InvalidRequestException
InvalidRequestExceptionprotected final java.lang.String getColumnNamesAsString()
String.String.public final org.apache.cassandra.cql3.restrictions.PrimaryKeyRestrictions mergeWith(Restriction otherRestriction) throws InvalidRequestException
RestrictionRestriction are immutable. Therefore merging two restrictions result in a new one. The reason behind this choice is that it allow a great flexibility in the way the merging can done while preventing any side effect.
otherRestriction - the restriction to merge into this oneInvalidRequestException - if the restrictions cannot be mergedprotected abstract org.apache.cassandra.cql3.restrictions.PrimaryKeyRestrictions doMergeWith(TokenRestriction otherRestriction) throws InvalidRequestException
TokenRestriction.otherRestriction - the TokenRestriction to merge with.InvalidRequestExceptionpublic java.util.List<java.nio.ByteBuffer> bounds(CFMetaData cfm, Bound b, QueryOptions options) throws InvalidRequestException
InvalidRequestExceptionpublic final boolean isEmpty()
PrimaryKeyRestrictionSet is empty or not.true if this PrimaryKeyRestrictionSet is empty, false otherwise.public final int size()
public java.util.List<java.nio.ByteBuffer> values(CFMetaData cfm, QueryOptions options) throws InvalidRequestException
InvalidRequestExceptionpublic java.lang.Iterable<Function> getFunctions()
public boolean isMultiColumn()
isMultiColumn in interface Restrictionpublic boolean isSlice()
isSlice in interface Restrictionpublic boolean isEQ()
isEQ in interface Restrictionpublic boolean isIN()
isIN in interface Restrictionpublic boolean isContains()
isContains in interface Restrictionpublic boolean hasBound(Bound b)
RestrictionhasBound in interface Restrictionb - the bound typetrue if the specified bound is set, false otherwisepublic CompositesBuilder appendBoundTo(CFMetaData cfm, CompositesBuilder builder, Bound bound, QueryOptions options)
RestrictionRestriction for the specified bound to the specified builder.appendBoundTo in interface Restrictioncfm - the table metadatabuilder - the CompositesBuilder to append to.bound - the boundoptions - the query optionsCompositesBuilderpublic boolean isInclusive(Bound b)
RestrictionisInclusive in interface Restrictionb - the bound typetrue if the specified bound is inclusive, false otherwisepublic boolean isNotReturningAnyRows(CFMetaData cfm, QueryOptions options)
RestrictionisNotReturningAnyRows in interface Restrictioncfm - the table metadataoptions - the query optionstrue if this restriction will prevent the query to return any rows, otherwiseprotected static java.nio.ByteBuffer validateIndexedValue(ColumnSpecification columnSpec, java.nio.ByteBuffer value) throws InvalidRequestException
InvalidRequestExceptionprotected static Bound reverseBoundIfNeeded(ColumnDefinition columnDefinition, Bound bound)
columnDefinition - the column definitionbound - the boundCopyright © 2018 The Apache Software Foundation