1#include "duckdb/planner/operator/logical_cteref.hpp"
2
3#include "duckdb/common/field_writer.hpp"
4#include "duckdb/main/config.hpp"
5
6namespace duckdb {
7
8void LogicalCTERef::Serialize(FieldWriter &writer) const {
9 writer.WriteField(element: table_index);
10 writer.WriteField(element: cte_index);
11 writer.WriteRegularSerializableList(elements: chunk_types);
12 writer.WriteList<string>(elements: bound_columns);
13}
14
15unique_ptr<LogicalOperator> LogicalCTERef::Deserialize(LogicalDeserializationState &state, FieldReader &reader) {
16 auto table_index = reader.ReadRequired<idx_t>();
17 auto cte_index = reader.ReadRequired<idx_t>();
18 auto chunk_types = reader.ReadRequiredSerializableList<LogicalType, LogicalType>();
19 auto bound_columns = reader.ReadRequiredList<string>();
20 return make_uniq<LogicalCTERef>(args&: table_index, args&: cte_index, args&: chunk_types, args&: bound_columns);
21}
22
23vector<idx_t> LogicalCTERef::GetTableIndex() const {
24 return vector<idx_t> {table_index};
25}
26
27string LogicalCTERef::GetName() const {
28#ifdef DEBUG
29 if (DBConfigOptions::debug_print_bindings) {
30 return LogicalOperator::GetName() + StringUtil::Format(" #%llu", table_index);
31 }
32#endif
33 return LogicalOperator::GetName();
34}
35
36} // namespace duckdb
37