Package org.apache.cassandra.db.filter
Interface ClusteringIndexFilter
- All Known Implementing Classes:
AbstractClusteringIndexFilter,ClusteringIndexNamesFilter,ClusteringIndexSliceFilter
public interface ClusteringIndexFilter
A filter that selects a subset of the rows of a given partition by using the "clustering index".
In CQL terms, this correspond to the clustering columns selection and correspond to what
the storage engine can do without filtering (and without 2ndary indexes). This does not include
the restrictions on non-PK columns which can be found in RowFilter.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfacestatic enumstatic interface -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionfilterNotIndexed(ColumnFilter columnFilter, UnfilteredRowIterator iterator) Returns an iterator that only returns the rows of the provided iterator that this filter selects.forPaging(ClusteringComparator comparator, Clustering<?> lastReturned, boolean inclusive) Returns a filter for continuing the paging of this filter given the last returned clustering prefix.getSlices(TableMetadata metadata) getUnfilteredRowIterator(ColumnFilter columnFilter, Partition partition) Given a partition, returns a row iterator for the rows of this partition that are selected by this filter.booleanintersects(ClusteringComparator comparator, Slice slice) Whether the data selected by this filter intersects with the provided slice.booleanisEmpty(ClusteringComparator comparator) booleanisFullyCoveredBy(CachedPartition partition) Returns whether we can guarantee that a given cached partition contains all the data selected by this filter.booleanWhether this filter selects the head of a partition (i.e.booleanWhether the filter query rows in reversed clustering order or not.kind()booleanselects(Clustering<?> clustering) Whether a given row is selected by this filter.booleanWhether this filter selects all the row of a partition (it's an "identity" filter).toCQLString(TableMetadata metadata, RowFilter rowFilter) toString(TableMetadata metadata)
-
Field Details
-
serializer
-
-
Method Details
-
isReversed
boolean isReversed()Whether the filter query rows in reversed clustering order or not.- Returns:
- whether the filter query rows in reversed clustering order or not.
-
isEmpty
-
forPaging
ClusteringIndexFilter forPaging(ClusteringComparator comparator, Clustering<?> lastReturned, boolean inclusive) Returns a filter for continuing the paging of this filter given the last returned clustering prefix.- Parameters:
comparator- the comparator for the table this is a filter for.lastReturned- the last clustering that was returned for the query we are paging for. The resulting filter will be such that results coming afterlastReturnedare returned (where coming after means "greater than" if the filter is not reversed, "lesser than" otherwise; futher, whether the comparison is strict or not depends oninclusive).inclusive- whether or not we want to include thelastReturnedin the newly returned page of results.- Returns:
- a new filter that selects results coming after
lastReturned.
-
isFullyCoveredBy
Returns whether we can guarantee that a given cached partition contains all the data selected by this filter.- Parameters:
partition- the cached partition. This method assumed that the rows of this partition contains all the table columns.- Returns:
- whether we can guarantee that all data selected by this filter are in
partition.
-
isHeadFilter
boolean isHeadFilter()Whether this filter selects the head of a partition (i.e. it isn't reversed and selects all rows up to a certain point).- Returns:
- whether this filter selects the head of a partition.
-
selectsAllPartition
boolean selectsAllPartition()Whether this filter selects all the row of a partition (it's an "identity" filter).- Returns:
- whether this filter selects all the row of a partition (it's an "identity" filter).
-
selects
Whether a given row is selected by this filter.- Parameters:
clustering- the clustering of the row to test the selection of.- Returns:
- whether the row with clustering
clusteringis selected by this filter.
-
filterNotIndexed
Returns an iterator that only returns the rows of the provided iterator that this filter selects.This method is the "dumb" counterpart to
getSlices(TableMetadata)in that it has no way to quickly get to what is actually selected, so it simply iterate over it all and filters out what shouldn't be returned. This should be avoided in general. Another difference withgetSlices(TableMetadata)is that this method also filter the queried columns in the returned result, while the former assumes that the provided iterator has already done it.- Parameters:
columnFilter- the columns to include in the rows of the result iterator.iterator- the iterator for which we should filter rows.- Returns:
- an iterator that only returns the rows (or rather Unfilted) from
iteratorthat are selected by this filter.
-
getSlices
-
getUnfilteredRowIterator
Given a partition, returns a row iterator for the rows of this partition that are selected by this filter.- Parameters:
columnFilter- the columns to include in the rows of the result iterator.partition- the partition containing the rows to filter.- Returns:
- a unfiltered row iterator returning those rows (or rather Unfiltered) from
partitionthat are selected by this filter.
-
intersects
Whether the data selected by this filter intersects with the provided slice.- Parameters:
comparator- the comparator of the table this if a filter on.slice- the slice to check intersection with,- Returns:
- whether the data selected by this filter intersects with
slice.
-
kind
ClusteringIndexFilter.Kind kind() -
toString
-
toCQLString
-