Package org.apache.cassandra.cql3
Class TokenRelation
- java.lang.Object
-
- org.apache.cassandra.cql3.Relation
-
- org.apache.cassandra.cql3.TokenRelation
-
public final class TokenRelation extends Relation
A relation using the token function. Examples:- SELECT ... WHERE token(a) > token(1)
- SELECT ... WHERE token(a, b) > token(1, 3)
-
-
Field Summary
-
Fields inherited from class org.apache.cassandra.cql3.Relation
relationType
-
-
Constructor Summary
Constructors Constructor Description TokenRelation(java.util.List<ColumnIdentifier> entities, Operator type, Term.Raw value)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)java.util.List<? extends Term.Raw>getInValues()Returns the list of raw IN values for this relation, or null if this is not an IN relation.Term.RawgetValue()Returns the raw value for this relation, or null if this is an IN relation.inthashCode()protected RestrictionnewContainsRestriction(TableMetadata table, VariableSpecifications boundNames, boolean isKey)Creates a new Contains restriction instance.protected RestrictionnewEQRestriction(TableMetadata table, VariableSpecifications boundNames)Creates a new EQ restriction instance.protected RestrictionnewINRestriction(TableMetadata table, VariableSpecifications boundNames)Creates a new IN restriction instance.protected RestrictionnewIsNotRestriction(TableMetadata table, VariableSpecifications boundNames)protected RestrictionnewLikeRestriction(TableMetadata table, VariableSpecifications boundNames, Operator operator)protected RestrictionnewSliceRestriction(TableMetadata table, VariableSpecifications boundNames, Bound bound, boolean inclusive)Creates a new Slice restriction instance.booleanonToken()Checks if this relation is a token relation (e.g.RelationrenameIdentifier(ColumnIdentifier from, ColumnIdentifier to)Renames an identifier in this Relation, if applicable.java.lang.StringtoCQLString()Returns a CQL representation of this relation.protected TermtoTerm(java.util.List<? extends ColumnSpecification> receivers, Term.Raw raw, java.lang.String keyspace, VariableSpecifications boundNames)Converts the specifiedRawinto aTerm.-
Methods inherited from class org.apache.cassandra.cql3.Relation
isContains, isContainsKey, isEQ, isIN, isLIKE, isMultiColumn, isSlice, operator, toRestriction, toString, toTerms
-
-
-
-
Constructor Detail
-
TokenRelation
public TokenRelation(java.util.List<ColumnIdentifier> entities, Operator type, Term.Raw value)
-
-
Method Detail
-
onToken
public boolean onToken()
Description copied from class:RelationChecks if this relation is a token relation (e.g.token(a) = token(1)
).
-
getValue
public Term.Raw getValue()
Description copied from class:RelationReturns the raw value for this relation, or null if this is an IN relation.
-
getInValues
public java.util.List<? extends Term.Raw> getInValues()
Description copied from class:RelationReturns the list of raw IN values for this relation, or null if this is not an IN relation.- Specified by:
getInValuesin classRelation
-
newEQRestriction
protected Restriction newEQRestriction(TableMetadata table, VariableSpecifications boundNames)
Description copied from class:RelationCreates a new EQ restriction instance.- Specified by:
newEQRestrictionin classRelation- Parameters:
table- the table meta databoundNames- the variables specification where to collect the bind variables- Returns:
- a new EQ restriction instance.
-
newINRestriction
protected Restriction newINRestriction(TableMetadata table, VariableSpecifications boundNames)
Description copied from class:RelationCreates a new IN restriction instance.- Specified by:
newINRestrictionin classRelation- Parameters:
table- the table meta databoundNames- the variables specification where to collect the bind variables- Returns:
- a new IN restriction instance
-
newSliceRestriction
protected Restriction newSliceRestriction(TableMetadata table, VariableSpecifications boundNames, Bound bound, boolean inclusive)
Description copied from class:RelationCreates a new Slice restriction instance.- Specified by:
newSliceRestrictionin classRelation- Parameters:
table- the table meta databoundNames- the variables specification where to collect the bind variablesbound- the slice boundinclusive-trueif the bound is included.- Returns:
- a new slice restriction instance
-
newContainsRestriction
protected Restriction newContainsRestriction(TableMetadata table, VariableSpecifications boundNames, boolean isKey)
Description copied from class:RelationCreates a new Contains restriction instance.- Specified by:
newContainsRestrictionin classRelation- Parameters:
table- the table meta databoundNames- the variables specification where to collect the bind variablesisKey-trueif the restriction to create is a CONTAINS KEY- Returns:
- a new Contains
Restrictioninstance
-
newIsNotRestriction
protected Restriction newIsNotRestriction(TableMetadata table, VariableSpecifications boundNames)
- Specified by:
newIsNotRestrictionin classRelation
-
newLikeRestriction
protected Restriction newLikeRestriction(TableMetadata table, VariableSpecifications boundNames, Operator operator)
- Specified by:
newLikeRestrictionin classRelation
-
toTerm
protected Term toTerm(java.util.List<? extends ColumnSpecification> receivers, Term.Raw raw, java.lang.String keyspace, VariableSpecifications boundNames) throws InvalidRequestException
Description copied from class:RelationConverts the specifiedRawinto aTerm.- Specified by:
toTermin classRelation- Parameters:
receivers- the columns to which the values must be associated atraw- the raw term to convertkeyspace- the keyspace nameboundNames- the variables specification where to collect the bind variables- Returns:
- the
Termcorresponding to the specifiedRaw - Throws:
InvalidRequestException- if theRawterm is not valid
-
renameIdentifier
public Relation renameIdentifier(ColumnIdentifier from, ColumnIdentifier to)
Description copied from class:RelationRenames an identifier in this Relation, if applicable.- Specified by:
renameIdentifierin classRelation- Parameters:
from- the old identifierto- the new identifier- Returns:
- this object, if the old identifier is not in the set of entities that this relation covers; otherwise a new Relation with "from" replaced by "to" is returned.
-
toCQLString
public java.lang.String toCQLString()
Description copied from class:RelationReturns a CQL representation of this relation.- Specified by:
toCQLStringin classRelation- Returns:
- a CQL representation of this relation
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
-