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)
  • Constructor Details

  • Method Details

    • onToken

      public boolean onToken()
      Description copied from class: Relation
      Checks if this relation is a token relation (e.g.
      token(a) = token(1)
      ).
      Overrides:
      onToken in class Relation
      Returns:
      true if this relation is a token relation, false otherwise.
    • 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.
      Specified by:
      getValue in class Relation
    • getInValues

      public 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 class Relation
    • newEQRestriction

      protected Restriction newEQRestriction(TableMetadata table, VariableSpecifications boundNames)
      Description copied from class: Relation
      Creates a new EQ restriction instance.
      Specified by:
      newEQRestriction in class Relation
      Parameters:
      table - the table meta data
      boundNames - 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 class Relation
      Parameters:
      table - the table meta data
      boundNames - 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 class Relation
      Parameters:
      table - the table meta data
      boundNames - the variables specification where to collect the bind variables
      bound - the slice bound
      inclusive - true if the bound is included.
      Returns:
      a new slice restriction instance
    • newContainsRestriction

      protected Restriction newContainsRestriction(TableMetadata table, VariableSpecifications boundNames, boolean isKey)
      Description copied from class: Relation
      Creates a new Contains restriction instance.
      Specified by:
      newContainsRestriction in class Relation
      Parameters:
      table - the table meta data
      boundNames - the variables specification where to collect the bind variables
      isKey - true if the restriction to create is a CONTAINS KEY
      Returns:
      a new Contains Restriction instance
    • newIsNotRestriction

      protected Restriction newIsNotRestriction(TableMetadata table, VariableSpecifications boundNames)
      Specified by:
      newIsNotRestriction in class Relation
    • newLikeRestriction

      protected Restriction newLikeRestriction(TableMetadata table, VariableSpecifications boundNames, Operator operator)
      Specified by:
      newLikeRestriction in class Relation
    • toTerm

      protected Term toTerm(List<? extends ColumnSpecification> receivers, Term.Raw raw, String keyspace, VariableSpecifications boundNames) throws InvalidRequestException
      Description copied from class: Relation
      Converts the specified Raw into a Term.
      Specified by:
      toTerm in class Relation
      Parameters:
      receivers - the columns to which the values must be associated at
      raw - the raw term to convert
      keyspace - the keyspace name
      boundNames - the variables specification where to collect the bind variables
      Returns:
      the Term corresponding to the specified Raw
      Throws:
      InvalidRequestException - if the Raw term is not valid
    • 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 class Relation
      Parameters:
      from - the old identifier
      to - 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 String toCQLString()
      Description copied from class: Relation
      Returns a CQL representation of this relation.
      Specified by:
      toCQLString in class Relation
      Returns:
      a CQL representation of this relation
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object