mutable
A Database System for Research and Fast Prototyping
Loading...
Searching...
No Matches
CostModel.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <Eigen/Core>
4#include <Eigen/LU>
5#include <mutable/mutable-config.hpp>
10#include <utility>
11
12
13namespace m {
14
15/* We use LinearModel to express our learned cost models. */
17
18struct M_EXPORT CostModelFactory
19{
23 template<typename T>
24 static CostModel generate_filter_cost_model(unsigned degree, const char *csv_folder_path = nullptr);
25
26
30 template<typename T>
31 static CostModel generate_group_by_cost_model(const char *csv_folder_path = nullptr);
32
33
37 template<typename T>
38 static CostModel generate_join_cost_model(const char *csv_folder_path = nullptr);
39
40public:
41 template<typename T>
42 static CostModel get_cost_model(OperatorKind op, const char *csv_folder_path = nullptr, unsigned degree = 9) {
43 /* generate new cost model. */
44 switch(op) {
45 case OperatorKind::FilterOperator:
46 return generate_filter_cost_model<T>(degree, csv_folder_path);
47 case OperatorKind::GroupingOperator:
48 return generate_group_by_cost_model<T>(csv_folder_path);
49 case OperatorKind::JoinOperator:
50 return generate_join_cost_model<T>(csv_folder_path);
51 default:
52 M_unreachable("operator not supported.");
53 }
54 }
55
61 static std::unique_ptr<CostFunction> get_cost_function();
62};
63
64}
A model for predicting the costs of a physical operator.
Definition: LinearModel.hpp:11
#define M_unreachable(MSG)
Definition: macro.hpp:146
‍mutable namespace
Definition: Backend.hpp:10
OperatorKind
Definition: Operator.hpp:620
static CostModel get_cost_model(OperatorKind op, const char *csv_folder_path=nullptr, unsigned degree=9)
Definition: CostModel.hpp:42