1#include "duckdb/planner/operator/logical_expression_get.hpp"
2
3#include "duckdb/common/field_writer.hpp"
4#include "duckdb/main/config.hpp"
5
6namespace duckdb {
7
8void LogicalExpressionGet::Serialize(FieldWriter &writer) const {
9 writer.WriteField(element: table_index);
10 writer.WriteRegularSerializableList(elements: expr_types);
11
12 writer.WriteField<idx_t>(element: expressions.size());
13 for (auto &entry : expressions) {
14 writer.WriteSerializableList(elements: entry);
15 }
16}
17
18unique_ptr<LogicalOperator> LogicalExpressionGet::Deserialize(LogicalDeserializationState &state, FieldReader &reader) {
19 auto table_index = reader.ReadRequired<idx_t>();
20 auto expr_types = reader.ReadRequiredSerializableList<LogicalType, LogicalType>();
21
22 auto expressions_size = reader.ReadRequired<idx_t>();
23 vector<vector<unique_ptr<Expression>>> expressions;
24 for (idx_t i = 0; i < expressions_size; i++) {
25 expressions.push_back(x: reader.ReadRequiredSerializableList<Expression>(args&: state.gstate));
26 }
27
28 return make_uniq<LogicalExpressionGet>(args&: table_index, args&: expr_types, args: std::move(expressions));
29}
30
31vector<idx_t> LogicalExpressionGet::GetTableIndex() const {
32 return vector<idx_t> {table_index};
33}
34
35string LogicalExpressionGet::GetName() const {
36#ifdef DEBUG
37 if (DBConfigOptions::debug_print_bindings) {
38 return LogicalOperator::GetName() + StringUtil::Format(" #%llu", table_index);
39 }
40#endif
41 return LogicalOperator::GetName();
42}
43
44} // namespace duckdb
45