public abstract class TokenRestriction
extends java.lang.Object
Restriction
using the token function.Modifier and Type | Class and Description |
---|---|
static class |
TokenRestriction.EQRestriction |
static class |
TokenRestriction.SliceRestriction |
Modifier and Type | Field and Description |
---|---|
protected java.util.List<ColumnDefinition> |
columnDefs
The definition of the columns to which apply the token restriction.
|
protected ClusteringComparator |
comparator
The composite type.
|
Constructor and Description |
---|
TokenRestriction(CFMetaData metadata,
java.util.List<ColumnDefinition> columnDefs)
Creates a new
TokenRestriction that apply to the specified columns. |
Modifier and Type | Method and Description |
---|---|
void |
addFunctionsTo(java.util.List<Function> functions)
Adds all functions (native and user-defined) used by any component of the restriction
to the specified list.
|
void |
addRowFilterTo(RowFilter filter,
SecondaryIndexManager indexManager,
QueryOptions options)
Adds to the specified row filter the expressions corresponding to this
Restriction . |
MultiCBuilder |
appendBoundTo(MultiCBuilder builder,
Bound bound,
QueryOptions options)
Appends the values of the
Restriction for the specified bound to the specified builder. |
MultiCBuilder |
appendTo(MultiCBuilder builder,
QueryOptions options)
Appends the values of this
Restriction to the specified builder. |
java.util.List<java.nio.ByteBuffer> |
bounds(Bound b,
QueryOptions options) |
java.util.NavigableSet<Slice.Bound> |
boundsAsClustering(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.
|
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 |
isNotNull() |
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.
|
java.util.List<java.nio.ByteBuffer> |
values(QueryOptions options) |
java.util.NavigableSet<Clustering> |
valuesAsClustering(QueryOptions options) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addFunctionsTo, appendBoundTo, hasBound, isContains, isEQ, isIN, isInclusive, isMultiColumn, isNotNull, isSlice
protected final java.util.List<ColumnDefinition> columnDefs
protected final ClusteringComparator comparator
public TokenRestriction(CFMetaData metadata, java.util.List<ColumnDefinition> columnDefs)
TokenRestriction
that apply to the specified columns.columnDefs
- the definition of the columns to which apply the token restrictionpublic boolean isOnToken()
isOnToken
in interface Restriction
public java.util.List<ColumnDefinition> getColumnDefs()
Restriction
public ColumnDefinition getFirstColumn()
Restriction
public ColumnDefinition getLastColumn()
Restriction
public boolean hasSupportingIndex(SecondaryIndexManager secondaryIndexManager)
Restriction
secondaryIndexManager
- the index managertrue
if the restriction is on indexed columns, false
public void addRowFilterTo(RowFilter filter, SecondaryIndexManager indexManager, QueryOptions options)
Restriction
Restriction
.filter
- the row filter to add expressions toindexManager
- the secondary index manageroptions
- the query optionspublic MultiCBuilder appendTo(MultiCBuilder builder, QueryOptions options)
Restriction
Restriction
to the specified builder.builder
- the MultiCBuilder
to append to.options
- the query optionsMultiCBuilder
public java.util.NavigableSet<Clustering> valuesAsClustering(QueryOptions options) throws InvalidRequestException
InvalidRequestException
public java.util.NavigableSet<Slice.Bound> boundsAsClustering(Bound bound, QueryOptions options) throws InvalidRequestException
InvalidRequestException
protected final java.lang.String getColumnNamesAsString()
String
.String
.public final org.apache.cassandra.cql3.restrictions.PrimaryKeyRestrictions mergeWith(Restriction otherRestriction) throws InvalidRequestException
Restriction
Restriction 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.InvalidRequestException
public java.util.List<java.nio.ByteBuffer> bounds(Bound b, QueryOptions options) throws InvalidRequestException
InvalidRequestException
public 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(QueryOptions options) throws InvalidRequestException
InvalidRequestException
public void addFunctionsTo(java.util.List<Function> functions)
functions
- the list to add topublic boolean isMultiColumn()
isMultiColumn
in interface Restriction
public boolean isSlice()
isSlice
in interface Restriction
public boolean isEQ()
isEQ
in interface Restriction
public boolean isIN()
isIN
in interface Restriction
public boolean isContains()
isContains
in interface Restriction
public boolean isNotNull()
isNotNull
in interface Restriction
public boolean hasBound(Bound b)
Restriction
hasBound
in interface Restriction
b
- the bound typetrue
if the specified bound is set, false
otherwisepublic MultiCBuilder appendBoundTo(MultiCBuilder builder, Bound bound, QueryOptions options)
Restriction
Restriction
for the specified bound to the specified builder.appendBoundTo
in interface Restriction
builder
- the MultiCBuilder
to append to.bound
- the boundoptions
- the query optionsMultiCBuilder
public boolean isInclusive(Bound b)
Restriction
isInclusive
in interface Restriction
b
- the bound typetrue
if the specified bound is inclusive, false
otherwiseprotected static Bound reverseBoundIfNeeded(ColumnDefinition columnDefinition, Bound bound)
columnDefinition
- the column definitionbound
- the boundCopyright © 2016 The Apache Software Foundation