Gaia
|
The QueryOptimizer class tries to optimize a query by reducing the SearchSpace on which it is supposed to operate, mostly by the means of the associated filter. More...
#include <queryoptimizer.h>
Public Types | |
typedef BaseSearchSpacePool< SearchPointType, DataSetType > | SearchSpacePoolType |
typedef BaseSearchSpace< SearchPointType, DataSetType > | SearchSpaceType |
Public Member Functions | |
BaseQueryOptimizer (SearchSpacePoolType *spool) | |
SearchSpaceType * | optimize (Filter *filter) |
Ownership of the SearchSpace is yielded to the caller of the function. More... | |
Protected Member Functions | |
SearchSpaceType * | optimize (parser::Predicate *pred) |
Static Protected Member Functions | |
static parser::PredLabelIsIn * | findPointID (parser::Predicate *pred) |
template<typename PredicateType > | |
static PredicateType * | findPredicate (parser::Predicate *pred) |
static bool | swapPredicate (Filter *filter, parser::Predicate *swapOut, parser::Predicate *swapIn) |
Swaps predicate swapOut inside of filter for predicate swapIn. More... | |
static bool | swapPredicate (parser::Predicate *parent, parser::Predicate *swapOut, parser::Predicate *swapIn) |
Swaps predicate swapOut (starting with given parent predicate) for predicate swapIn. More... | |
static void | deletePredicate (Filter *filter, parser::Predicate *pred) |
Deletes given predicate inside filter (replaces it with the always true predicate). | |
static void | reduceFilter (Filter *filter) |
Tries to apply simplification on the filter, such as replacing "X and True" by "X", etc... More... | |
static parser::Predicate * | reducePredicate (parser::Predicate *pred) |
Tries to apply simplification on the predicate, such as replacing "X and True" by "X", etc... More... | |
Protected Attributes | |
SearchSpacePoolType * | _spool |
The QueryOptimizer class tries to optimize a query by reducing the SearchSpace on which it is supposed to operate, mostly by the means of the associated filter.
It should tap into a SearchSpace pool and return the final SearchSpace, as well as the possibly modified Filter (contained inside the SearchSpace), on which to perform the query.
BaseSearchSpace< SearchPointType, DataSetType > * gaia2::BaseQueryOptimizer< SearchPointType, DataSetType >::optimize | ( | Filter * | filter | ) |
Ownership of the SearchSpace is yielded to the caller of the function.
Ownership of the filter is given to this function (either it will be destroyed and replaced by an optimized filter inside the SearchSpace, or it will put directly into the SearchSpace. In any case, you shouldn't try to delete it after having called this function).
References gaia2::isAlwaysFalse(), gaia2::isAlwaysTrue(), gaia2::Filter::parse(), gaia2::BaseSearchSpace< SearchPointType, DataSetType >::setIntersection(), and gaia2::BaseSearchSpace< SearchPointType, DataSetType >::setUnion().
Referenced by gaia2::BaseView< DataSetType, PointType, SearchPointType, DistanceType >::getSearchSpace().
|
staticprotected |
Tries to apply simplification on the filter, such as replacing "X and True" by "X", etc...
without changing the return value of it. The filter is modified in-place.
|
staticprotected |
Tries to apply simplification on the predicate, such as replacing "X and True" by "X", etc...
without changing the return value of it.
|
staticprotected |
Swaps predicate swapOut inside of filter for predicate swapIn.
|
staticprotected |
Swaps predicate swapOut (starting with given parent predicate) for predicate swapIn.