Class QueryController
- java.lang.Object
-
- org.apache.cassandra.index.sai.plan.QueryController
-
public class QueryController extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description QueryController(ColumnFamilyStore cfs, ReadCommand command, RowFilter indexFilter, QueryContext queryContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<DataRange>
dataRanges()
boolean
doesNotSelect(PrimaryKey key)
Returns whether this query is not selecting thePrimaryKey
.PrimaryKey
firstPrimaryKeyInRange()
KeyRangeIterator.Builder
getIndexQueryResults(java.util.Collection<Expression> expressions)
Build aKeyRangeIterator.Builder
from the given list ofExpression
s.KeyRangeIterator
getTopKRows(RowFilter.Expression expression)
KeyRangeIterator
getTopKRows(KeyRangeIterator source, RowFilter.Expression expression)
boolean
hasAnalyzer(RowFilter.Expression expression)
RowFilter
indexFilter()
StorageAttachedIndex
indexFor(RowFilter.Expression expression)
PrimaryKey
lastPrimaryKeyInRange()
TableMetadata
metadata()
PrimaryKey.Factory
primaryKeyFactory()
UnfilteredRowIterator
queryStorage(PrimaryKey key, ReadExecutionController executionController)
boolean
usesStrictFiltering()
-
-
-
Constructor Detail
-
QueryController
public QueryController(ColumnFamilyStore cfs, ReadCommand command, RowFilter indexFilter, QueryContext queryContext)
-
-
Method Detail
-
primaryKeyFactory
public PrimaryKey.Factory primaryKeyFactory()
-
firstPrimaryKeyInRange
public PrimaryKey firstPrimaryKeyInRange()
-
lastPrimaryKeyInRange
public PrimaryKey lastPrimaryKeyInRange()
-
metadata
public TableMetadata metadata()
-
indexFilter
public RowFilter indexFilter()
-
usesStrictFiltering
public boolean usesStrictFiltering()
-
dataRanges
public java.util.List<DataRange> dataRanges()
- Returns:
- token ranges used in the read command
-
indexFor
@Nullable public StorageAttachedIndex indexFor(RowFilter.Expression expression)
-
hasAnalyzer
public boolean hasAnalyzer(RowFilter.Expression expression)
-
queryStorage
public UnfilteredRowIterator queryStorage(PrimaryKey key, ReadExecutionController executionController)
-
getIndexQueryResults
public KeyRangeIterator.Builder getIndexQueryResults(java.util.Collection<Expression> expressions)
Build aKeyRangeIterator.Builder
from the given list ofExpression
s.This is achieved by creating an on-disk view of the query that maps the expressions to the
SSTableIndex
s that will satisfy the expression.Each (expression, SSTable indexes) pair is then passed to
IndexSearchResultIterator.build(Expression, Collection, AbstractBounds, QueryContext, boolean, Runnable)
to search the in-memory index associated with the expression and the SSTable indexes, the results of which are unioned and returned.The results from each call to
IndexSearchResultIterator.build(Expression, Collection, AbstractBounds, QueryContext, boolean, Runnable)
are added to aKeyRangeIntersectionIterator
and returned if strict filtering is allowed.If strict filtering is not allowed, indexes are split into two groups according to the repaired status of their backing SSTables. Results from searches over the repaired group are added to a
KeyRangeIntersectionIterator
, which is then added, along with results from searches on the unrepaired set, to a top-levelKeyRangeUnionIterator
, and returned. This is done to ensure that AND queries do not prematurely filter out matches on un-repaired partial updates. Post-filtering must also take this into account. (seeFilterTree.isSatisfiedBy(DecoratedKey, Row, Row)
) Note that Memtable-attached indexes are treated as part of the unrepaired set.
-
doesNotSelect
public boolean doesNotSelect(PrimaryKey key)
Returns whether this query is not selecting thePrimaryKey
. The query does not select the key if both of the following statements are false: 1. The table associated with the query is not using clustering keys 2. The clustering index filter for the command wants the row.Item 2 is important in paged queries where the
ClusteringIndexSliceFilter
for subsequent paged queries may not select rows that are returned by the index search because that is initially partition based.- Parameters:
key
- ThePrimaryKey
to be tested- Returns:
- true if the key is not selected by the query
-
getTopKRows
public KeyRangeIterator getTopKRows(RowFilter.Expression expression)
-
getTopKRows
public KeyRangeIterator getTopKRows(KeyRangeIterator source, RowFilter.Expression expression)
-
-