20 #ifndef GAIA_QUERYOPTIMIZER_H 21 #define GAIA_QUERYOPTIMIZER_H 24 #include "searchspacepool.h" 25 #include "parser/filter.h" 26 #include "parser/parsertypes.h" 37 template <
typename SearchPo
intType,
typename DataSetType>
38 class BaseQueryOptimizer {
42 typedef BaseSearchSpacePool<SearchPointType, DataSetType> SearchSpacePoolType;
43 typedef BaseSearchSpace<SearchPointType, DataSetType> SearchSpaceType;
45 BaseQueryOptimizer(SearchSpacePoolType* spool) : _spool(spool) {}
54 SearchSpaceType*
optimize(Filter* filter);
58 SearchSpacePoolType* _spool;
60 SearchSpaceType*
optimize(parser::Predicate* pred);
63 static parser::PredLabelIsIn* findPointID(parser::Predicate* pred);
65 template <
typename PredicateType>
66 static PredicateType* findPredicate(parser::Predicate* pred);
72 static bool swapPredicate(Filter* filter, parser::Predicate* swapOut, parser::Predicate* swapIn);
78 static bool swapPredicate(parser::Predicate* parent, parser::Predicate* swapOut, parser::Predicate* swapIn);
102 typedef BaseQueryOptimizer<SearchPoint, DataSet> QueryOptimizer;
107 #include "queryoptimizer_impl.h" 109 #endif // GAIA_QUERYOPTIMIZER_H static parser::Predicate * reducePredicate(parser::Predicate *pred)
Tries to apply simplification on the predicate, such as replacing "X and True" by "X"...
Definition: queryoptimizer_impl.h:159
static void reduceFilter(Filter *filter)
Tries to apply simplification on the filter, such as replacing "X and True" by "X", etc...
Definition: queryoptimizer_impl.h:149
static void deletePredicate(Filter *filter, parser::Predicate *pred)
Deletes given predicate inside filter (replaces it with the always true predicate).
Definition: queryoptimizer_impl.h:142
Main Gaia namespace, which contains all the library functions.
Definition: addfield.cpp:22
SearchSpaceType * optimize(Filter *filter)
Ownership of the SearchSpace is yielded to the caller of the function.
Definition: queryoptimizer_impl.h:255
static bool swapPredicate(Filter *filter, parser::Predicate *swapOut, parser::Predicate *swapIn)
Swaps predicate swapOut inside of filter for predicate swapIn.
Definition: queryoptimizer_impl.h:102