1//===----------------------------------------------------------------------===//
2// DuckDB
3//
4// duckdb/optimizer/optimizer.hpp
5//
6//
7//===----------------------------------------------------------------------===//
8
9#pragma once
10
11#include "duckdb/optimizer/expression_rewriter.hpp"
12#include "duckdb/planner/logical_operator.hpp"
13#include "duckdb/planner/logical_operator_visitor.hpp"
14#include "duckdb/common/enums/optimizer_type.hpp"
15
16#include <functional>
17
18namespace duckdb {
19class Binder;
20
21class Optimizer {
22public:
23 Optimizer(Binder &binder, ClientContext &context);
24
25 unique_ptr<LogicalOperator> Optimize(unique_ptr<LogicalOperator> plan);
26
27 ClientContext &context;
28 Binder &binder;
29 ExpressionRewriter rewriter;
30
31private:
32 void RunOptimizer(OptimizerType type, const std::function<void()> &callback);
33 void Verify(LogicalOperator &op);
34
35private:
36 unique_ptr<LogicalOperator> plan;
37};
38
39} // namespace duckdb
40