StatementRestrictions (apache-cassandra API)
Date: 2018-02-14

org.apache.cassandra.cql3.restrictions

## Class StatementRestrictions

- java.lang.Object
- - org.apache.cassandra.cql3.restrictions.StatementRestrictions

-     public final class StatementRestrictions
      extends java.lang.Object

  The restrictions corresponding to the relations specified on the where-clause of CQL query.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `CFMetaData` | `cfm` The Column Family meta data
    `static java.lang.String` | `REQUIRES_ALLOW_FILTERING_MESSAGE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `StatementRestrictions(StatementType type, CFMetaData cfm, WhereClause whereClause, VariableSpecifications boundNames, boolean selectsOnlyStaticColumns, boolean selectsComplexColumn, boolean allowFiltering, boolean forView)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addFunctionsTo(java.util.List<Function> functions)`
    `boolean` | `clusteringKeyRestrictionsHasIN()` Checks if restrictions on the clustering key have IN restrictions.
    `static StatementRestrictions` | `empty(StatementType type, CFMetaData cfm)` Creates a new empty `StatementRestrictions`.
    `java.util.NavigableSet<Clustering>` | `getClusteringColumns(QueryOptions options)` Returns the requested clustering columns.
    `java.util.NavigableSet<ClusteringBound>` | `getClusteringColumnsBounds(Bound b, QueryOptions options)` Returns the bounds (start or end) of the clustering columns.
    `IndexRestrictions` | `getIndexRestrictions()`
    `AbstractBounds<PartitionPosition>` | `getPartitionKeyBounds(QueryOptions options)` Returns the partition key bounds.
    `java.util.List<java.nio.ByteBuffer>` | `getPartitionKeys(QueryOptions options)` Returns the partition keys for which the data is requested.
    `RowFilter` | `getRowFilter(SecondaryIndexManager indexManager, QueryOptions options)`
    `SuperColumnCompatibility.SuperColumnRestrictions` | `getSuperColumnRestrictions()`
    `boolean` | `hasAllPKColumnsRestrictedByEqualities()` Checks that all the primary key columns (partition key and clustering columns) are restricted by an equality relation ('=' or 'IN').
    `boolean` | `hasClusteringColumnsRestrictions()` Checks if the query has some restrictions on the clustering columns.
    `boolean` | `hasNonPrimaryKeyRestrictions()` Checks if the restrictions contain any non-primary key restrictions
    `boolean` | `hasPartitionKeyRestrictions()`
    `boolean` | `hasRegularColumnsRestrictions()` Checks if one of the restrictions applies to a regular column.
    `boolean` | `isColumnRange()` Checks if the query returns a range of columns.
    `boolean` | `isColumnRestrictedByEq(ColumnDefinition columnDef)` Checks if the specified column is restricted by an EQ restriction.
    `boolean` | `isKeyRange()` Checks if the query request a range of partition keys.
    `boolean` | `isPartitionKeyRestrictionsOnToken()` Checks if the restrictions on the partition key are token restrictions.
    `boolean` | `isRestricted(ColumnDefinition column)`
    `boolean` | `keyIsInRelation()` Checks if the restrictions on the partition key has IN restrictions.
    `boolean` | `needFiltering()` Checks if the query need to use filtering.
    `java.util.Set<ColumnDefinition>` | `nonPKRestrictedColumns(boolean includeNotNullRestrictions)` Returns the non-PK column that are restricted.
    `java.util.Set<ColumnDefinition>` | `notNullColumns()`
    `boolean` | `usesSecondaryIndexing()` Checks if the secondary index need to be queried.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### REQUIRES_ALLOW_FILTERING_MESSAGE

          public static final java.lang.String REQUIRES_ALLOW_FILTERING_MESSAGE

      See Also:
        Constant Field Values

    - #### cfm

          public final CFMetaData cfm

      The Column Family meta data

  - ### Constructor Detail

    - #### StatementRestrictions

          public StatementRestrictions(StatementType type,
                                       CFMetaData cfm,
                                       WhereClause whereClause,
                                       VariableSpecifications boundNames,
                                       boolean selectsOnlyStaticColumns,
                                       boolean selectsComplexColumn,
                                       boolean allowFiltering,
                                       boolean forView)

  - ### Method Detail

    - #### empty

          public static StatementRestrictions empty(StatementType type,
                                                    CFMetaData cfm)

      Creates a new empty `StatementRestrictions`.
      Parameters:
        `type` - the type of statement
        `cfm` - the column family meta data
      Returns:
        a new empty `StatementRestrictions`.

    - #### addFunctionsTo

          public void addFunctionsTo(java.util.List<Function> functions)

    - #### getIndexRestrictions

          public IndexRestrictions getIndexRestrictions()

    - #### nonPKRestrictedColumns

          public java.util.Set<ColumnDefinition> nonPKRestrictedColumns(boolean includeNotNullRestrictions)

      Returns the non-PK column that are restricted. If includeNotNullRestrictions is true, columns that are restricted by an IS NOT NULL restriction will be included, otherwise they will not be included (unless another restriction applies to them).

    - #### notNullColumns

          public java.util.Set<ColumnDefinition> notNullColumns()

      Returns:
        the set of columns that have an IS NOT NULL restriction on them

    - #### isRestricted

          public boolean isRestricted(ColumnDefinition column)

      Returns:
        true if column is restricted by some restriction, false otherwise

    - #### keyIsInRelation

          public boolean keyIsInRelation()

      Checks if the restrictions on the partition key has IN restrictions.
      Returns:
        `true` the restrictions on the partition key has an IN restriction, `false` otherwise.

    - #### isKeyRange

          public boolean isKeyRange()

      Checks if the query request a range of partition keys.
      Returns:
        `true` if the query request a range of partition keys, `false` otherwise.

    - #### isColumnRestrictedByEq

          public boolean isColumnRestrictedByEq(ColumnDefinition columnDef)

      Checks if the specified column is restricted by an EQ restriction.
      Parameters:
        `columnDef` - the column definition
      Returns:
        `true` if the specified column is restricted by an EQ restiction, `false` otherwise.

    - #### usesSecondaryIndexing

          public boolean usesSecondaryIndexing()

      Checks if the secondary index need to be queried.
      Returns:
        `true` if the secondary index need to be queried, `false` otherwise.

    - #### hasPartitionKeyRestrictions

          public boolean hasPartitionKeyRestrictions()

    - #### hasNonPrimaryKeyRestrictions

          public boolean hasNonPrimaryKeyRestrictions()

      Checks if the restrictions contain any non-primary key restrictions
      Returns:
        `true` if the restrictions contain any non-primary key restrictions, `false` otherwise.

    - #### isPartitionKeyRestrictionsOnToken

          public boolean isPartitionKeyRestrictionsOnToken()

      Checks if the restrictions on the partition key are token restrictions.
      Returns:
        `true` if the restrictions on the partition key are token restrictions, `false` otherwise.

    - #### clusteringKeyRestrictionsHasIN

          public boolean clusteringKeyRestrictionsHasIN()

      Checks if restrictions on the clustering key have IN restrictions.
      Returns:
        `true` if the restrictions on the clustering key have IN restrictions, `false` otherwise.

    - #### getRowFilter

          public RowFilter getRowFilter(SecondaryIndexManager indexManager,
                                        QueryOptions options)

    - #### getPartitionKeys

          public java.util.List<java.nio.ByteBuffer> getPartitionKeys(QueryOptions options)

      Returns the partition keys for which the data is requested.
      Parameters:
        `options` - the query options
      Returns:
        the partition keys for which the data is requested.

    - #### getPartitionKeyBounds

          public AbstractBounds<PartitionPosition> getPartitionKeyBounds(QueryOptions options)

      Returns the partition key bounds.
      Parameters:
        `options` - the query options
      Returns:
        the partition key bounds

    - #### hasClusteringColumnsRestrictions

          public boolean hasClusteringColumnsRestrictions()

      Checks if the query has some restrictions on the clustering columns.
      Returns:
        `true` if the query has some restrictions on the clustering columns, `false` otherwise.

    - #### getClusteringColumns

          public java.util.NavigableSet<Clustering> getClusteringColumns(QueryOptions options)

      Returns the requested clustering columns.
      Parameters:
        `options` - the query options
      Returns:
        the requested clustering columns

    - #### getClusteringColumnsBounds

          public java.util.NavigableSet<ClusteringBound> getClusteringColumnsBounds(Bound b,
                                                                                    QueryOptions options)

      Returns the bounds (start or end) of the clustering columns.
      Parameters:
        `b` - the bound type
        `options` - the query options
      Returns:
        the bounds (start or end) of the clustering columns

    - #### isColumnRange

          public boolean isColumnRange()

      Checks if the query returns a range of columns.
      Returns:
        `true` if the query returns a range of columns, `false` otherwise.

    - #### needFiltering

          public boolean needFiltering()

      Checks if the query need to use filtering.
      Returns:
        `true` if the query need to use filtering, `false` otherwise.

    - #### hasAllPKColumnsRestrictedByEqualities

          public boolean hasAllPKColumnsRestrictedByEqualities()

      Checks that all the primary key columns (partition key and clustering columns) are restricted by an equality relation ('=' or 'IN').
      Returns:
        `true` if all the primary key columns are restricted by an equality relation.

    - #### hasRegularColumnsRestrictions

          public boolean hasRegularColumnsRestrictions()

      Checks if one of the restrictions applies to a regular column.
      Returns:
        `true` if one of the restrictions applies to a regular column, `false` otherwise.

    - #### getSuperColumnRestrictions

          public SuperColumnCompatibility.SuperColumnRestrictions getSuperColumnRestrictions()

Copyright © 2018 The Apache Software Foundation