| 1 | //===----------------------------------------------------------------------===// |
|---|---|
| 2 | // DuckDB |
| 3 | // |
| 4 | // duckdb/planner/operator/logical_pragma.hpp |
| 5 | // |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #pragma once |
| 10 | |
| 11 | #include "duckdb/function/pragma_function.hpp" |
| 12 | #include "duckdb/parser/parsed_data/pragma_info.hpp" |
| 13 | #include "duckdb/planner/logical_operator.hpp" |
| 14 | |
| 15 | namespace duckdb { |
| 16 | |
| 17 | //! LogicalSimple represents a simple logical operator that only passes on the parse info |
| 18 | class LogicalPragma : public LogicalOperator { |
| 19 | public: |
| 20 | static constexpr const LogicalOperatorType TYPE = LogicalOperatorType::LOGICAL_PRAGMA; |
| 21 | |
| 22 | public: |
| 23 | LogicalPragma(PragmaFunction function_p, PragmaInfo info_p) |
| 24 | : LogicalOperator(LogicalOperatorType::LOGICAL_PRAGMA), function(std::move(function_p)), |
| 25 | info(std::move(info_p)) { |
| 26 | } |
| 27 | |
| 28 | //! The pragma function to call |
| 29 | PragmaFunction function; |
| 30 | //! The context of the call |
| 31 | PragmaInfo info; |
| 32 | |
| 33 | public: |
| 34 | void Serialize(FieldWriter &writer) const override; |
| 35 | static unique_ptr<LogicalOperator> Deserialize(LogicalDeserializationState &state, FieldReader &reader); |
| 36 | idx_t EstimateCardinality(ClientContext &context) override; |
| 37 | //! Skips the serialization check in VerifyPlan |
| 38 | bool SupportSerialization() const override { |
| 39 | return false; |
| 40 | } |
| 41 | |
| 42 | protected: |
| 43 | void ResolveTypes() override { |
| 44 | types.emplace_back(args: LogicalType::BOOLEAN); |
| 45 | } |
| 46 | }; |
| 47 | } // namespace duckdb |
| 48 |