duckdb 0.8.2-dev2809.0 → 0.8.2-dev2850.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/duckdb/extension/json/include/json_deserializer.hpp +1 -1
- package/src/duckdb/extension/json/include/json_serializer.hpp +1 -1
- package/src/duckdb/extension/json/json_deserializer.cpp +16 -14
- package/src/duckdb/extension/json/json_scan.cpp +2 -2
- package/src/duckdb/extension/json/json_serializer.cpp +11 -11
- package/src/duckdb/extension/json/serialize_json.cpp +44 -44
- package/src/duckdb/extension/parquet/parquet_extension.cpp +11 -10
- package/src/duckdb/extension/parquet/serialize_parquet.cpp +6 -6
- package/src/duckdb/src/common/extra_type_info.cpp +2 -2
- package/src/duckdb/src/common/serializer/binary_deserializer.cpp +5 -3
- package/src/duckdb/src/common/serializer/binary_serializer.cpp +10 -5
- package/src/duckdb/src/common/types/column/column_data_collection.cpp +4 -4
- package/src/duckdb/src/common/types/value.cpp +33 -33
- package/src/duckdb/src/common/types/vector.cpp +20 -20
- package/src/duckdb/src/core_functions/aggregate/holistic/approximate_quantile.cpp +2 -2
- package/src/duckdb/src/core_functions/aggregate/holistic/quantile.cpp +6 -6
- package/src/duckdb/src/core_functions/aggregate/holistic/reservoir_quantile.cpp +4 -4
- package/src/duckdb/src/core_functions/scalar/list/list_lambdas.cpp +4 -4
- package/src/duckdb/src/function/table/read_csv.cpp +4 -4
- package/src/duckdb/src/function/table/table_scan.cpp +14 -14
- package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
- package/src/duckdb/src/include/duckdb/common/index_vector.hpp +2 -2
- package/src/duckdb/src/include/duckdb/common/serializer/binary_deserializer.hpp +7 -3
- package/src/duckdb/src/include/duckdb/common/serializer/binary_serializer.hpp +2 -1
- package/src/duckdb/src/include/duckdb/common/serializer/format_deserializer.hpp +18 -17
- package/src/duckdb/src/include/duckdb/common/serializer/format_serializer.hpp +10 -9
- package/src/duckdb/src/include/duckdb/common/serializer/serialization_traits.hpp +4 -0
- package/src/duckdb/src/include/duckdb/function/function_serialization.hpp +10 -10
- package/src/duckdb/src/include/duckdb/main/relation/aggregate_relation.hpp +4 -1
- package/src/duckdb/src/include/duckdb/parser/group_by_node.hpp +11 -0
- package/src/duckdb/src/include/duckdb/parser/parser.hpp +4 -0
- package/src/duckdb/src/main/relation/aggregate_relation.cpp +20 -10
- package/src/duckdb/src/main/relation.cpp +4 -4
- package/src/duckdb/src/parser/parser.cpp +18 -3
- package/src/duckdb/src/parser/tableref/pivotref.cpp +6 -6
- package/src/duckdb/src/parser/transform/constraint/transform_constraint.cpp +55 -38
- package/src/duckdb/src/planner/expression/bound_aggregate_expression.cpp +10 -10
- package/src/duckdb/src/planner/expression/bound_function_expression.cpp +6 -6
- package/src/duckdb/src/planner/expression/bound_window_expression.cpp +24 -24
- package/src/duckdb/src/planner/operator/logical_extension_operator.cpp +2 -2
- package/src/duckdb/src/planner/operator/logical_get.cpp +22 -22
- package/src/duckdb/src/storage/serialization/serialize_constraint.cpp +26 -26
- package/src/duckdb/src/storage/serialization/serialize_create_info.cpp +66 -66
- package/src/duckdb/src/storage/serialization/serialize_expression.cpp +78 -78
- package/src/duckdb/src/storage/serialization/serialize_logical_operator.cpp +250 -250
- package/src/duckdb/src/storage/serialization/serialize_macro_function.cpp +10 -10
- package/src/duckdb/src/storage/serialization/serialize_nodes.cpp +206 -206
- package/src/duckdb/src/storage/serialization/serialize_parse_info.cpp +116 -116
- package/src/duckdb/src/storage/serialization/serialize_parsed_expression.cpp +110 -110
- package/src/duckdb/src/storage/serialization/serialize_query_node.cpp +48 -48
- package/src/duckdb/src/storage/serialization/serialize_result_modifier.cpp +16 -16
- package/src/duckdb/src/storage/serialization/serialize_statement.cpp +2 -2
- package/src/duckdb/src/storage/serialization/serialize_table_filter.cpp +10 -10
- package/src/duckdb/src/storage/serialization/serialize_tableref.cpp +54 -54
- package/src/duckdb/src/storage/serialization/serialize_types.cpp +22 -22
- package/src/duckdb/src/storage/table/update_segment.cpp +1 -1
@@ -13,11 +13,28 @@ AggregateRelation::AggregateRelation(shared_ptr<Relation> child_p,
|
|
13
13
|
context.GetContext()->TryBindRelation(*this, this->columns);
|
14
14
|
}
|
15
15
|
|
16
|
+
AggregateRelation::AggregateRelation(shared_ptr<Relation> child_p,
|
17
|
+
vector<unique_ptr<ParsedExpression>> parsed_expressions, GroupByNode groups_p)
|
18
|
+
: Relation(child_p->context, RelationType::AGGREGATE_RELATION), expressions(std::move(parsed_expressions)),
|
19
|
+
groups(std::move(groups_p)), child(std::move(child_p)) {
|
20
|
+
// bind the expressions
|
21
|
+
context.GetContext()->TryBindRelation(*this, this->columns);
|
22
|
+
}
|
23
|
+
|
16
24
|
AggregateRelation::AggregateRelation(shared_ptr<Relation> child_p,
|
17
25
|
vector<unique_ptr<ParsedExpression>> parsed_expressions,
|
18
26
|
vector<unique_ptr<ParsedExpression>> groups_p)
|
19
27
|
: Relation(child_p->context, RelationType::AGGREGATE_RELATION), expressions(std::move(parsed_expressions)),
|
20
|
-
|
28
|
+
child(std::move(child_p)) {
|
29
|
+
if (!groups_p.empty()) {
|
30
|
+
// explicit groups provided: use standard handling
|
31
|
+
GroupingSet grouping_set;
|
32
|
+
for (idx_t i = 0; i < groups_p.size(); i++) {
|
33
|
+
groups.group_expressions.push_back(std::move(groups_p[i]));
|
34
|
+
grouping_set.insert(i);
|
35
|
+
}
|
36
|
+
groups.grouping_sets.push_back(std::move(grouping_set));
|
37
|
+
}
|
21
38
|
// bind the expressions
|
22
39
|
context.GetContext()->TryBindRelation(*this, this->columns);
|
23
40
|
}
|
@@ -39,16 +56,9 @@ unique_ptr<QueryNode> AggregateRelation::GetQueryNode() {
|
|
39
56
|
}
|
40
57
|
D_ASSERT(result->type == QueryNodeType::SELECT_NODE);
|
41
58
|
auto &select_node = result->Cast<SelectNode>();
|
42
|
-
if (!groups.empty()) {
|
43
|
-
// explicit groups provided: use standard handling
|
59
|
+
if (!groups.group_expressions.empty()) {
|
44
60
|
select_node.aggregate_handling = AggregateHandling::STANDARD_HANDLING;
|
45
|
-
select_node.groups.
|
46
|
-
GroupingSet grouping_set;
|
47
|
-
for (idx_t i = 0; i < groups.size(); i++) {
|
48
|
-
select_node.groups.group_expressions.push_back(groups[i]->Copy());
|
49
|
-
grouping_set.insert(i);
|
50
|
-
}
|
51
|
-
select_node.groups.grouping_sets.push_back(std::move(grouping_set));
|
61
|
+
select_node.groups = groups.Copy();
|
52
62
|
} else {
|
53
63
|
// no groups provided: automatically figure out groups (if any)
|
54
64
|
select_node.aggregate_handling = AggregateHandling::FORCE_AGGREGATES;
|
@@ -169,7 +169,7 @@ shared_ptr<Relation> Relation::Aggregate(const string &aggregate_list) {
|
|
169
169
|
|
170
170
|
shared_ptr<Relation> Relation::Aggregate(const string &aggregate_list, const string &group_list) {
|
171
171
|
auto expression_list = Parser::ParseExpressionList(aggregate_list, context.GetContext()->GetParserOptions());
|
172
|
-
auto groups = Parser::
|
172
|
+
auto groups = Parser::ParseGroupByList(group_list, context.GetContext()->GetParserOptions());
|
173
173
|
return make_shared<AggregateRelation>(shared_from_this(), std::move(expression_list), std::move(groups));
|
174
174
|
}
|
175
175
|
|
@@ -179,9 +179,9 @@ shared_ptr<Relation> Relation::Aggregate(const vector<string> &aggregates) {
|
|
179
179
|
}
|
180
180
|
|
181
181
|
shared_ptr<Relation> Relation::Aggregate(const vector<string> &aggregates, const vector<string> &groups) {
|
182
|
-
auto aggregate_list =
|
183
|
-
auto group_list =
|
184
|
-
return
|
182
|
+
auto aggregate_list = StringUtil::Join(aggregates, ", ");
|
183
|
+
auto group_list = StringUtil::Join(groups, ", ");
|
184
|
+
return this->Aggregate(aggregate_list, group_list);
|
185
185
|
}
|
186
186
|
|
187
187
|
string Relation::GetAlias() {
|
@@ -8,6 +8,7 @@
|
|
8
8
|
#include "duckdb/parser/statement/extension_statement.hpp"
|
9
9
|
#include "duckdb/parser/statement/select_statement.hpp"
|
10
10
|
#include "duckdb/parser/statement/update_statement.hpp"
|
11
|
+
#include "duckdb/parser/group_by_node.hpp"
|
11
12
|
#include "duckdb/parser/tableref/expressionlistref.hpp"
|
12
13
|
#include "duckdb/parser/transformer.hpp"
|
13
14
|
#include "parser/parser.hpp"
|
@@ -340,6 +341,22 @@ vector<unique_ptr<ParsedExpression>> Parser::ParseExpressionList(const string &s
|
|
340
341
|
return std::move(select_node.select_list);
|
341
342
|
}
|
342
343
|
|
344
|
+
GroupByNode Parser::ParseGroupByList(const string &group_by, ParserOptions options) {
|
345
|
+
// construct a mock SELECT query with our group_by expressions
|
346
|
+
string mock_query = StringUtil::Format("SELECT 42 GROUP BY %s", group_by);
|
347
|
+
// parse the query
|
348
|
+
Parser parser(options);
|
349
|
+
parser.ParseQuery(mock_query);
|
350
|
+
// check the result
|
351
|
+
if (parser.statements.size() != 1 || parser.statements[0]->type != StatementType::SELECT_STATEMENT) {
|
352
|
+
throw ParserException("Expected a single SELECT statement");
|
353
|
+
}
|
354
|
+
auto &select = parser.statements[0]->Cast<SelectStatement>();
|
355
|
+
D_ASSERT(select.node->type == QueryNodeType::SELECT_NODE);
|
356
|
+
auto &select_node = select.node->Cast<SelectNode>();
|
357
|
+
return std::move(select_node.groups);
|
358
|
+
}
|
359
|
+
|
343
360
|
vector<OrderByNode> Parser::ParseOrderList(const string &select_list, ParserOptions options) {
|
344
361
|
// construct a mock query
|
345
362
|
string mock_query = "SELECT * FROM tbl ORDER BY " + select_list;
|
@@ -351,9 +368,7 @@ vector<OrderByNode> Parser::ParseOrderList(const string &select_list, ParserOpti
|
|
351
368
|
throw ParserException("Expected a single SELECT statement");
|
352
369
|
}
|
353
370
|
auto &select = parser.statements[0]->Cast<SelectStatement>();
|
354
|
-
|
355
|
-
throw ParserException("Expected a single SELECT node");
|
356
|
-
}
|
371
|
+
D_ASSERT(select.node->type == QueryNodeType::SELECT_NODE);
|
357
372
|
auto &select_node = select.node->Cast<SelectNode>();
|
358
373
|
if (select_node.modifiers.empty() || select_node.modifiers[0]->type != ResultModifierType::ORDER_MODIFIER ||
|
359
374
|
select_node.modifiers.size() != 1) {
|
@@ -161,9 +161,9 @@ void PivotColumnEntry::Serialize(Serializer &serializer) const {
|
|
161
161
|
}
|
162
162
|
|
163
163
|
void PivotColumnEntry::FormatSerialize(FormatSerializer &serializer) const {
|
164
|
-
serializer.WriteProperty("values", values);
|
165
|
-
serializer.WriteOptionalProperty("star_expr", star_expr);
|
166
|
-
serializer.WriteProperty("alias", alias);
|
164
|
+
serializer.WriteProperty(100, "values", values);
|
165
|
+
serializer.WriteOptionalProperty(101, "star_expr", star_expr);
|
166
|
+
serializer.WriteProperty(102, "alias", alias);
|
167
167
|
}
|
168
168
|
|
169
169
|
PivotColumnEntry PivotColumnEntry::Deserialize(Deserializer &source) {
|
@@ -178,9 +178,9 @@ PivotColumnEntry PivotColumnEntry::Deserialize(Deserializer &source) {
|
|
178
178
|
|
179
179
|
PivotColumnEntry PivotColumnEntry::FormatDeserialize(FormatDeserializer &source) {
|
180
180
|
PivotColumnEntry result;
|
181
|
-
source.ReadProperty("values", result.values);
|
182
|
-
source.ReadOptionalProperty("star_expr", result.star_expr);
|
183
|
-
source.ReadProperty("alias", result.alias);
|
181
|
+
source.ReadProperty(100, "values", result.values);
|
182
|
+
source.ReadOptionalProperty(101, "star_expr", result.star_expr);
|
183
|
+
source.ReadProperty(102, "alias", result.alias);
|
184
184
|
return result;
|
185
185
|
}
|
186
186
|
|
@@ -17,8 +17,58 @@ static void ParseSchemaTableNameFK(duckdb_libpgquery::PGRangeVar *input, Foreign
|
|
17
17
|
fk_info.table = input->relname;
|
18
18
|
}
|
19
19
|
|
20
|
+
static bool ForeignKeyActionSupported(char action) {
|
21
|
+
switch (action) {
|
22
|
+
case PG_FKCONSTR_ACTION_NOACTION:
|
23
|
+
case PG_FKCONSTR_ACTION_RESTRICT:
|
24
|
+
return true;
|
25
|
+
case PG_FKCONSTR_ACTION_CASCADE:
|
26
|
+
case PG_FKCONSTR_ACTION_SETDEFAULT:
|
27
|
+
case PG_FKCONSTR_ACTION_SETNULL:
|
28
|
+
return false;
|
29
|
+
default:
|
30
|
+
D_ASSERT(false);
|
31
|
+
}
|
32
|
+
return false;
|
33
|
+
}
|
34
|
+
|
35
|
+
static unique_ptr<ForeignKeyConstraint>
|
36
|
+
TransformForeignKeyConstraint(duckdb_libpgquery::PGConstraint *constraint,
|
37
|
+
optional_ptr<const string> override_fk_column = nullptr) {
|
38
|
+
D_ASSERT(constraint);
|
39
|
+
if (!ForeignKeyActionSupported(constraint->fk_upd_action) ||
|
40
|
+
!ForeignKeyActionSupported(constraint->fk_del_action)) {
|
41
|
+
throw ParserException("FOREIGN KEY constraints cannot use CASCADE, SET NULL or SET DEFAULT");
|
42
|
+
}
|
43
|
+
ForeignKeyInfo fk_info;
|
44
|
+
fk_info.type = ForeignKeyType::FK_TYPE_FOREIGN_KEY_TABLE;
|
45
|
+
ParseSchemaTableNameFK(constraint->pktable, fk_info);
|
46
|
+
vector<string> pk_columns, fk_columns;
|
47
|
+
if (override_fk_column) {
|
48
|
+
D_ASSERT(!constraint->fk_attrs);
|
49
|
+
fk_columns.emplace_back(*override_fk_column);
|
50
|
+
} else if (constraint->fk_attrs) {
|
51
|
+
for (auto kc = constraint->fk_attrs->head; kc; kc = kc->next) {
|
52
|
+
fk_columns.emplace_back(reinterpret_cast<duckdb_libpgquery::PGValue *>(kc->data.ptr_value)->val.str);
|
53
|
+
}
|
54
|
+
}
|
55
|
+
if (constraint->pk_attrs) {
|
56
|
+
for (auto kc = constraint->pk_attrs->head; kc; kc = kc->next) {
|
57
|
+
pk_columns.emplace_back(reinterpret_cast<duckdb_libpgquery::PGValue *>(kc->data.ptr_value)->val.str);
|
58
|
+
}
|
59
|
+
}
|
60
|
+
if (!pk_columns.empty() && pk_columns.size() != fk_columns.size()) {
|
61
|
+
throw ParserException("The number of referencing and referenced columns for foreign keys must be the same");
|
62
|
+
}
|
63
|
+
if (fk_columns.empty()) {
|
64
|
+
throw ParserException("The set of referencing and referenced columns for foreign keys must be not empty");
|
65
|
+
}
|
66
|
+
return make_uniq<ForeignKeyConstraint>(pk_columns, fk_columns, std::move(fk_info));
|
67
|
+
}
|
68
|
+
|
20
69
|
unique_ptr<Constraint> Transformer::TransformConstraint(duckdb_libpgquery::PGListCell *cell) {
|
21
70
|
auto constraint = reinterpret_cast<duckdb_libpgquery::PGConstraint *>(cell->data.ptr_value);
|
71
|
+
D_ASSERT(constraint);
|
22
72
|
switch (constraint->contype) {
|
23
73
|
case duckdb_libpgquery::PG_CONSTR_UNIQUE:
|
24
74
|
case duckdb_libpgquery::PG_CONSTR_PRIMARY: {
|
@@ -36,27 +86,9 @@ unique_ptr<Constraint> Transformer::TransformConstraint(duckdb_libpgquery::PGLis
|
|
36
86
|
}
|
37
87
|
return make_uniq<CheckConstraint>(TransformExpression(constraint->raw_expr));
|
38
88
|
}
|
39
|
-
case duckdb_libpgquery::PG_CONSTR_FOREIGN:
|
40
|
-
|
41
|
-
|
42
|
-
ParseSchemaTableNameFK(constraint->pktable, fk_info);
|
43
|
-
vector<string> pk_columns, fk_columns;
|
44
|
-
for (auto kc = constraint->fk_attrs->head; kc; kc = kc->next) {
|
45
|
-
fk_columns.emplace_back(reinterpret_cast<duckdb_libpgquery::PGValue *>(kc->data.ptr_value)->val.str);
|
46
|
-
}
|
47
|
-
if (constraint->pk_attrs) {
|
48
|
-
for (auto kc = constraint->pk_attrs->head; kc; kc = kc->next) {
|
49
|
-
pk_columns.emplace_back(reinterpret_cast<duckdb_libpgquery::PGValue *>(kc->data.ptr_value)->val.str);
|
50
|
-
}
|
51
|
-
}
|
52
|
-
if (!pk_columns.empty() && pk_columns.size() != fk_columns.size()) {
|
53
|
-
throw ParserException("The number of referencing and referenced columns for foreign keys must be the same");
|
54
|
-
}
|
55
|
-
if (fk_columns.empty()) {
|
56
|
-
throw ParserException("The set of referencing and referenced columns for foreign keys must be not empty");
|
57
|
-
}
|
58
|
-
return make_uniq<ForeignKeyConstraint>(pk_columns, fk_columns, std::move(fk_info));
|
59
|
-
}
|
89
|
+
case duckdb_libpgquery::PG_CONSTR_FOREIGN:
|
90
|
+
return TransformForeignKeyConstraint(constraint);
|
91
|
+
|
60
92
|
default:
|
61
93
|
throw NotImplementedException("Constraint type not handled yet!");
|
62
94
|
}
|
@@ -96,23 +128,8 @@ unique_ptr<Constraint> Transformer::TransformConstraint(duckdb_libpgquery::PGLis
|
|
96
128
|
"dictionary, pfor, bitpacking or fsst");
|
97
129
|
}
|
98
130
|
return nullptr;
|
99
|
-
case duckdb_libpgquery::PG_CONSTR_FOREIGN:
|
100
|
-
|
101
|
-
fk_info.type = ForeignKeyType::FK_TYPE_FOREIGN_KEY_TABLE;
|
102
|
-
ParseSchemaTableNameFK(constraint->pktable, fk_info);
|
103
|
-
|
104
|
-
vector<string> pk_columns, fk_columns;
|
105
|
-
fk_columns.emplace_back(column.Name().c_str());
|
106
|
-
if (constraint->pk_attrs) {
|
107
|
-
for (auto kc = constraint->pk_attrs->head; kc; kc = kc->next) {
|
108
|
-
pk_columns.emplace_back(reinterpret_cast<duckdb_libpgquery::PGValue *>(kc->data.ptr_value)->val.str);
|
109
|
-
}
|
110
|
-
}
|
111
|
-
if (!pk_columns.empty() && pk_columns.size() != fk_columns.size()) {
|
112
|
-
throw ParserException("The number of referencing and referenced columns for foreign keys must be the same");
|
113
|
-
}
|
114
|
-
return make_uniq<ForeignKeyConstraint>(pk_columns, fk_columns, std::move(fk_info));
|
115
|
-
}
|
131
|
+
case duckdb_libpgquery::PG_CONSTR_FOREIGN:
|
132
|
+
return TransformForeignKeyConstraint(constraint, &column.Name());
|
116
133
|
default:
|
117
134
|
throw NotImplementedException("Constraint not implemented!");
|
118
135
|
}
|
@@ -106,24 +106,24 @@ unique_ptr<Expression> BoundAggregateExpression::Deserialize(ExpressionDeseriali
|
|
106
106
|
|
107
107
|
void BoundAggregateExpression::FormatSerialize(FormatSerializer &serializer) const {
|
108
108
|
Expression::FormatSerialize(serializer);
|
109
|
-
serializer.WriteProperty("return_type", return_type);
|
110
|
-
serializer.WriteProperty("children", children);
|
109
|
+
serializer.WriteProperty(200, "return_type", return_type);
|
110
|
+
serializer.WriteProperty(201, "children", children);
|
111
111
|
FunctionSerializer::FormatSerialize(serializer, function, bind_info.get());
|
112
|
-
serializer.WriteProperty("aggregate_type", aggr_type);
|
113
|
-
serializer.WriteOptionalProperty("filter", filter);
|
114
|
-
serializer.WriteOptionalProperty("order_bys", order_bys);
|
112
|
+
serializer.WriteProperty(203, "aggregate_type", aggr_type);
|
113
|
+
serializer.WriteOptionalProperty(204, "filter", filter);
|
114
|
+
serializer.WriteOptionalProperty(205, "order_bys", order_bys);
|
115
115
|
}
|
116
116
|
|
117
117
|
unique_ptr<Expression> BoundAggregateExpression::FormatDeserialize(FormatDeserializer &deserializer) {
|
118
|
-
auto return_type = deserializer.ReadProperty<LogicalType>("return_type");
|
119
|
-
auto children = deserializer.ReadProperty<vector<unique_ptr<Expression>>>("children");
|
118
|
+
auto return_type = deserializer.ReadProperty<LogicalType>(200, "return_type");
|
119
|
+
auto children = deserializer.ReadProperty<vector<unique_ptr<Expression>>>(201, "children");
|
120
120
|
auto entry = FunctionSerializer::FormatDeserialize<AggregateFunction, AggregateFunctionCatalogEntry>(
|
121
121
|
deserializer, CatalogType::AGGREGATE_FUNCTION_ENTRY, children);
|
122
|
-
auto aggregate_type = deserializer.ReadProperty<AggregateType>("aggregate_type");
|
123
|
-
auto filter = deserializer.ReadOptionalProperty<unique_ptr<Expression>>("filter");
|
122
|
+
auto aggregate_type = deserializer.ReadProperty<AggregateType>(203, "aggregate_type");
|
123
|
+
auto filter = deserializer.ReadOptionalProperty<unique_ptr<Expression>>(204, "filter");
|
124
124
|
auto result = make_uniq<BoundAggregateExpression>(std::move(entry.first), std::move(children), std::move(filter),
|
125
125
|
std::move(entry.second), aggregate_type);
|
126
|
-
deserializer.ReadOptionalProperty("order_bys", result->order_bys);
|
126
|
+
deserializer.ReadOptionalProperty(205, "order_bys", result->order_bys);
|
127
127
|
return std::move(result);
|
128
128
|
}
|
129
129
|
|
@@ -97,20 +97,20 @@ unique_ptr<Expression> BoundFunctionExpression::Deserialize(ExpressionDeserializ
|
|
97
97
|
|
98
98
|
void BoundFunctionExpression::FormatSerialize(FormatSerializer &serializer) const {
|
99
99
|
Expression::FormatSerialize(serializer);
|
100
|
-
serializer.WriteProperty("return_type", return_type);
|
101
|
-
serializer.WriteProperty("children", children);
|
100
|
+
serializer.WriteProperty(200, "return_type", return_type);
|
101
|
+
serializer.WriteProperty(201, "children", children);
|
102
102
|
FunctionSerializer::FormatSerialize(serializer, function, bind_info.get());
|
103
|
-
serializer.WriteProperty("is_operator", is_operator);
|
103
|
+
serializer.WriteProperty(202, "is_operator", is_operator);
|
104
104
|
}
|
105
105
|
|
106
106
|
unique_ptr<Expression> BoundFunctionExpression::FormatDeserialize(FormatDeserializer &deserializer) {
|
107
|
-
auto return_type = deserializer.ReadProperty<LogicalType>("return_type");
|
108
|
-
auto children = deserializer.ReadProperty<vector<unique_ptr<Expression>>>("children");
|
107
|
+
auto return_type = deserializer.ReadProperty<LogicalType>(200, "return_type");
|
108
|
+
auto children = deserializer.ReadProperty<vector<unique_ptr<Expression>>>(201, "children");
|
109
109
|
auto entry = FunctionSerializer::FormatDeserialize<ScalarFunction, ScalarFunctionCatalogEntry>(
|
110
110
|
deserializer, CatalogType::SCALAR_FUNCTION_ENTRY, children);
|
111
111
|
auto result = make_uniq<BoundFunctionExpression>(std::move(return_type), std::move(entry.first),
|
112
112
|
std::move(children), std::move(entry.second));
|
113
|
-
deserializer.ReadProperty("is_operator", result->is_operator);
|
113
|
+
deserializer.ReadProperty(202, "is_operator", result->is_operator);
|
114
114
|
return std::move(result);
|
115
115
|
}
|
116
116
|
|
@@ -164,28 +164,28 @@ unique_ptr<Expression> BoundWindowExpression::Deserialize(ExpressionDeserializat
|
|
164
164
|
|
165
165
|
void BoundWindowExpression::FormatSerialize(FormatSerializer &serializer) const {
|
166
166
|
Expression::FormatSerialize(serializer);
|
167
|
-
serializer.WriteProperty("return_type", return_type);
|
168
|
-
serializer.WriteProperty("children", children);
|
167
|
+
serializer.WriteProperty(200, "return_type", return_type);
|
168
|
+
serializer.WriteProperty(201, "children", children);
|
169
169
|
if (type == ExpressionType::WINDOW_AGGREGATE) {
|
170
170
|
D_ASSERT(aggregate);
|
171
171
|
FunctionSerializer::FormatSerialize(serializer, *aggregate, bind_info.get());
|
172
172
|
}
|
173
|
-
serializer.WriteProperty("partitions", partitions);
|
174
|
-
serializer.WriteProperty("orders", orders);
|
175
|
-
serializer.WriteOptionalProperty("filters", filter_expr);
|
176
|
-
serializer.WriteProperty("ignore_nulls", ignore_nulls);
|
177
|
-
serializer.WriteProperty("start", start);
|
178
|
-
serializer.WriteProperty("end", end);
|
179
|
-
serializer.WriteOptionalProperty("start_expr", start_expr);
|
180
|
-
serializer.WriteOptionalProperty("end_expr", end_expr);
|
181
|
-
serializer.WriteOptionalProperty("offset_expr", offset_expr);
|
182
|
-
serializer.WriteOptionalProperty("default_expr", default_expr);
|
173
|
+
serializer.WriteProperty(202, "partitions", partitions);
|
174
|
+
serializer.WriteProperty(203, "orders", orders);
|
175
|
+
serializer.WriteOptionalProperty(204, "filters", filter_expr);
|
176
|
+
serializer.WriteProperty(205, "ignore_nulls", ignore_nulls);
|
177
|
+
serializer.WriteProperty(206, "start", start);
|
178
|
+
serializer.WriteProperty(207, "end", end);
|
179
|
+
serializer.WriteOptionalProperty(208, "start_expr", start_expr);
|
180
|
+
serializer.WriteOptionalProperty(209, "end_expr", end_expr);
|
181
|
+
serializer.WriteOptionalProperty(210, "offset_expr", offset_expr);
|
182
|
+
serializer.WriteOptionalProperty(211, "default_expr", default_expr);
|
183
183
|
}
|
184
184
|
|
185
185
|
unique_ptr<Expression> BoundWindowExpression::FormatDeserialize(FormatDeserializer &deserializer) {
|
186
186
|
auto expression_type = deserializer.Get<ExpressionType>();
|
187
|
-
auto return_type = deserializer.ReadProperty<LogicalType>("return_type");
|
188
|
-
auto children = deserializer.ReadProperty<vector<unique_ptr<Expression>>>("children");
|
187
|
+
auto return_type = deserializer.ReadProperty<LogicalType>(200, "return_type");
|
188
|
+
auto children = deserializer.ReadProperty<vector<unique_ptr<Expression>>>(201, "children");
|
189
189
|
unique_ptr<AggregateFunction> aggregate;
|
190
190
|
unique_ptr<FunctionData> bind_info;
|
191
191
|
if (expression_type == ExpressionType::WINDOW_AGGREGATE) {
|
@@ -196,16 +196,16 @@ unique_ptr<Expression> BoundWindowExpression::FormatDeserialize(FormatDeserializ
|
|
196
196
|
}
|
197
197
|
auto result =
|
198
198
|
make_uniq<BoundWindowExpression>(expression_type, return_type, std::move(aggregate), std::move(bind_info));
|
199
|
-
deserializer.ReadProperty("partitions", result->partitions);
|
200
|
-
deserializer.ReadProperty("orders", result->orders);
|
201
|
-
deserializer.ReadOptionalProperty("filters", result->filter_expr);
|
202
|
-
deserializer.ReadProperty("ignore_nulls", result->ignore_nulls);
|
203
|
-
deserializer.ReadProperty("start", result->start);
|
204
|
-
deserializer.ReadProperty("end", result->end);
|
205
|
-
deserializer.ReadOptionalProperty("start_expr", result->start_expr);
|
206
|
-
deserializer.ReadOptionalProperty("end_expr", result->end_expr);
|
207
|
-
deserializer.ReadOptionalProperty("offset_expr", result->offset_expr);
|
208
|
-
deserializer.ReadOptionalProperty("default_expr", result->default_expr);
|
199
|
+
deserializer.ReadProperty(202, "partitions", result->partitions);
|
200
|
+
deserializer.ReadProperty(203, "orders", result->orders);
|
201
|
+
deserializer.ReadOptionalProperty(204, "filters", result->filter_expr);
|
202
|
+
deserializer.ReadProperty(205, "ignore_nulls", result->ignore_nulls);
|
203
|
+
deserializer.ReadProperty(206, "start", result->start);
|
204
|
+
deserializer.ReadProperty(207, "end", result->end);
|
205
|
+
deserializer.ReadOptionalProperty(208, "start_expr", result->start_expr);
|
206
|
+
deserializer.ReadOptionalProperty(209, "end_expr", result->end_expr);
|
207
|
+
deserializer.ReadOptionalProperty(210, "offset_expr", result->offset_expr);
|
208
|
+
deserializer.ReadOptionalProperty(211, "default_expr", result->default_expr);
|
209
209
|
return std::move(result);
|
210
210
|
}
|
211
211
|
|
@@ -20,12 +20,12 @@ unique_ptr<LogicalExtensionOperator> LogicalExtensionOperator::Deserialize(Logic
|
|
20
20
|
|
21
21
|
void LogicalExtensionOperator::FormatSerialize(FormatSerializer &serializer) const {
|
22
22
|
LogicalOperator::FormatSerialize(serializer);
|
23
|
-
serializer.WriteProperty("extension_name", GetExtensionName());
|
23
|
+
serializer.WriteProperty(200, "extension_name", GetExtensionName());
|
24
24
|
}
|
25
25
|
|
26
26
|
unique_ptr<LogicalOperator> LogicalExtensionOperator::FormatDeserialize(FormatDeserializer &deserializer) {
|
27
27
|
auto &config = DBConfig::GetConfig(deserializer.Get<ClientContext &>());
|
28
|
-
auto extension_name = deserializer.ReadProperty<string>("extension_name");
|
28
|
+
auto extension_name = deserializer.ReadProperty<string>(200, "extension_name");
|
29
29
|
for (auto &extension : config.operator_extensions) {
|
30
30
|
if (extension->GetName() == extension_name) {
|
31
31
|
return extension->FormatDeserialize(deserializer);
|
@@ -210,32 +210,32 @@ unique_ptr<LogicalOperator> LogicalGet::Deserialize(LogicalDeserializationState
|
|
210
210
|
|
211
211
|
void LogicalGet::FormatSerialize(FormatSerializer &serializer) const {
|
212
212
|
LogicalOperator::FormatSerialize(serializer);
|
213
|
-
serializer.WriteProperty("table_index", table_index);
|
214
|
-
serializer.WriteProperty("returned_types", returned_types);
|
215
|
-
serializer.WriteProperty("names", names);
|
216
|
-
serializer.WriteProperty("column_ids", column_ids);
|
217
|
-
serializer.WriteProperty("projection_ids", projection_ids);
|
218
|
-
serializer.WriteProperty("table_filters", table_filters);
|
213
|
+
serializer.WriteProperty(200, "table_index", table_index);
|
214
|
+
serializer.WriteProperty(201, "returned_types", returned_types);
|
215
|
+
serializer.WriteProperty(202, "names", names);
|
216
|
+
serializer.WriteProperty(203, "column_ids", column_ids);
|
217
|
+
serializer.WriteProperty(204, "projection_ids", projection_ids);
|
218
|
+
serializer.WriteProperty(205, "table_filters", table_filters);
|
219
219
|
FunctionSerializer::FormatSerialize(serializer, function, bind_data.get());
|
220
220
|
if (!function.format_serialize) {
|
221
221
|
D_ASSERT(!function.format_deserialize);
|
222
222
|
// no serialize method: serialize input values and named_parameters for rebinding purposes
|
223
|
-
serializer.WriteProperty("parameters", parameters);
|
224
|
-
serializer.WriteProperty("named_parameters", named_parameters);
|
225
|
-
serializer.WriteProperty("input_table_types", input_table_types);
|
226
|
-
serializer.WriteProperty("input_table_names", input_table_names);
|
223
|
+
serializer.WriteProperty(206, "parameters", parameters);
|
224
|
+
serializer.WriteProperty(207, "named_parameters", named_parameters);
|
225
|
+
serializer.WriteProperty(208, "input_table_types", input_table_types);
|
226
|
+
serializer.WriteProperty(209, "input_table_names", input_table_names);
|
227
227
|
}
|
228
|
-
serializer.WriteProperty("projected_input", projected_input);
|
228
|
+
serializer.WriteProperty(210, "projected_input", projected_input);
|
229
229
|
}
|
230
230
|
|
231
231
|
unique_ptr<LogicalOperator> LogicalGet::FormatDeserialize(FormatDeserializer &deserializer) {
|
232
232
|
auto result = unique_ptr<LogicalGet>(new LogicalGet());
|
233
|
-
deserializer.ReadProperty("table_index", result->table_index);
|
234
|
-
deserializer.ReadProperty("returned_types", result->returned_types);
|
235
|
-
deserializer.ReadProperty("names", result->names);
|
236
|
-
deserializer.ReadProperty("column_ids", result->column_ids);
|
237
|
-
deserializer.ReadProperty("projection_ids", result->projection_ids);
|
238
|
-
deserializer.ReadProperty("table_filters", result->table_filters);
|
233
|
+
deserializer.ReadProperty(200, "table_index", result->table_index);
|
234
|
+
deserializer.ReadProperty(201, "returned_types", result->returned_types);
|
235
|
+
deserializer.ReadProperty(202, "names", result->names);
|
236
|
+
deserializer.ReadProperty(203, "column_ids", result->column_ids);
|
237
|
+
deserializer.ReadProperty(204, "projection_ids", result->projection_ids);
|
238
|
+
deserializer.ReadProperty(205, "table_filters", result->table_filters);
|
239
239
|
auto entry = FunctionSerializer::FormatDeserializeBase<TableFunction, TableFunctionCatalogEntry>(
|
240
240
|
deserializer, CatalogType::TABLE_FUNCTION_ENTRY);
|
241
241
|
auto &function = entry.first;
|
@@ -243,10 +243,10 @@ unique_ptr<LogicalOperator> LogicalGet::FormatDeserialize(FormatDeserializer &de
|
|
243
243
|
|
244
244
|
unique_ptr<FunctionData> bind_data;
|
245
245
|
if (!has_serialize) {
|
246
|
-
deserializer.ReadProperty("parameters", result->parameters);
|
247
|
-
deserializer.ReadProperty("named_parameters", result->named_parameters);
|
248
|
-
deserializer.ReadProperty("input_table_types", result->input_table_types);
|
249
|
-
deserializer.ReadProperty("input_table_names", result->input_table_names);
|
246
|
+
deserializer.ReadProperty(206, "parameters", result->parameters);
|
247
|
+
deserializer.ReadProperty(207, "named_parameters", result->named_parameters);
|
248
|
+
deserializer.ReadProperty(208, "input_table_types", result->input_table_types);
|
249
|
+
deserializer.ReadProperty(209, "input_table_names", result->input_table_names);
|
250
250
|
TableFunctionBindInput input(result->parameters, result->named_parameters, result->input_table_types,
|
251
251
|
result->input_table_names, function.function_info.get());
|
252
252
|
|
@@ -268,7 +268,7 @@ unique_ptr<LogicalOperator> LogicalGet::FormatDeserialize(FormatDeserializer &de
|
|
268
268
|
} else {
|
269
269
|
bind_data = FunctionSerializer::FunctionDeserialize(deserializer, function);
|
270
270
|
}
|
271
|
-
deserializer.ReadProperty("projected_input", result->projected_input);
|
271
|
+
deserializer.ReadProperty(210, "projected_input", result->projected_input);
|
272
272
|
return std::move(result);
|
273
273
|
}
|
274
274
|
|
@@ -10,11 +10,11 @@
|
|
10
10
|
namespace duckdb {
|
11
11
|
|
12
12
|
void Constraint::FormatSerialize(FormatSerializer &serializer) const {
|
13
|
-
serializer.WriteProperty("type", type);
|
13
|
+
serializer.WriteProperty(100, "type", type);
|
14
14
|
}
|
15
15
|
|
16
16
|
unique_ptr<Constraint> Constraint::FormatDeserialize(FormatDeserializer &deserializer) {
|
17
|
-
auto type = deserializer.ReadProperty<ConstraintType>("type");
|
17
|
+
auto type = deserializer.ReadProperty<ConstraintType>(100, "type");
|
18
18
|
unique_ptr<Constraint> result;
|
19
19
|
switch (type) {
|
20
20
|
case ConstraintType::CHECK:
|
@@ -37,61 +37,61 @@ unique_ptr<Constraint> Constraint::FormatDeserialize(FormatDeserializer &deseria
|
|
37
37
|
|
38
38
|
void CheckConstraint::FormatSerialize(FormatSerializer &serializer) const {
|
39
39
|
Constraint::FormatSerialize(serializer);
|
40
|
-
serializer.WriteProperty("expression", *expression);
|
40
|
+
serializer.WriteProperty(200, "expression", *expression);
|
41
41
|
}
|
42
42
|
|
43
43
|
unique_ptr<Constraint> CheckConstraint::FormatDeserialize(FormatDeserializer &deserializer) {
|
44
|
-
auto expression = deserializer.ReadProperty<unique_ptr<ParsedExpression>>("expression");
|
44
|
+
auto expression = deserializer.ReadProperty<unique_ptr<ParsedExpression>>(200, "expression");
|
45
45
|
auto result = duckdb::unique_ptr<CheckConstraint>(new CheckConstraint(std::move(expression)));
|
46
46
|
return std::move(result);
|
47
47
|
}
|
48
48
|
|
49
49
|
void ForeignKeyConstraint::FormatSerialize(FormatSerializer &serializer) const {
|
50
50
|
Constraint::FormatSerialize(serializer);
|
51
|
-
serializer.WriteProperty("pk_columns", pk_columns);
|
52
|
-
serializer.WriteProperty("fk_columns", fk_columns);
|
53
|
-
serializer.WriteProperty("fk_type", info.type);
|
54
|
-
serializer.WriteProperty("schema", info.schema);
|
55
|
-
serializer.WriteProperty("table", info.table);
|
56
|
-
serializer.WriteProperty("pk_keys", info.pk_keys);
|
57
|
-
serializer.WriteProperty("fk_keys", info.fk_keys);
|
51
|
+
serializer.WriteProperty(200, "pk_columns", pk_columns);
|
52
|
+
serializer.WriteProperty(201, "fk_columns", fk_columns);
|
53
|
+
serializer.WriteProperty(202, "fk_type", info.type);
|
54
|
+
serializer.WriteProperty(203, "schema", info.schema);
|
55
|
+
serializer.WriteProperty(204, "table", info.table);
|
56
|
+
serializer.WriteProperty(205, "pk_keys", info.pk_keys);
|
57
|
+
serializer.WriteProperty(206, "fk_keys", info.fk_keys);
|
58
58
|
}
|
59
59
|
|
60
60
|
unique_ptr<Constraint> ForeignKeyConstraint::FormatDeserialize(FormatDeserializer &deserializer) {
|
61
61
|
auto result = duckdb::unique_ptr<ForeignKeyConstraint>(new ForeignKeyConstraint());
|
62
|
-
deserializer.ReadProperty("pk_columns", result->pk_columns);
|
63
|
-
deserializer.ReadProperty("fk_columns", result->fk_columns);
|
64
|
-
deserializer.ReadProperty("fk_type", result->info.type);
|
65
|
-
deserializer.ReadProperty("schema", result->info.schema);
|
66
|
-
deserializer.ReadProperty("table", result->info.table);
|
67
|
-
deserializer.ReadProperty("pk_keys", result->info.pk_keys);
|
68
|
-
deserializer.ReadProperty("fk_keys", result->info.fk_keys);
|
62
|
+
deserializer.ReadProperty(200, "pk_columns", result->pk_columns);
|
63
|
+
deserializer.ReadProperty(201, "fk_columns", result->fk_columns);
|
64
|
+
deserializer.ReadProperty(202, "fk_type", result->info.type);
|
65
|
+
deserializer.ReadProperty(203, "schema", result->info.schema);
|
66
|
+
deserializer.ReadProperty(204, "table", result->info.table);
|
67
|
+
deserializer.ReadProperty(205, "pk_keys", result->info.pk_keys);
|
68
|
+
deserializer.ReadProperty(206, "fk_keys", result->info.fk_keys);
|
69
69
|
return std::move(result);
|
70
70
|
}
|
71
71
|
|
72
72
|
void NotNullConstraint::FormatSerialize(FormatSerializer &serializer) const {
|
73
73
|
Constraint::FormatSerialize(serializer);
|
74
|
-
serializer.WriteProperty("index", index);
|
74
|
+
serializer.WriteProperty(200, "index", index);
|
75
75
|
}
|
76
76
|
|
77
77
|
unique_ptr<Constraint> NotNullConstraint::FormatDeserialize(FormatDeserializer &deserializer) {
|
78
|
-
auto index = deserializer.ReadProperty<LogicalIndex>("index");
|
78
|
+
auto index = deserializer.ReadProperty<LogicalIndex>(200, "index");
|
79
79
|
auto result = duckdb::unique_ptr<NotNullConstraint>(new NotNullConstraint(index));
|
80
80
|
return std::move(result);
|
81
81
|
}
|
82
82
|
|
83
83
|
void UniqueConstraint::FormatSerialize(FormatSerializer &serializer) const {
|
84
84
|
Constraint::FormatSerialize(serializer);
|
85
|
-
serializer.WriteProperty("is_primary_key", is_primary_key);
|
86
|
-
serializer.WriteProperty("index", index);
|
87
|
-
serializer.WriteProperty("columns", columns);
|
85
|
+
serializer.WriteProperty(200, "is_primary_key", is_primary_key);
|
86
|
+
serializer.WriteProperty(201, "index", index);
|
87
|
+
serializer.WriteProperty(202, "columns", columns);
|
88
88
|
}
|
89
89
|
|
90
90
|
unique_ptr<Constraint> UniqueConstraint::FormatDeserialize(FormatDeserializer &deserializer) {
|
91
91
|
auto result = duckdb::unique_ptr<UniqueConstraint>(new UniqueConstraint());
|
92
|
-
deserializer.ReadProperty("is_primary_key", result->is_primary_key);
|
93
|
-
deserializer.ReadProperty("index", result->index);
|
94
|
-
deserializer.ReadProperty("columns", result->columns);
|
92
|
+
deserializer.ReadProperty(200, "is_primary_key", result->is_primary_key);
|
93
|
+
deserializer.ReadProperty(201, "index", result->index);
|
94
|
+
deserializer.ReadProperty(202, "columns", result->columns);
|
95
95
|
return std::move(result);
|
96
96
|
}
|
97
97
|
|