Package org.apache.cassandra.cql3
Class SingleColumnRelation
- java.lang.Object
-
- org.apache.cassandra.cql3.Relation
-
- org.apache.cassandra.cql3.SingleColumnRelation
-
public final class SingleColumnRelation extends Relation
Relations encapsulate the relationship between an entity of some kind, and a value (term). For example,<key> > "start" or "colname1" = "somevalue"
.
-
-
Field Summary
-
Fields inherited from class org.apache.cassandra.cql3.Relation
relationType
-
-
Constructor Summary
Constructors Constructor Description SingleColumnRelation(ColumnIdentifier entity, Operator type, Term.Raw value)
Creates a new relation.SingleColumnRelation(ColumnIdentifier entity, Term.Raw mapKey, Operator type, Term.Raw value)
Creates a new relation.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SingleColumnRelation
createInRelation(ColumnIdentifier entity, java.util.List<Term.Raw> inValues)
boolean
equals(java.lang.Object o)
ColumnIdentifier
getEntity()
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.Raw
getMapKey()
Term.Raw
getValue()
Returns the raw value for this relation, or null if this is an IN relation.int
hashCode()
protected Restriction
newContainsRestriction(TableMetadata table, VariableSpecifications boundNames, boolean isKey)
Creates a new Contains restriction instance.protected Restriction
newEQRestriction(TableMetadata table, VariableSpecifications boundNames)
Creates a new EQ restriction instance.protected Restriction
newINRestriction(TableMetadata table, VariableSpecifications boundNames)
Creates a new IN restriction instance.protected Restriction
newIsNotRestriction(TableMetadata table, VariableSpecifications boundNames)
protected Restriction
newLikeRestriction(TableMetadata table, VariableSpecifications boundNames, Operator operator)
protected Restriction
newSliceRestriction(TableMetadata table, VariableSpecifications boundNames, Bound bound, boolean inclusive)
Creates a new Slice restriction instance.Relation
renameIdentifier(ColumnIdentifier from, ColumnIdentifier to)
Renames an identifier in this Relation, if applicable.java.lang.String
toCQLString()
Returns a CQL representation of this relation.protected Term
toTerm(java.util.List<? extends ColumnSpecification> receivers, Term.Raw raw, java.lang.String keyspace, VariableSpecifications boundNames)
Converts the specifiedRaw
into aTerm
.SingleColumnRelation
withNonStrictOperator()
-
Methods inherited from class org.apache.cassandra.cql3.Relation
isContains, isContainsKey, isEQ, isIN, isLIKE, isMultiColumn, isSlice, onToken, operator, toRestriction, toString, toTerms
-
-
-
-
Constructor Detail
-
SingleColumnRelation
public SingleColumnRelation(ColumnIdentifier entity, Term.Raw mapKey, Operator type, Term.Raw value)
Creates a new relation.- Parameters:
entity
- the kind of relation this is; what the term is being compared to.mapKey
- the key into the entity identifying the value the term is being compared to.type
- the type that describes how this entity relates to the value.value
- the value being compared.
-
SingleColumnRelation
public SingleColumnRelation(ColumnIdentifier entity, Operator type, Term.Raw value)
Creates a new relation.- Parameters:
entity
- the kind of relation this is; what the term is being compared to.type
- the type that describes how this entity relates to the value.value
- the value being compared.
-
-
Method Detail
-
getValue
public Term.Raw getValue()
Description copied from class:Relation
Returns 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:Relation
Returns the list of raw IN values for this relation, or null if this is not an IN relation.- Specified by:
getInValues
in classRelation
-
createInRelation
public static SingleColumnRelation createInRelation(ColumnIdentifier entity, java.util.List<Term.Raw> inValues)
-
getEntity
public ColumnIdentifier getEntity()
-
getMapKey
public Term.Raw getMapKey()
-
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:Relation
Converts the specifiedRaw
into aTerm
.- Specified by:
toTerm
in 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
Term
corresponding to the specifiedRaw
- Throws:
InvalidRequestException
- if theRaw
term is not valid
-
withNonStrictOperator
public SingleColumnRelation withNonStrictOperator()
-
renameIdentifier
public Relation renameIdentifier(ColumnIdentifier from, ColumnIdentifier to)
Description copied from class:Relation
Renames an identifier in this Relation, if applicable.- Specified by:
renameIdentifier
in 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:Relation
Returns a CQL representation of this relation.- Specified by:
toCQLString
in classRelation
- Returns:
- a CQL representation of this relation
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
newEQRestriction
protected Restriction newEQRestriction(TableMetadata table, VariableSpecifications boundNames)
Description copied from class:Relation
Creates a new EQ restriction instance.- Specified by:
newEQRestriction
in 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:Relation
Creates a new IN restriction instance.- Specified by:
newINRestriction
in 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:Relation
Creates a new Slice restriction instance.- Specified by:
newSliceRestriction
in classRelation
- Parameters:
table
- the table meta databoundNames
- the variables specification where to collect the bind variablesbound
- the slice boundinclusive
-true
if the bound is included.- Returns:
- a new slice restriction instance
-
newContainsRestriction
protected Restriction newContainsRestriction(TableMetadata table, VariableSpecifications boundNames, boolean isKey) throws InvalidRequestException
Description copied from class:Relation
Creates a new Contains restriction instance.- Specified by:
newContainsRestriction
in classRelation
- Parameters:
table
- the table meta databoundNames
- the variables specification where to collect the bind variablesisKey
-true
if the restriction to create is a CONTAINS KEY- Returns:
- a new Contains
Restriction
instance - Throws:
InvalidRequestException
- if theRelation
is not valid
-
newIsNotRestriction
protected Restriction newIsNotRestriction(TableMetadata table, VariableSpecifications boundNames) throws InvalidRequestException
- Specified by:
newIsNotRestriction
in classRelation
- Throws:
InvalidRequestException
-
newLikeRestriction
protected Restriction newLikeRestriction(TableMetadata table, VariableSpecifications boundNames, Operator operator)
- Specified by:
newLikeRestriction
in classRelation
-
-