1#include "duckdb/common/field_writer.hpp"
2#include "duckdb/planner/operator/logical_explain.hpp"
3
4namespace duckdb {
5
6void LogicalExplain::Serialize(FieldWriter &writer) const {
7 writer.WriteField(element: explain_type);
8 writer.WriteString(val: physical_plan);
9 writer.WriteString(val: logical_plan_unopt);
10 writer.WriteString(val: logical_plan_opt);
11}
12
13unique_ptr<LogicalOperator> LogicalExplain::Deserialize(LogicalDeserializationState &state, FieldReader &reader) {
14 auto explain_type = reader.ReadRequired<ExplainType>();
15 // TODO(stephwang) review if unique_ptr<LogicalOperator> plan is needed
16 auto result = unique_ptr<LogicalExplain>(new LogicalExplain(explain_type));
17 result->physical_plan = reader.ReadRequired<string>();
18 result->logical_plan_unopt = reader.ReadRequired<string>();
19 result->logical_plan_opt = reader.ReadRequired<string>();
20 return std::move(result);
21}
22} // namespace duckdb
23