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(CFMetaData cfm, java.util.List<Relation> whereClause, VariableSpecifications boundNames, boolean selectsOnlyStaticColumns, boolean selectACollection, boolean allowFiltering)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `areRequestedBoundsInclusive(Bound bound)` Checks if the bounds (start or end) of the clustering columns are inclusive.
    `boolean` | `clusteringRestrictionsNeedFiltering()`
    `static StatementRestrictions` | `empty(CFMetaData cfm)` Creates a new empty `StatementRestrictions`.
    `java.util.List<Composite>` | `getClusteringColumnsAsComposites(QueryOptions options)` Returns the requested clustering columns as `Composite`s.
    `java.util.List<java.nio.ByteBuffer>` | `getClusteringColumnsBounds(Bound b, QueryOptions options)` Returns the bounds (start or end) of the clustering columns.
    `java.util.List<Composite>` | `getClusteringColumnsBoundsAsComposites(Bound b, QueryOptions options)` Returns the bounds (start or end) of the clustering columns as `Composites`.
    `java.lang.Iterable<Function>` | `getFunctions()`
    `java.util.List<IndexExpression>` | `getIndexExpressions(SecondaryIndexManager indexManager, QueryOptions options)`
    `AbstractBounds<RowPosition>` | `getPartitionKeyBounds(QueryOptions options)` Returns the partition key bounds.
    `java.util.Collection<java.nio.ByteBuffer>` | `getPartitionKeys(QueryOptions options)` Returns the partition keys for which the data is requested.
    `boolean` | `hasClusteringColumnsRestriction()` Checks if the query has some restrictions on the clustering columns.
    `boolean` | `hasNoClusteringColumnsRestriction()` Checks if the query does not contains any restriction on the clustering columns.
    `boolean` | `hasNonPrimaryKeyRestrictions()` Checks if the restrictions contain any non-primary key restrictions
    `boolean` | `hasPartitionKeyRestrictions()`
    `boolean` | `hasRegularColumnsRestriction()`
    `boolean` | `isColumnRange()` Checks if the query returns a range of columns.
    `boolean` | `isKeyRange()` Checks if the query request a range of partition keys.
    `boolean` | `isNonCompositeSliceWithExclusiveBounds()`
    `boolean` | `isNotReturningAnyRows(QueryOptions options)` Checks if the query will never return any rows.
    `boolean` | `keyIsInRelation()` Checks if the restrictions on the partition key is an IN restriction.
    `boolean` | `needFiltering()` Checks if the query need to use filtering.
    `void` | `reverse()`
    `boolean` | `usesSecondaryIndexing()` Checks if the secondary index need to be queried.
    `void` | `validateClusteringRestrictions(boolean hasQueriableIndex)` Validates whether or not restrictions are allowed for execution when secondary index is not used.

    - ### 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(CFMetaData cfm,
                                       java.util.List<Relation> whereClause,
                                       VariableSpecifications boundNames,
                                       boolean selectsOnlyStaticColumns,
                                       boolean selectACollection,
                                       boolean allowFiltering)

  - ### Method Detail

    - #### empty

          public static StatementRestrictions empty(CFMetaData cfm)

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

    - #### getFunctions

          public java.lang.Iterable<Function> getFunctions()

    - #### keyIsInRelation

          public boolean keyIsInRelation()

      Checks if the restrictions on the partition key is an IN restriction.
      Returns:
        `true` the restrictions on the partition key is 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.

    - #### hasRegularColumnsRestriction

          public boolean hasRegularColumnsRestriction()

    - #### 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.

    - #### validateClusteringRestrictions

          public final void validateClusteringRestrictions(boolean hasQueriableIndex)

      Validates whether or not restrictions are allowed for execution when secondary index is not used.

    - #### clusteringRestrictionsNeedFiltering

          public final boolean clusteringRestrictionsNeedFiltering()

    - #### getIndexExpressions

          public java.util.List<IndexExpression> getIndexExpressions(SecondaryIndexManager indexManager,
                                                                     QueryOptions options)
                                                              throws InvalidRequestException

      Throws:
        `InvalidRequestException`

    - #### getPartitionKeys

          public java.util.Collection<java.nio.ByteBuffer> getPartitionKeys(QueryOptions options)
                                                                     throws InvalidRequestException

      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.
      Throws:
        `InvalidRequestException` - if the partition keys cannot be retrieved

    - #### getPartitionKeyBounds

          public AbstractBounds<RowPosition> getPartitionKeyBounds(QueryOptions options)
                                                            throws InvalidRequestException

      Returns the partition key bounds.
      Parameters:
        `options` - the query options
      Returns:
        the partition key bounds
      Throws:
        `InvalidRequestException` - if the query is invalid

    - #### hasNoClusteringColumnsRestriction

          public boolean hasNoClusteringColumnsRestriction()

      Checks if the query does not contains any restriction on the clustering columns.
      Returns:
        `true` if the query does not contains any restriction on the clustering columns, `false` otherwise.

    - #### hasClusteringColumnsRestriction

          public boolean hasClusteringColumnsRestriction()

      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.

    - #### isNonCompositeSliceWithExclusiveBounds

          public boolean isNonCompositeSliceWithExclusiveBounds()

    - #### getClusteringColumnsAsComposites

          public java.util.List<Composite> getClusteringColumnsAsComposites(QueryOptions options)
                                                                     throws InvalidRequestException

      Returns the requested clustering columns as `Composite`s.
      Parameters:
        `options` - the query options
      Returns:
        the requested clustering columns as `Composite`s
      Throws:
        `InvalidRequestException` - if the query is not valid

    - #### getClusteringColumnsBoundsAsComposites

          public java.util.List<Composite> getClusteringColumnsBoundsAsComposites(Bound b,
                                                                                  QueryOptions options)
                                                                           throws InvalidRequestException

      Returns the bounds (start or end) of the clustering columns as `Composites`.
      Parameters:
        `b` - the bound type
        `options` - the query options
      Returns:
        the bounds (start or end) of the clustering columns as `Composites`
      Throws:
        `InvalidRequestException` - if the request is not valid

    - #### getClusteringColumnsBounds

          public java.util.List<java.nio.ByteBuffer> getClusteringColumnsBounds(Bound b,
                                                                                QueryOptions options)
                                                                         throws InvalidRequestException

      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
      Throws:
        `InvalidRequestException` - if the request is not valid

    - #### areRequestedBoundsInclusive

          public boolean areRequestedBoundsInclusive(Bound bound)

      Checks if the bounds (start or end) of the clustering columns are inclusive.
      Parameters:
        `bound` - the bound type
      Returns:
        `true` if the bounds (start or end) of the clustering columns are inclusive, `false` otherwise

    - #### 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.

    - #### reverse

          public void reverse()

    - #### isNotReturningAnyRows

          public boolean isNotReturningAnyRows(QueryOptions options)

      Checks if the query will never return any rows.
      Parameters:
        `options` - the query options
      Returns:
        `true` if the query will never return any rows, otherwise

Copyright © 2018 The Apache Software Foundation