Package org.apache.cassandra.cql3
Class MultiColumnRelation
java.lang.Object
org.apache.cassandra.cql3.Relation
org.apache.cassandra.cql3.MultiColumnRelation
A relation using the tuple notation, which typically affects multiple columns.
Examples:
- SELECT ... WHERE (a, b, c) > (1, 'a', 10)
- SELECT ... WHERE (a, b, c) IN ((1, 2, 3), (4, 5, 6))
- SELECT ... WHERE (a, b) < ?
- SELECT ... WHERE (a, b) IN ?
-
Field Summary
Fields inherited from class org.apache.cassandra.cql3.Relation
relationType -
Method Summary
Modifier and TypeMethodDescriptionstatic MultiColumnRelationcreateInRelation(List<ColumnIdentifier> entities, List<? extends Term.MultiColumnRaw> inValues) Creates a multi-column IN relation with a list of IN values or markers.static MultiColumnRelationcreateNonInRelation(List<ColumnIdentifier> entities, Operator relationType, Term.MultiColumnRaw valuesOrMarker) Creates a multi-column EQ, LT, LTE, GT, or GTE relation.static MultiColumnRelationcreateSingleMarkerInRelation(List<ColumnIdentifier> entities, Tuples.INRaw inMarker) Creates a multi-column IN relation with a marker for the IN values.booleanReturns the list of raw IN values for this relation, or null if this is not an IN relation.getValue()For non-IN relations, returns the Tuples.Literal or Tuples.Raw marker for a single tuple.inthashCode()booleanChecks if this relation apply to multiple columns.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.protected List<ColumnMetadata>receivers(TableMetadata table) renameIdentifier(ColumnIdentifier from, ColumnIdentifier to) Renames an identifier in this Relation, if applicable.Returns a CQL representation of this relation.protected TermtoTerm(List<? extends ColumnSpecification> receivers, Term.Raw raw, String keyspace, VariableSpecifications boundNames) Converts the specifiedRawinto aTerm.Methods inherited from class org.apache.cassandra.cql3.Relation
isContains, isContainsKey, isEQ, isIN, isLIKE, isSlice, onToken, operator, toRestriction, toString, toTerms
-
Method Details
-
createNonInRelation
public static MultiColumnRelation createNonInRelation(List<ColumnIdentifier> entities, Operator relationType, Term.MultiColumnRaw valuesOrMarker) Creates a multi-column EQ, LT, LTE, GT, or GTE relation.For example: "SELECT ... WHERE (a, b) > (0, 1)"- Parameters:
entities- the columns on the LHS of the relationrelationType- the relation operatorvaluesOrMarker- a Tuples.Literal instance or a Tuples.Raw marker- Returns:
- a new
MultiColumnRelationinstance
-
createInRelation
public static MultiColumnRelation createInRelation(List<ColumnIdentifier> entities, List<? extends Term.MultiColumnRaw> inValues) Creates a multi-column IN relation with a list of IN values or markers. For example: "SELECT ... WHERE (a, b) IN ((0, 1), (2, 3))"- Parameters:
entities- the columns on the LHS of the relationinValues- a list of Tuples.Literal instances or a Tuples.Raw markers- Returns:
- a new
MultiColumnRelationinstance
-
createSingleMarkerInRelation
public static MultiColumnRelation createSingleMarkerInRelation(List<ColumnIdentifier> entities, Tuples.INRaw inMarker) Creates a multi-column IN relation with a marker for the IN values. For example: "SELECT ... WHERE (a, b) IN ?"- Parameters:
entities- the columns on the LHS of the relationinMarker- a single IN marker- Returns:
- a new
MultiColumnRelationinstance
-
getEntities
-
getValue
For non-IN relations, returns the Tuples.Literal or Tuples.Raw marker for a single tuple. -
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
-
isMultiColumn
public boolean isMultiColumn()Description copied from class:RelationChecks if this relation apply to multiple columns.- Overrides:
isMultiColumnin classRelation- Returns:
trueif this relation apply to multiple columns,falseotherwise.
-
newEQRestriction
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
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
- Specified by:
newIsNotRestrictionin classRelation
-
newLikeRestriction
protected Restriction newLikeRestriction(TableMetadata table, VariableSpecifications boundNames, Operator operator) - Specified by:
newLikeRestrictionin classRelation
-
toTerm
protected Term toTerm(List<? extends ColumnSpecification> receivers, Term.Raw raw, 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
-
receivers
- Throws:
InvalidRequestException
-
renameIdentifier
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
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() -
equals
-