| 1 | //===----------------------------------------------------------------------===// | 
|---|---|
| 2 | // DuckDB | 
| 3 | // | 
| 4 | // duckdb/planner/operator_extension.hpp | 
| 5 | // | 
| 6 | // | 
| 7 | //===----------------------------------------------------------------------===// | 
| 8 | |
| 9 | #pragma once | 
| 10 | |
| 11 | #include "duckdb/common/common.hpp" | 
| 12 | #include "duckdb/execution/physical_plan_generator.hpp" | 
| 13 | #include "duckdb/planner/binder.hpp" | 
| 14 | |
| 15 | namespace duckdb { | 
| 16 | |
| 17 | //! The OperatorExtensionInfo holds static information relevant to the operator extension | 
| 18 | struct OperatorExtensionInfo { | 
| 19 | virtual ~OperatorExtensionInfo() { | 
| 20 | } | 
| 21 | }; | 
| 22 | |
| 23 | typedef BoundStatement (*bind_function_t)(ClientContext &context, Binder &binder, OperatorExtensionInfo *info, | 
| 24 | SQLStatement &statement); | 
| 25 | |
| 26 | // forward declaration to avoid circular reference | 
| 27 | struct LogicalExtensionOperator; | 
| 28 | |
| 29 | class OperatorExtension { | 
| 30 | public: | 
| 31 | bind_function_t Bind; | 
| 32 | |
| 33 | //! Additional info passed to the CreatePlan & Bind functions | 
| 34 | shared_ptr<OperatorExtensionInfo> operator_info; | 
| 35 | |
| 36 | virtual std::string GetName() = 0; | 
| 37 | virtual unique_ptr<LogicalExtensionOperator> Deserialize(LogicalDeserializationState &state, | 
| 38 | FieldReader &reader) = 0; | 
| 39 | |
| 40 | virtual ~OperatorExtension() { | 
| 41 | } | 
| 42 | }; | 
| 43 | |
| 44 | } // namespace duckdb | 
| 45 |