public class MultiColumnRelation extends Relation
- 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 ?
relationType
Modifier and Type | Method and Description |
---|---|
static MultiColumnRelation |
createInRelation(java.util.List<ColumnIdentifier.Raw> entities,
java.util.List<? extends Term.MultiColumnRaw> inValues)
Creates a multi-column IN relation with a list of IN values or markers.
|
static MultiColumnRelation |
createNonInRelation(java.util.List<ColumnIdentifier.Raw> entities,
Operator relationType,
Term.MultiColumnRaw valuesOrMarker)
Creates a multi-column EQ, LT, LTE, GT, or GTE relation.
|
static MultiColumnRelation |
createSingleMarkerInRelation(java.util.List<ColumnIdentifier.Raw> entities,
Tuples.INRaw inMarker)
Creates a multi-column IN relation with a marker for the IN values.
|
java.util.List<ColumnIdentifier.Raw> |
getEntities() |
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.MultiColumnRaw |
getValue()
For non-IN relations, returns the Tuples.Literal or Tuples.Raw marker for a single tuple.
|
boolean |
isMultiColumn()
Checks if this relation apply to multiple columns.
|
protected Restriction |
newContainsRestriction(CFMetaData cfm,
VariableSpecifications boundNames,
boolean isKey)
Creates a new Contains restriction instance.
|
protected Restriction |
newEQRestriction(CFMetaData cfm,
VariableSpecifications boundNames)
Creates a new EQ restriction instance.
|
protected Restriction |
newINRestriction(CFMetaData cfm,
VariableSpecifications boundNames)
Creates a new IN restriction instance.
|
protected Restriction |
newIsNotRestriction(CFMetaData cfm,
VariableSpecifications boundNames) |
protected Restriction |
newSliceRestriction(CFMetaData cfm,
VariableSpecifications boundNames,
Bound bound,
boolean inclusive)
Creates a new Slice restriction instance.
|
protected java.util.List<ColumnDefinition> |
receivers(CFMetaData cfm) |
Relation |
renameIdentifier(ColumnIdentifier.Raw from,
ColumnIdentifier.Raw to)
Renames an identifier in this Relation, if applicable.
|
java.lang.String |
toString() |
protected Term |
toTerm(java.util.List<? extends ColumnSpecification> receivers,
Term.Raw raw,
java.lang.String keyspace,
VariableSpecifications boundNames)
Converts the specified
Raw into a Term . |
isContains, isContainsKey, isEQ, isIN, isSlice, onToken, operator, toColumnDefinition, toRestriction, toTerms
public static MultiColumnRelation createNonInRelation(java.util.List<ColumnIdentifier.Raw> entities, Operator relationType, Term.MultiColumnRaw valuesOrMarker)
For example: "SELECT ... WHERE (a, b) > (0, 1)"
entities
- the columns on the LHS of the relationrelationType
- the relation operatorvaluesOrMarker
- a Tuples.Literal instance or a Tuples.Raw markerMultiColumnRelation
instancepublic static MultiColumnRelation createInRelation(java.util.List<ColumnIdentifier.Raw> entities, java.util.List<? extends Term.MultiColumnRaw> inValues)
entities
- the columns on the LHS of the relationinValues
- a list of Tuples.Literal instances or a Tuples.Raw markersMultiColumnRelation
instancepublic static MultiColumnRelation createSingleMarkerInRelation(java.util.List<ColumnIdentifier.Raw> entities, Tuples.INRaw inMarker)
entities
- the columns on the LHS of the relationinMarker
- a single IN markerMultiColumnRelation
instancepublic java.util.List<ColumnIdentifier.Raw> getEntities()
public Term.MultiColumnRaw getValue()
public java.util.List<? extends Term.Raw> getInValues()
Relation
getInValues
in class Relation
public boolean isMultiColumn()
Relation
isMultiColumn
in class Relation
true
if this relation apply to multiple columns, false
otherwise.protected Restriction newEQRestriction(CFMetaData cfm, VariableSpecifications boundNames) throws InvalidRequestException
Relation
newEQRestriction
in class Relation
cfm
- the Column Family meta databoundNames
- the variables specification where to collect the bind variablesInvalidRequestException
- if the relation cannot be converted into an EQ restriction.protected Restriction newINRestriction(CFMetaData cfm, VariableSpecifications boundNames) throws InvalidRequestException
Relation
newINRestriction
in class Relation
cfm
- the Column Family meta databoundNames
- the variables specification where to collect the bind variablesInvalidRequestException
- if the relation cannot be converted into an IN restriction.protected Restriction newSliceRestriction(CFMetaData cfm, VariableSpecifications boundNames, Bound bound, boolean inclusive) throws InvalidRequestException
Relation
newSliceRestriction
in class Relation
cfm
- the Column Family meta databoundNames
- the variables specification where to collect the bind variablesbound
- the slice boundinclusive
- true
if the bound is included.InvalidRequestException
- if the Relation
is not validprotected Restriction newContainsRestriction(CFMetaData cfm, VariableSpecifications boundNames, boolean isKey) throws InvalidRequestException
Relation
newContainsRestriction
in class Relation
cfm
- the Column Family meta databoundNames
- the variables specification where to collect the bind variablesisKey
- true
if the restriction to create is a CONTAINS KEYRestriction
instanceInvalidRequestException
- if the Relation
is not validprotected Restriction newIsNotRestriction(CFMetaData cfm, VariableSpecifications boundNames) throws InvalidRequestException
newIsNotRestriction
in class Relation
InvalidRequestException
protected Term toTerm(java.util.List<? extends ColumnSpecification> receivers, Term.Raw raw, java.lang.String keyspace, VariableSpecifications boundNames) throws InvalidRequestException
Relation
Raw
into a Term
.toTerm
in class Relation
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 variablesTerm
corresponding to the specified Raw
InvalidRequestException
- if the Raw
term is not validprotected java.util.List<ColumnDefinition> receivers(CFMetaData cfm) throws InvalidRequestException
InvalidRequestException
public Relation renameIdentifier(ColumnIdentifier.Raw from, ColumnIdentifier.Raw to)
Relation
renameIdentifier
in class Relation
from
- the old identifierto
- the new identifierpublic java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2017 The Apache Software Foundation