Interface Index.QueryPlan

    • Method Detail

      • getIndexes

        java.util.Set<Index> getIndexes()
        Returns the indexes selected by this query plan, all of them belonging to the same Index.Group. It should never be empty.
        Returns:
        the indexes selected by this query plan, which is never empty
      • getFirst

        @Nonnull
        default Index getFirst()
        Returns the first index in this plan.
        Returns:
        the first index
      • getEstimatedResultRows

        default long getEstimatedResultRows()
        Return an estimate of the number of results this plan is expected to return for any given ReadCommand that it can be used to answer. Used by SecondaryIndexManager.getBestIndexQueryPlanFor(RowFilter) to determine the Index.Group with the most selective plan for a given RowFilter. Additionally, this is also used by StorageProxy.estimateResultsPerRange to calculate the initial concurrency factor for range requests
        Returns:
        the estimated average number of results a Searcher may return for any given command
      • shouldEstimateInitialConcurrency

        default boolean shouldEstimateInitialConcurrency()
        Used to determine whether to estimate initial concurrency during remote range reads. Default is true, each implementation must override this method if they choose a different strategy.
        Returns:
        true if the Index.QueryPlan should estimate initial concurrency, false otherwise
      • validate

        default void validate​(ReadCommand command)
                       throws InvalidRequestException
        Used to validate the various parameters of a supplied ReadCommand against the indexes in this plan.
        Parameters:
        command - a ReadCommand whose parameters are to be verified
        Throws:
        InvalidRequestException - if the details of the command fail to meet the validation rules of the indexes in the query plan
      • searcherFor

        Index.Searcher searcherFor​(ReadCommand command)
        Factory method for query time search helper.
        Parameters:
        command - the read command being executed
        Returns:
        an Searcher with which to perform the supplied command
      • postProcessor

        default java.util.function.Function<PartitionIterator,​PartitionIterator> postProcessor​(ReadCommand command)
        Return a function which performs post processing on the results of a partition range read command. In future, this may be used as a generalized mechanism for transforming results on the coordinator prior to returning them to the caller. This is used on the coordinator during execution of a range command to perform post processing of merged results obtained from the necessary replicas. This is the only way in which results are transformed in this way but this may change over time as usage is generalized. See CASSANDRA-8717 for further discussion. The function takes a PartitionIterator of the results from the replicas which has already been collated and reconciled, along with the command being executed. It returns another PartitionIterator containing the results of the transformation (which may be the same as the input if the transformation is a no-op).
        Parameters:
        command - the read command being executed
      • postIndexQueryFilter

        RowFilter postIndexQueryFilter()
        Transform an initial RowFilter into the filter that will still need to applied to a set of Rows after the index has performed it's initial scan. Used in ReadCommand.executeLocally(ReadExecutionController) to reduce the amount of filtering performed on the results of the index query.
        Returns:
        the (hopefully) reduced filter that would still need to be applied after the index was used to narrow the initial result set
      • supportsReplicaFilteringProtection

        default boolean supportsReplicaFilteringProtection​(RowFilter rowFilter)
        Tells whether this index supports replica fitering protection or not. Replica filtering protection might need to run the query row filter in the coordinator to detect stale results. An index implementation will be compatible with this protection mechanism if it returns the same results for the row filter as CQL will return with ALLOW FILTERING and without using the index. This means that index implementations using custom query syntax or applying transformations to the indexed data won't support it. See CASSANDRA-8272 for further details.
        Parameters:
        rowFilter - rowFilter of query to decide if it supports replica filtering protection or not
        Returns:
        true if this index supports replica filtering protection, false otherwise
      • isTopK

        default boolean isTopK()
        Returns:
        true if given index query plan is a top-k request