//===----------------------------------------------------------------------===// // DuckDB // // duckdb/planner/operator/logical_cteref.hpp // // //===----------------------------------------------------------------------===// #pragma once #include "duckdb/common/types/chunk_collection.hpp" #include "duckdb/planner/logical_operator.hpp" namespace duckdb { //! LogicalCTERef represents a reference to a recursive CTE class LogicalCTERef : public LogicalOperator { public: static constexpr const LogicalOperatorType TYPE = LogicalOperatorType::LOGICAL_CTE_REF; public: LogicalCTERef(idx_t table_index, idx_t cte_index, vector types, vector colnames) : LogicalOperator(LogicalOperatorType::LOGICAL_CTE_REF), table_index(table_index), cte_index(cte_index) { D_ASSERT(types.size() > 0); chunk_types = types; bound_columns = colnames; } vector bound_columns; //! The table index in the current bind context idx_t table_index; //! CTE index idx_t cte_index; //! The types of the chunk vector chunk_types; public: vector GetColumnBindings() override { return GenerateColumnBindings(table_index, chunk_types.size()); } void Serialize(FieldWriter &writer) const override; static unique_ptr Deserialize(LogicalDeserializationState &state, FieldReader &reader); vector GetTableIndex() const override; string GetName() const override; protected: void ResolveTypes() override { // types are resolved in the constructor this->types = chunk_types; } }; } // namespace duckdb