Class MultiColumnRestriction

java.lang.Object
org.apache.cassandra.cql3.restrictions.MultiColumnRestriction
All Implemented Interfaces:
Restriction, SingleRestriction
Direct Known Subclasses:
MultiColumnRestriction.EQRestriction, MultiColumnRestriction.INRestriction, MultiColumnRestriction.NotNullRestriction, MultiColumnRestriction.SliceRestriction

public abstract class MultiColumnRestriction extends Object implements SingleRestriction
  • Field Details

    • columnDefs

      protected final List<ColumnMetadata> columnDefs
      The columns to which the restriction apply.
  • Constructor Details

  • Method Details

    • isMultiColumn

      public boolean isMultiColumn()
      Specified by:
      isMultiColumn in interface SingleRestriction
    • getFirstColumn

      public ColumnMetadata getFirstColumn()
      Description copied from interface: Restriction
      Returns the definition of the first column.
      Specified by:
      getFirstColumn in interface Restriction
      Returns:
      the definition of the first column.
    • getLastColumn

      public ColumnMetadata getLastColumn()
      Description copied from interface: Restriction
      Returns the definition of the last column.
      Specified by:
      getLastColumn in interface Restriction
      Returns:
      the definition of the last column.
    • getColumnDefs

      public List<ColumnMetadata> getColumnDefs()
      Description copied from interface: Restriction
      Returns the column definitions in position order.
      Specified by:
      getColumnDefs in interface Restriction
      Returns:
      the column definitions in position order.
    • mergeWith

      public final SingleRestriction mergeWith(SingleRestriction otherRestriction)
      Description copied from interface: SingleRestriction
      Merges this restriction with the specified one.

      Restriction are immutable. Therefore merging two restrictions result in a new one. The reason behind this choice is that it allow a great flexibility in the way the merging can done while preventing any side effect.

      Specified by:
      mergeWith in interface SingleRestriction
      Parameters:
      otherRestriction - the restriction to merge into this one
      Returns:
      the restriction resulting of the merge
    • doMergeWith

      protected abstract SingleRestriction doMergeWith(SingleRestriction otherRestriction)
    • getColumnsInCommons

      protected final String getColumnsInCommons(Restriction otherRestriction)
      Returns the names of the columns that are specified within this Restrictions and the other one as a comma separated String.
      Parameters:
      otherRestriction - the other restrictions
      Returns:
      the names of the columns that are specified within this Restrictions and the other one as a comma separated String.
    • hasSupportingIndex

      public final boolean hasSupportingIndex(IndexRegistry indexRegistry)
      Description copied from interface: Restriction
      Check if the restriction is on indexed columns.
      Specified by:
      hasSupportingIndex in interface Restriction
      Parameters:
      indexRegistry - the index registry
      Returns:
      true if the restriction is on indexed columns, false
    • findSupportingIndex

      public final Index findSupportingIndex(IndexRegistry indexRegistry)
      Description copied from interface: Restriction
      Find first supporting index for current restriction
      Specified by:
      findSupportingIndex in interface Restriction
      Parameters:
      indexRegistry - the index registry
      Returns:
      index if the restriction is on indexed columns, null
    • findSupportingIndexFromQueryPlan

      public Index findSupportingIndexFromQueryPlan(Index.QueryPlan indexQueryPlan)
      Description copied from interface: Restriction
      Find the first supporting index for the current restriction from an Index.QueryPlan.
      Specified by:
      findSupportingIndexFromQueryPlan in interface Restriction
      Parameters:
      indexQueryPlan - the index query plan
      Returns:
      index if the restriction is on indexed columns, null
    • needsFiltering

      public boolean needsFiltering(Index.Group indexGroup)
      Description copied from interface: Restriction
      Returns whether this restriction would need filtering if the specified index group were used.
      Specified by:
      needsFiltering in interface Restriction
      Parameters:
      indexGroup - an index group
      Returns:
      true if this would need filtering if indexGroup were used, false otherwise
    • isSupportedBy

      protected abstract boolean isSupportedBy(Index index, ColumnMetadata def)
    • toString

      public String toString()
      Overrides:
      toString in class Object