1 | //===----------------------------------------------------------------------===// |
2 | // DuckDB |
3 | // |
4 | // duckdb/optimizer/optimizer_extension.hpp |
5 | // |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | #pragma once |
10 | |
11 | #include "duckdb/common/common.hpp" |
12 | #include "duckdb/planner/logical_operator.hpp" |
13 | |
14 | namespace duckdb { |
15 | |
16 | //! The OptimizerExtensionInfo holds static information relevant to the optimizer extension |
17 | struct OptimizerExtensionInfo { |
18 | virtual ~OptimizerExtensionInfo() { |
19 | } |
20 | }; |
21 | |
22 | typedef void (*optimize_function_t)(ClientContext &context, OptimizerExtensionInfo *info, |
23 | unique_ptr<LogicalOperator> &plan); |
24 | |
25 | class OptimizerExtension { |
26 | public: |
27 | //! The parse function of the parser extension. |
28 | //! Takes a query string as input and returns ParserExtensionParseData (on success) or an error |
29 | optimize_function_t optimize_function; |
30 | |
31 | //! Additional parser info passed to the parse function |
32 | shared_ptr<OptimizerExtensionInfo> optimizer_info; |
33 | }; |
34 | |
35 | } // namespace duckdb |
36 | |