Class StatementRestrictions
- java.lang.Object
-
- org.apache.cassandra.cql3.restrictions.StatementRestrictions
-
public final class StatementRestrictions extends java.lang.ObjectThe restrictions corresponding to the relations specified on the where-clause of CQL query.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringREQUIRES_ALLOW_FILTERING_MESSAGETableMetadatatableThe Column Family meta data
-
Constructor Summary
Constructors Constructor Description StatementRestrictions(StatementType type, TableMetadata table, WhereClause whereClause, VariableSpecifications boundNames, boolean selectsOnlyStaticColumns, boolean allowFiltering, boolean forView)StatementRestrictions(StatementType type, TableMetadata table, WhereClause whereClause, VariableSpecifications boundNames, boolean selectsOnlyStaticColumns, boolean allowUseOfSecondaryIndices, boolean allowFiltering, boolean forView)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddFunctionsTo(java.util.List<Function> functions)booleanclusteringKeyRestrictionsHasIN()Checks if restrictions on the clustering key have IN restrictions.static StatementRestrictionsempty(StatementType type, TableMetadata table)Creates a new emptyStatementRestrictions.java.util.NavigableSet<Clustering<?>>getClusteringColumns(QueryOptions options, ClientState state)Returns the requested clustering columns.java.util.NavigableSet<ClusteringBound<?>>getClusteringColumnsBounds(Bound b, QueryOptions options)Returns the bounds (start or end) of the clustering columns.IndexRestrictionsgetIndexRestrictions()AbstractBounds<PartitionPosition>getPartitionKeyBounds(QueryOptions options)Returns the partition key bounds.java.util.List<java.nio.ByteBuffer>getPartitionKeys(QueryOptions options, ClientState state)Returns the partition keys for which the data is requested.RowFiltergetRowFilter(IndexRegistry indexRegistry, QueryOptions options)booleanhasAllPKColumnsRestrictedByEqualities()Checks that all the primary key columns (partition key and clustering columns) are restricted by an equality relation ('=' or 'IN').booleanhasClusteringColumnsRestrictions()Checks if the query has some restrictions on the clustering columns.booleanhasNonPrimaryKeyRestrictions()Checks if the restrictions contain any non-primary key restrictionsbooleanhasPartitionKeyRestrictions()booleanhasRegularColumnsRestrictions()Checks if one of the restrictions applies to a regular column.booleanisColumnRange()Checks if the query returns a range of columns.booleanisColumnRestrictedByEq(ColumnMetadata columnDef)Checks if the specified column is restricted by an EQ restriction.booleanisKeyRange()Checks if the query request a range of partition keys.booleanisPartitionKeyRestrictionsOnToken()Checks if the restrictions on the partition key are token restrictions.booleanisRestricted(ColumnMetadata column)booleankeyIsInRelation()Checks if the restrictions on the partition key has IN restrictions.booleanneedFiltering()Checks if the query need to use filtering.java.util.Set<ColumnMetadata>nonPKRestrictedColumns(boolean includeNotNullRestrictions)Returns the non-PK column that are restricted.java.util.Set<ColumnMetadata>notNullColumns()booleanreturnStaticContentOnPartitionWithNoRows()Determines if the query should return the static content when a partition without rows is returned (as a result set row with null for all other regular columns.)java.lang.StringtoString()booleanusesSecondaryIndexing()Checks if the secondary index need to be queried.
-
-
-
Field Detail
-
REQUIRES_ALLOW_FILTERING_MESSAGE
public static final java.lang.String REQUIRES_ALLOW_FILTERING_MESSAGE
- See Also:
- Constant Field Values
-
table
public final TableMetadata table
The Column Family meta data
-
-
Constructor Detail
-
StatementRestrictions
public StatementRestrictions(StatementType type, TableMetadata table, WhereClause whereClause, VariableSpecifications boundNames, boolean selectsOnlyStaticColumns, boolean allowFiltering, boolean forView)
-
StatementRestrictions
public StatementRestrictions(StatementType type, TableMetadata table, WhereClause whereClause, VariableSpecifications boundNames, boolean selectsOnlyStaticColumns, boolean allowUseOfSecondaryIndices, boolean allowFiltering, boolean forView)
-
-
Method Detail
-
empty
public static StatementRestrictions empty(StatementType type, TableMetadata table)
Creates a new emptyStatementRestrictions.- Parameters:
type- the type of statementtable- 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<ColumnMetadata> 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<ColumnMetadata> notNullColumns()
- Returns:
- the set of columns that have an IS NOT NULL restriction on them
-
isRestricted
public boolean isRestricted(ColumnMetadata 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:
truethe restrictions on the partition key has an IN restriction,falseotherwise.
-
isKeyRange
public boolean isKeyRange()
Checks if the query request a range of partition keys.- Returns:
trueif the query request a range of partition keys,falseotherwise.
-
isColumnRestrictedByEq
public boolean isColumnRestrictedByEq(ColumnMetadata columnDef)
Checks if the specified column is restricted by an EQ restriction.- Parameters:
columnDef- the column definition- Returns:
trueif the specified column is restricted by an EQ restiction,falseotherwise.
-
usesSecondaryIndexing
public boolean usesSecondaryIndexing()
Checks if the secondary index need to be queried.- Returns:
trueif the secondary index need to be queried,falseotherwise.
-
hasPartitionKeyRestrictions
public boolean hasPartitionKeyRestrictions()
-
hasNonPrimaryKeyRestrictions
public boolean hasNonPrimaryKeyRestrictions()
Checks if the restrictions contain any non-primary key restrictions- Returns:
trueif the restrictions contain any non-primary key restrictions,falseotherwise.
-
isPartitionKeyRestrictionsOnToken
public boolean isPartitionKeyRestrictionsOnToken()
Checks if the restrictions on the partition key are token restrictions.- Returns:
trueif the restrictions on the partition key are token restrictions,falseotherwise.
-
clusteringKeyRestrictionsHasIN
public boolean clusteringKeyRestrictionsHasIN()
Checks if restrictions on the clustering key have IN restrictions.- Returns:
trueif the restrictions on the clustering key have IN restrictions,falseotherwise.
-
getRowFilter
public RowFilter getRowFilter(IndexRegistry indexRegistry, QueryOptions options)
-
getPartitionKeys
public java.util.List<java.nio.ByteBuffer> getPartitionKeys(QueryOptions options, ClientState state)
Returns the partition keys for which the data is requested.- Parameters:
options- the query optionsstate- the client state- 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:
trueif the query has some restrictions on the clustering columns,falseotherwise.
-
getClusteringColumns
public java.util.NavigableSet<Clustering<?>> getClusteringColumns(QueryOptions options, ClientState state)
Returns the requested clustering columns.- Parameters:
options- the query optionsstate- the client state- 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 typeoptions- 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:
trueif the query returns a range of columns,falseotherwise.
-
needFiltering
public boolean needFiltering()
Checks if the query need to use filtering.- Returns:
trueif the query need to use filtering,falseotherwise.
-
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:
trueif 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:
trueif one of the restrictions applies to a regular column,falseotherwise.
-
returnStaticContentOnPartitionWithNoRows
public boolean returnStaticContentOnPartitionWithNoRows()
Determines if the query should return the static content when a partition without rows is returned (as a result set row with null for all other regular columns.)- Returns:
trueif the query should return the static content when a partition without rows is returned,falseotherwise.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-