1#include "duckdb/planner/operator/logical_recursive_cte.hpp"
2
3#include "duckdb/common/field_writer.hpp"
4#include "duckdb/main/config.hpp"
5
6namespace duckdb {
7
8void LogicalRecursiveCTE::Serialize(FieldWriter &writer) const {
9 writer.WriteField(element: table_index);
10 writer.WriteField(element: column_count);
11 writer.WriteField(element: union_all);
12}
13
14unique_ptr<LogicalOperator> LogicalRecursiveCTE::Deserialize(LogicalDeserializationState &state, FieldReader &reader) {
15 auto table_index = reader.ReadRequired<idx_t>();
16 auto column_count = reader.ReadRequired<idx_t>();
17 auto union_all = reader.ReadRequired<bool>();
18 // TODO(stephwang): review if unique_ptr<LogicalOperator> plan is needed
19 return unique_ptr<LogicalRecursiveCTE>(new LogicalRecursiveCTE(table_index, column_count, union_all));
20}
21
22vector<idx_t> LogicalRecursiveCTE::GetTableIndex() const {
23 return vector<idx_t> {table_index};
24}
25
26string LogicalRecursiveCTE::GetName() const {
27#ifdef DEBUG
28 if (DBConfigOptions::debug_print_bindings) {
29 return LogicalOperator::GetName() + StringUtil::Format(" #%llu", table_index);
30 }
31#endif
32 return LogicalOperator::GetName();
33}
34
35} // namespace duckdb
36