duckdb 0.8.2-dev1968.0 → 0.8.2-dev2044.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/src/catalog/catalog.cpp +1 -1
- package/src/duckdb/src/catalog/catalog_entry/index_catalog_entry.cpp +17 -41
- package/src/duckdb/src/catalog/catalog_entry/macro_catalog_entry.cpp +2 -10
- package/src/duckdb/src/catalog/catalog_entry/schema_catalog_entry.cpp +4 -14
- package/src/duckdb/src/catalog/catalog_entry/sequence_catalog_entry.cpp +11 -28
- package/src/duckdb/src/catalog/catalog_entry/table_catalog_entry.cpp +11 -38
- package/src/duckdb/src/catalog/catalog_entry/view_catalog_entry.cpp +11 -27
- package/src/duckdb/src/catalog/catalog_entry.cpp +25 -1
- package/src/duckdb/src/common/enum_util.cpp +159 -0
- package/src/duckdb/src/common/extra_type_info.cpp +1 -2
- package/src/duckdb/src/common/serializer/binary_deserializer.cpp +3 -0
- package/src/duckdb/src/common/serializer/binary_serializer.cpp +4 -4
- package/src/duckdb/src/common/types/column/column_data_collection.cpp +43 -0
- package/src/duckdb/src/common/types/vector.cpp +1 -1
- package/src/duckdb/src/common/types.cpp +0 -12
- package/src/duckdb/src/execution/physical_plan/plan_comparison_join.cpp +1 -1
- package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/index_catalog_entry.hpp +1 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/macro_catalog_entry.hpp +1 -4
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/schema_catalog_entry.hpp +2 -5
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/sequence_catalog_entry.hpp +1 -6
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_catalog_entry.hpp +2 -11
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/view_catalog_entry.hpp +2 -5
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry.hpp +14 -0
- package/src/duckdb/src/include/duckdb/common/constants.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/enum_util.hpp +32 -0
- package/src/duckdb/src/include/duckdb/common/enums/index_type.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/index_vector.hpp +12 -0
- package/src/duckdb/src/include/duckdb/common/serializer/binary_deserializer.hpp +28 -4
- package/src/duckdb/src/include/duckdb/common/serializer/binary_serializer.hpp +12 -5
- package/src/duckdb/src/include/duckdb/common/serializer/deserialization_data.hpp +110 -0
- package/src/duckdb/src/include/duckdb/common/serializer/format_deserializer.hpp +46 -1
- package/src/duckdb/src/include/duckdb/common/serializer/format_serializer.hpp +23 -21
- package/src/duckdb/src/include/duckdb/common/serializer/serialization_traits.hpp +12 -4
- package/src/duckdb/src/include/duckdb/common/types/column/column_data_collection.hpp +3 -0
- package/src/duckdb/src/include/duckdb/function/macro_function.hpp +3 -0
- package/src/duckdb/src/include/duckdb/function/scalar_macro_function.hpp +3 -0
- package/src/duckdb/src/include/duckdb/function/table_macro_function.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/column_definition.hpp +6 -5
- package/src/duckdb/src/include/duckdb/parser/column_list.hpp +4 -0
- package/src/duckdb/src/include/duckdb/parser/constraint.hpp +5 -0
- package/src/duckdb/src/include/duckdb/parser/constraints/check_constraint.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/constraints/foreign_key_constraint.hpp +6 -0
- package/src/duckdb/src/include/duckdb/parser/constraints/not_null_constraint.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/constraints/unique_constraint.hpp +6 -0
- package/src/duckdb/src/include/duckdb/parser/expression/between_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/case_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/cast_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/collate_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/columnref_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/comparison_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/conjunction_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/constant_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/default_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/function_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/lambda_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/operator_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/parameter_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/positional_reference_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/star_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/subquery_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/window_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_info.hpp +12 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_table_info.hpp +66 -2
- package/src/duckdb/src/include/duckdb/parser/parsed_data/attach_info.hpp +8 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/copy_info.hpp +8 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_index_info.hpp +4 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_info.hpp +9 -2
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_macro_info.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_schema_info.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_sequence_info.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_table_info.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_type_info.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_view_info.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_data/detach_info.hpp +7 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_data/drop_info.hpp +7 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_data/exported_table_data.hpp +7 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_data/load_info.hpp +13 -3
- package/src/duckdb/src/include/duckdb/parser/parsed_data/parse_info.hpp +22 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_data/pragma_info.hpp +10 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_data/show_select_info.hpp +7 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_data/transaction_info.hpp +10 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_data/vacuum_info.hpp +10 -0
- package/src/duckdb/src/include/duckdb/planner/bound_constraint.hpp +0 -8
- package/src/duckdb/src/include/duckdb/planner/bound_result_modifier.hpp +6 -0
- package/src/duckdb/src/include/duckdb/planner/column_binding.hpp +5 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_between_expression.hpp +6 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_case_expression.hpp +6 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_cast_expression.hpp +6 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_columnref_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_comparison_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_conjunction_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_constant_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_default_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_lambda_expression.hpp +3 -1
- package/src/duckdb/src/include/duckdb/planner/expression/bound_lambdaref_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_operator_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_parameter_data.hpp +5 -2
- package/src/duckdb/src/include/duckdb/planner/expression/bound_parameter_expression.hpp +7 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_reference_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_unnest_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/expression/list.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/joinside.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/logical_operator.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_aggregate.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_any_join.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_column_data_get.hpp +4 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_comparison_join.hpp +9 -2
- package/src/duckdb/src/include/duckdb/planner/operator/logical_create.hpp +9 -6
- package/src/duckdb/src/include/duckdb/planner/operator/logical_create_index.hpp +2 -16
- package/src/duckdb/src/include/duckdb/planner/operator/logical_create_table.hpp +10 -6
- package/src/duckdb/src/include/duckdb/planner/operator/logical_cross_product.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_cteref.hpp +2 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_delete.hpp +7 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_delim_get.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_distinct.hpp +6 -10
- package/src/duckdb/src/include/duckdb/planner/operator/logical_dummy_scan.hpp +2 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_empty_result.hpp +2 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_explain.hpp +4 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_expression_get.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_filter.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_insert.hpp +6 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_limit.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_limit_percent.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_materialized_cte.hpp +5 -2
- package/src/duckdb/src/include/duckdb/planner/operator/logical_order.hpp +7 -35
- package/src/duckdb/src/include/duckdb/planner/operator/logical_pivot.hpp +6 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_positional_join.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_projection.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_recursive_cte.hpp +5 -3
- package/src/duckdb/src/include/duckdb/planner/operator/logical_reset.hpp +4 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_sample.hpp +6 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_set.hpp +4 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_set_operation.hpp +4 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_show.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_simple.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_top_n.hpp +4 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_unnest.hpp +2 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_update.hpp +6 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_window.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/tableref/bound_pivotref.hpp +3 -0
- package/src/duckdb/src/optimizer/deliminator.cpp +5 -3
- package/src/duckdb/src/parser/column_definition.cpp +20 -32
- package/src/duckdb/src/parser/column_list.cpp +8 -0
- package/src/duckdb/src/parser/constraints/foreign_key_constraint.cpp +3 -0
- package/src/duckdb/src/parser/constraints/unique_constraint.cpp +3 -0
- package/src/duckdb/src/parser/expression/case_expression.cpp +0 -12
- package/src/duckdb/src/parser/parsed_data/alter_info.cpp +5 -2
- package/src/duckdb/src/parser/parsed_data/alter_table_info.cpp +38 -0
- package/src/duckdb/src/parser/parsed_data/create_index_info.cpp +3 -1
- package/src/duckdb/src/parser/parsed_data/create_sequence_info.cpp +2 -0
- package/src/duckdb/src/parser/parsed_data/detach_info.cpp +1 -1
- package/src/duckdb/src/parser/parsed_data/drop_info.cpp +1 -1
- package/src/duckdb/src/parser/parsed_data/sample_options.cpp +0 -18
- package/src/duckdb/src/parser/parsed_data/transaction_info.cpp +4 -1
- package/src/duckdb/src/parser/parsed_data/vacuum_info.cpp +1 -1
- package/src/duckdb/src/parser/query_node.cpp +0 -10
- package/src/duckdb/src/parser/result_modifier.cpp +0 -13
- package/src/duckdb/src/parser/statement/select_statement.cpp +0 -10
- package/src/duckdb/src/parser/tableref/pivotref.cpp +0 -16
- package/src/duckdb/src/parser/transform/statement/transform_create_index.cpp +5 -4
- package/src/duckdb/src/planner/binder/query_node/plan_subquery.cpp +1 -1
- package/src/duckdb/src/planner/binder/statement/bind_create.cpp +6 -1
- package/src/duckdb/src/planner/expression/bound_between_expression.cpp +4 -0
- package/src/duckdb/src/planner/expression/bound_cast_expression.cpp +13 -6
- package/src/duckdb/src/planner/expression/bound_parameter_expression.cpp +20 -12
- package/src/duckdb/src/planner/logical_operator.cpp +13 -1
- package/src/duckdb/src/planner/operator/logical_comparison_join.cpp +16 -2
- package/src/duckdb/src/planner/operator/logical_create.cpp +14 -0
- package/src/duckdb/src/planner/operator/logical_create_index.cpp +20 -0
- package/src/duckdb/src/planner/operator/logical_create_table.cpp +16 -0
- package/src/duckdb/src/planner/operator/logical_delete.cpp +9 -2
- package/src/duckdb/src/planner/operator/logical_delim_join.cpp +2 -4
- package/src/duckdb/src/planner/operator/logical_distinct.cpp +13 -0
- package/src/duckdb/src/planner/operator/logical_explain.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_insert.cpp +8 -2
- package/src/duckdb/src/planner/operator/logical_materialized_cte.cpp +3 -2
- package/src/duckdb/src/planner/operator/logical_order.cpp +39 -0
- package/src/duckdb/src/planner/operator/logical_pivot.cpp +3 -0
- package/src/duckdb/src/planner/operator/logical_recursive_cte.cpp +5 -5
- package/src/duckdb/src/planner/operator/logical_sample.cpp +3 -0
- package/src/duckdb/src/planner/operator/logical_update.cpp +8 -2
- package/src/duckdb/src/planner/parsed_data/bound_create_table_info.cpp +4 -2
- package/src/duckdb/src/planner/planner.cpp +11 -0
- package/src/duckdb/src/storage/checkpoint_manager.cpp +23 -23
- package/src/duckdb/src/storage/serialization/serialize_constraint.cpp +98 -0
- package/src/duckdb/src/storage/serialization/serialize_create_info.cpp +188 -0
- package/src/duckdb/src/storage/serialization/serialize_expression.cpp +274 -0
- package/src/duckdb/src/storage/serialization/serialize_logical_operator.cpp +729 -0
- package/src/duckdb/src/storage/serialization/serialize_macro_function.cpp +62 -0
- package/src/duckdb/src/storage/serialization/serialize_nodes.cpp +242 -0
- package/src/duckdb/src/storage/serialization/serialize_parse_info.cpp +419 -0
- package/src/duckdb/src/storage/serialization/serialize_parsed_expression.cpp +40 -38
- package/src/duckdb/src/storage/serialization/serialize_query_node.cpp +36 -36
- package/src/duckdb/src/storage/serialization/serialize_result_modifier.cpp +25 -14
- package/src/duckdb/src/storage/serialization/serialize_statement.cpp +22 -0
- package/src/duckdb/src/storage/serialization/serialize_tableref.cpp +47 -47
- package/src/duckdb/src/storage/serialization/serialize_types.cpp +25 -25
- package/src/duckdb/src/storage/storage_info.cpp +3 -2
- package/src/duckdb/src/storage/wal_replay.cpp +20 -19
- package/src/duckdb/ub_src_parser.cpp +0 -2
- package/src/duckdb/ub_src_storage_serialization.cpp +16 -0
- package/src/duckdb/src/parser/common_table_expression_info.cpp +0 -21
@@ -179,19 +179,6 @@ void OrderByNode::Serialize(Serializer &serializer) const {
|
|
179
179
|
writer.Finalize();
|
180
180
|
}
|
181
181
|
|
182
|
-
void OrderByNode::FormatSerialize(FormatSerializer &serializer) const {
|
183
|
-
serializer.WriteProperty("type", type);
|
184
|
-
serializer.WriteProperty("null_order", null_order);
|
185
|
-
serializer.WriteProperty("expression", expression);
|
186
|
-
}
|
187
|
-
|
188
|
-
OrderByNode OrderByNode::FormatDeserialize(FormatDeserializer &deserializer) {
|
189
|
-
auto type = deserializer.ReadProperty<OrderType>("type");
|
190
|
-
auto null_order = deserializer.ReadProperty<OrderByNullType>("null_order");
|
191
|
-
auto expression = deserializer.ReadProperty<unique_ptr<ParsedExpression>>("expression");
|
192
|
-
return OrderByNode(type, null_order, std::move(expression));
|
193
|
-
}
|
194
|
-
|
195
182
|
OrderByNode OrderByNode::Deserialize(Deserializer &source) {
|
196
183
|
FieldReader reader(source);
|
197
184
|
auto type = reader.ReadRequired<OrderType>();
|
@@ -17,22 +17,12 @@ void SelectStatement::Serialize(Serializer &serializer) const {
|
|
17
17
|
node->Serialize(serializer);
|
18
18
|
}
|
19
19
|
|
20
|
-
void SelectStatement::FormatSerialize(FormatSerializer &serializer) const {
|
21
|
-
serializer.WriteProperty("node", node);
|
22
|
-
}
|
23
|
-
|
24
20
|
unique_ptr<SelectStatement> SelectStatement::Deserialize(Deserializer &source) {
|
25
21
|
auto result = make_uniq<SelectStatement>();
|
26
22
|
result->node = QueryNode::Deserialize(source);
|
27
23
|
return result;
|
28
24
|
}
|
29
25
|
|
30
|
-
unique_ptr<SelectStatement> SelectStatement::FormatDeserialize(FormatDeserializer &deserializer) {
|
31
|
-
auto result = make_uniq<SelectStatement>();
|
32
|
-
deserializer.ReadProperty("node", result->node);
|
33
|
-
return result;
|
34
|
-
}
|
35
|
-
|
36
26
|
bool SelectStatement::Equals(const SQLStatement &other_p) const {
|
37
27
|
if (type != other_p.type) {
|
38
28
|
return false;
|
@@ -130,13 +130,6 @@ void PivotColumn::Serialize(Serializer &serializer) const {
|
|
130
130
|
writer.Finalize();
|
131
131
|
}
|
132
132
|
|
133
|
-
void PivotColumn::FormatSerialize(FormatSerializer &serializer) const {
|
134
|
-
serializer.WriteProperty("pivot_expressions", pivot_expressions);
|
135
|
-
serializer.WriteProperty("unpivot_names", unpivot_names);
|
136
|
-
serializer.WriteProperty("entries", entries);
|
137
|
-
serializer.WriteProperty("pivot_enum", pivot_enum);
|
138
|
-
}
|
139
|
-
|
140
133
|
PivotColumn PivotColumn::Deserialize(Deserializer &source) {
|
141
134
|
PivotColumn result;
|
142
135
|
FieldReader reader(source);
|
@@ -148,15 +141,6 @@ PivotColumn PivotColumn::Deserialize(Deserializer &source) {
|
|
148
141
|
return result;
|
149
142
|
}
|
150
143
|
|
151
|
-
PivotColumn PivotColumn::FormatDeserialize(FormatDeserializer &source) {
|
152
|
-
PivotColumn result;
|
153
|
-
source.ReadProperty("pivot_expressions", result.pivot_expressions);
|
154
|
-
source.ReadProperty("unpivot_names", result.unpivot_names);
|
155
|
-
source.ReadProperty("entries", result.entries);
|
156
|
-
source.ReadProperty("pivot_enum", result.pivot_enum);
|
157
|
-
return result;
|
158
|
-
}
|
159
|
-
|
160
144
|
//===--------------------------------------------------------------------===//
|
161
145
|
// PivotColumnEntry
|
162
146
|
//===--------------------------------------------------------------------===//
|
@@ -57,12 +57,13 @@ unique_ptr<CreateStatement> Transformer::TransformCreateIndex(duckdb_libpgquery:
|
|
57
57
|
info->expressions = TransformIndexParameters(*stmt.indexParams, stmt.relation->relname);
|
58
58
|
|
59
59
|
info->index_type = StringToIndexType(string(stmt.accessMethod));
|
60
|
-
auto tableref = make_uniq<BaseTableRef>();
|
61
|
-
tableref->table_name = stmt.relation->relname;
|
62
60
|
if (stmt.relation->schemaname) {
|
63
|
-
|
61
|
+
info->schema = stmt.relation->schemaname;
|
64
62
|
}
|
65
|
-
|
63
|
+
if (stmt.relation->catalogname) {
|
64
|
+
info->catalog = stmt.relation->catalogname;
|
65
|
+
}
|
66
|
+
info->table = stmt.relation->relname;
|
66
67
|
if (stmt.idxname) {
|
67
68
|
info->index_name = stmt.idxname;
|
68
69
|
} else {
|
@@ -160,7 +160,7 @@ CreateDuplicateEliminatedJoin(const vector<CorrelatedColumnInfo> &correlated_col
|
|
160
160
|
for (idx_t i = 0; i < correlated_columns.size(); i++) {
|
161
161
|
auto &col = correlated_columns[i];
|
162
162
|
delim_join->duplicate_eliminated_columns.push_back(make_uniq<BoundColumnRefExpression>(col.type, col.binding));
|
163
|
-
delim_join->
|
163
|
+
delim_join->mark_types.push_back(col.type);
|
164
164
|
}
|
165
165
|
return delim_join;
|
166
166
|
}
|
@@ -529,7 +529,12 @@ BoundStatement Binder::Bind(CreateStatement &stmt) {
|
|
529
529
|
auto &base = stmt.info->Cast<CreateIndexInfo>();
|
530
530
|
|
531
531
|
// visit the table reference
|
532
|
-
auto
|
532
|
+
auto table_ref = make_uniq<BaseTableRef>();
|
533
|
+
table_ref->catalog_name = base.catalog;
|
534
|
+
table_ref->schema_name = base.schema;
|
535
|
+
table_ref->table_name = base.table;
|
536
|
+
|
537
|
+
auto bound_table = Bind(*table_ref);
|
533
538
|
if (bound_table->type != TableReferenceType::BASE_TABLE) {
|
534
539
|
throw BinderException("Can only create an index over a base table!");
|
535
540
|
}
|
@@ -4,6 +4,10 @@
|
|
4
4
|
|
5
5
|
namespace duckdb {
|
6
6
|
|
7
|
+
BoundBetweenExpression::BoundBetweenExpression()
|
8
|
+
: Expression(ExpressionType::COMPARE_BETWEEN, ExpressionClass::BOUND_BETWEEN, LogicalType::BOOLEAN) {
|
9
|
+
}
|
10
|
+
|
7
11
|
BoundBetweenExpression::BoundBetweenExpression(unique_ptr<Expression> input, unique_ptr<Expression> lower,
|
8
12
|
unique_ptr<Expression> upper, bool lower_inclusive, bool upper_inclusive)
|
9
13
|
: Expression(ExpressionType::COMPARE_BETWEEN, ExpressionClass::BOUND_BETWEEN, LogicalType::BOOLEAN),
|
@@ -8,12 +8,25 @@
|
|
8
8
|
|
9
9
|
namespace duckdb {
|
10
10
|
|
11
|
+
static BoundCastInfo BindCastFunction(ClientContext &context, const LogicalType &source, const LogicalType &target) {
|
12
|
+
auto &cast_functions = DBConfig::GetConfig(context).GetCastFunctions();
|
13
|
+
GetCastFunctionInput input(context);
|
14
|
+
return cast_functions.GetCastFunction(source, target, input);
|
15
|
+
}
|
16
|
+
|
11
17
|
BoundCastExpression::BoundCastExpression(unique_ptr<Expression> child_p, LogicalType target_type_p,
|
12
18
|
BoundCastInfo bound_cast_p, bool try_cast_p)
|
13
19
|
: Expression(ExpressionType::OPERATOR_CAST, ExpressionClass::BOUND_CAST, std::move(target_type_p)),
|
14
20
|
child(std::move(child_p)), try_cast(try_cast_p), bound_cast(std::move(bound_cast_p)) {
|
15
21
|
}
|
16
22
|
|
23
|
+
BoundCastExpression::BoundCastExpression(ClientContext &context, unique_ptr<Expression> child_p,
|
24
|
+
LogicalType target_type_p)
|
25
|
+
: Expression(ExpressionType::OPERATOR_CAST, ExpressionClass::BOUND_CAST, std::move(target_type_p)),
|
26
|
+
child(std::move(child_p)), try_cast(false),
|
27
|
+
bound_cast(BindCastFunction(context, child->return_type, return_type)) {
|
28
|
+
}
|
29
|
+
|
17
30
|
unique_ptr<Expression> AddCastExpressionInternal(unique_ptr<Expression> expr, const LogicalType &target_type,
|
18
31
|
BoundCastInfo bound_cast, bool try_cast) {
|
19
32
|
if (expr->return_type == target_type) {
|
@@ -30,12 +43,6 @@ unique_ptr<Expression> AddCastExpressionInternal(unique_ptr<Expression> expr, co
|
|
30
43
|
return make_uniq<BoundCastExpression>(std::move(expr), target_type, std::move(bound_cast), try_cast);
|
31
44
|
}
|
32
45
|
|
33
|
-
static BoundCastInfo BindCastFunction(ClientContext &context, const LogicalType &source, const LogicalType &target) {
|
34
|
-
auto &cast_functions = DBConfig::GetConfig(context).GetCastFunctions();
|
35
|
-
GetCastFunctionInput input(context);
|
36
|
-
return cast_functions.GetCastFunction(source, target, input);
|
37
|
-
}
|
38
|
-
|
39
46
|
unique_ptr<Expression> AddCastToTypeInternal(unique_ptr<Expression> expr, const LogicalType &target_type,
|
40
47
|
CastFunctionSet &cast_functions, GetCastFunctionInput &get_input,
|
41
48
|
bool try_cast) {
|
@@ -12,6 +12,23 @@ BoundParameterExpression::BoundParameterExpression(idx_t parameter_nr)
|
|
12
12
|
parameter_nr(parameter_nr) {
|
13
13
|
}
|
14
14
|
|
15
|
+
BoundParameterExpression::BoundParameterExpression(bound_parameter_map_t &global_parameter_set, idx_t parameter_nr,
|
16
|
+
LogicalType return_type,
|
17
|
+
shared_ptr<BoundParameterData> parameter_data)
|
18
|
+
: Expression(ExpressionType::VALUE_PARAMETER, ExpressionClass::BOUND_PARAMETER, std::move(return_type)),
|
19
|
+
parameter_nr(parameter_nr) {
|
20
|
+
// check if we have already deserialized a parameter with this number
|
21
|
+
auto entry = global_parameter_set.find(parameter_nr);
|
22
|
+
if (entry == global_parameter_set.end()) {
|
23
|
+
// we have not - store the entry we deserialized from this parameter expression
|
24
|
+
global_parameter_set[parameter_nr] = parameter_data;
|
25
|
+
} else {
|
26
|
+
// we have! use the previously deserialized entry
|
27
|
+
parameter_data = entry->second;
|
28
|
+
}
|
29
|
+
this->parameter_data = std::move(parameter_data);
|
30
|
+
}
|
31
|
+
|
15
32
|
void BoundParameterExpression::Invalidate(Expression &expr) {
|
16
33
|
if (expr.type != ExpressionType::VALUE_PARAMETER) {
|
17
34
|
throw InternalException("BoundParameterExpression::Invalidate requires a parameter as input");
|
@@ -75,19 +92,10 @@ unique_ptr<Expression> BoundParameterExpression::Deserialize(ExpressionDeseriali
|
|
75
92
|
FieldReader &reader) {
|
76
93
|
auto &global_parameter_set = state.gstate.parameter_data;
|
77
94
|
auto parameter_nr = reader.ReadRequired<idx_t>();
|
78
|
-
auto
|
79
|
-
result->return_type = reader.ReadRequiredSerializable<LogicalType, LogicalType>();
|
95
|
+
auto return_type = reader.ReadRequiredSerializable<LogicalType, LogicalType>();
|
80
96
|
auto parameter_data = reader.ReadRequiredSerializable<BoundParameterData, shared_ptr<BoundParameterData>>();
|
81
|
-
|
82
|
-
|
83
|
-
if (entry == global_parameter_set.end()) {
|
84
|
-
// we have not - store the entry we deserialized from this parameter expression
|
85
|
-
global_parameter_set[parameter_nr] = parameter_data;
|
86
|
-
} else {
|
87
|
-
// we have! use the previously deserialized entry
|
88
|
-
parameter_data = entry->second;
|
89
|
-
}
|
90
|
-
result->parameter_data = std::move(parameter_data);
|
97
|
+
auto result = unique_ptr<BoundParameterExpression>(new BoundParameterExpression(
|
98
|
+
global_parameter_set, parameter_nr, std::move(return_type), std::move(parameter_data)));
|
91
99
|
return std::move(result);
|
92
100
|
}
|
93
101
|
|
@@ -9,6 +9,8 @@
|
|
9
9
|
#include "duckdb/planner/operator/list.hpp"
|
10
10
|
#include "duckdb/planner/operator/logical_extension_operator.hpp"
|
11
11
|
#include "duckdb/planner/operator/logical_dependent_join.hpp"
|
12
|
+
#include "duckdb/common/serializer/binary_serializer.hpp"
|
13
|
+
#include "duckdb/common/serializer/binary_deserializer.hpp"
|
12
14
|
|
13
15
|
namespace duckdb {
|
14
16
|
|
@@ -134,7 +136,7 @@ void LogicalOperator::Verify(ClientContext &context) {
|
|
134
136
|
expressions[expr_idx]->Serialize(serializer);
|
135
137
|
} catch (NotImplementedException &ex) {
|
136
138
|
// ignore for now (FIXME)
|
137
|
-
|
139
|
+
continue;
|
138
140
|
}
|
139
141
|
|
140
142
|
auto data = serializer.GetData();
|
@@ -142,6 +144,16 @@ void LogicalOperator::Verify(ClientContext &context) {
|
|
142
144
|
|
143
145
|
PlanDeserializationState state(context);
|
144
146
|
auto deserialized_expression = Expression::Deserialize(deserializer, state);
|
147
|
+
|
148
|
+
// format (de)serialization of expressions
|
149
|
+
try {
|
150
|
+
auto blob = BinarySerializer::Serialize(*expressions[expr_idx]);
|
151
|
+
bound_parameter_map_t parameters;
|
152
|
+
auto result = BinaryDeserializer::Deserialize<Expression>(context, parameters, blob.data(), blob.size());
|
153
|
+
result->Hash();
|
154
|
+
} catch (SerializationException &ex) {
|
155
|
+
// pass
|
156
|
+
}
|
145
157
|
// FIXME: expressions might not be equal yet because of statistics propagation
|
146
158
|
continue;
|
147
159
|
D_ASSERT(Expression::Equals(expressions[expr_idx], deserialized_expression));
|
@@ -1,6 +1,7 @@
|
|
1
1
|
#include "duckdb/common/field_writer.hpp"
|
2
2
|
#include "duckdb/common/string_util.hpp"
|
3
3
|
#include "duckdb/planner/operator/logical_comparison_join.hpp"
|
4
|
+
#include "duckdb/planner/operator/logical_delim_join.hpp"
|
4
5
|
#include "duckdb/planner/expression/bound_comparison_expression.hpp"
|
5
6
|
#include "duckdb/common/enum_util.hpp"
|
6
7
|
namespace duckdb {
|
@@ -23,15 +24,15 @@ string LogicalComparisonJoin::ParamsToString() const {
|
|
23
24
|
|
24
25
|
void LogicalComparisonJoin::Serialize(FieldWriter &writer) const {
|
25
26
|
LogicalJoin::Serialize(writer);
|
27
|
+
writer.WriteRegularSerializableList(mark_types);
|
26
28
|
writer.WriteRegularSerializableList(conditions);
|
27
|
-
writer.WriteRegularSerializableList(delim_types);
|
28
29
|
}
|
29
30
|
|
30
31
|
void LogicalComparisonJoin::Deserialize(LogicalComparisonJoin &comparison_join, LogicalDeserializationState &state,
|
31
32
|
FieldReader &reader) {
|
32
33
|
LogicalJoin::Deserialize(comparison_join, state, reader);
|
34
|
+
comparison_join.mark_types = reader.ReadRequiredSerializableList<LogicalType, LogicalType>();
|
33
35
|
comparison_join.conditions = reader.ReadRequiredSerializableList<JoinCondition, JoinCondition>(state.gstate);
|
34
|
-
comparison_join.delim_types = reader.ReadRequiredSerializableList<LogicalType, LogicalType>();
|
35
36
|
}
|
36
37
|
|
37
38
|
unique_ptr<LogicalOperator> LogicalComparisonJoin::Deserialize(LogicalDeserializationState &state,
|
@@ -41,4 +42,17 @@ unique_ptr<LogicalOperator> LogicalComparisonJoin::Deserialize(LogicalDeserializ
|
|
41
42
|
return std::move(result);
|
42
43
|
}
|
43
44
|
|
45
|
+
unique_ptr<LogicalOperator> LogicalComparisonJoin::FromDelimJoin(LogicalDelimJoin &delim_join) {
|
46
|
+
auto new_join = make_uniq<LogicalComparisonJoin>(delim_join.join_type);
|
47
|
+
new_join->children = std::move(delim_join.children);
|
48
|
+
new_join->conditions = std::move(delim_join.conditions);
|
49
|
+
new_join->types = std::move(delim_join.types);
|
50
|
+
new_join->mark_types = std::move(delim_join.mark_types);
|
51
|
+
new_join->mark_index = delim_join.mark_index;
|
52
|
+
new_join->left_projection_map = std::move(delim_join.left_projection_map);
|
53
|
+
new_join->right_projection_map = std::move(delim_join.right_projection_map);
|
54
|
+
new_join->join_stats = std::move(delim_join.join_stats);
|
55
|
+
return std::move(new_join);
|
56
|
+
}
|
57
|
+
|
44
58
|
} // namespace duckdb
|
@@ -2,6 +2,16 @@
|
|
2
2
|
|
3
3
|
namespace duckdb {
|
4
4
|
|
5
|
+
LogicalCreate::LogicalCreate(LogicalOperatorType type, unique_ptr<CreateInfo> info,
|
6
|
+
optional_ptr<SchemaCatalogEntry> schema)
|
7
|
+
: LogicalOperator(type), schema(schema), info(std::move(info)) {
|
8
|
+
}
|
9
|
+
|
10
|
+
LogicalCreate::LogicalCreate(LogicalOperatorType type, ClientContext &context, unique_ptr<CreateInfo> info_p)
|
11
|
+
: LogicalOperator(type), info(std::move(info_p)) {
|
12
|
+
this->schema = Catalog::GetSchema(context, info->catalog, info->schema, OnEntryNotFound::RETURN_NULL);
|
13
|
+
}
|
14
|
+
|
5
15
|
void LogicalCreate::Serialize(FieldWriter &writer) const {
|
6
16
|
info->Serialize(writer.GetSerializer());
|
7
17
|
}
|
@@ -18,4 +28,8 @@ idx_t LogicalCreate::EstimateCardinality(ClientContext &context) {
|
|
18
28
|
return 1;
|
19
29
|
}
|
20
30
|
|
31
|
+
void LogicalCreate::ResolveTypes() {
|
32
|
+
types.emplace_back(LogicalType::BIGINT);
|
33
|
+
}
|
34
|
+
|
21
35
|
} // namespace duckdb
|
@@ -6,6 +6,22 @@
|
|
6
6
|
|
7
7
|
namespace duckdb {
|
8
8
|
|
9
|
+
LogicalCreateIndex::LogicalCreateIndex(unique_ptr<FunctionData> bind_data_p, unique_ptr<CreateIndexInfo> info_p,
|
10
|
+
vector<unique_ptr<Expression>> expressions_p, TableCatalogEntry &table_p,
|
11
|
+
TableFunction function_p)
|
12
|
+
: LogicalOperator(LogicalOperatorType::LOGICAL_CREATE_INDEX), bind_data(std::move(bind_data_p)),
|
13
|
+
info(std::move(info_p)), table(table_p), function(std::move(function_p)) {
|
14
|
+
|
15
|
+
for (auto &expr : expressions_p) {
|
16
|
+
this->unbound_expressions.push_back(expr->Copy());
|
17
|
+
}
|
18
|
+
this->expressions = std::move(expressions_p);
|
19
|
+
|
20
|
+
if (info->column_ids.empty()) {
|
21
|
+
throw BinderException("CREATE INDEX does not refer to any columns in the base table!");
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
9
25
|
void LogicalCreateIndex::Serialize(FieldWriter &writer) const {
|
10
26
|
writer.WriteOptional(info);
|
11
27
|
writer.WriteString(table.catalog.GetName());
|
@@ -37,4 +53,8 @@ unique_ptr<LogicalOperator> LogicalCreateIndex::Deserialize(LogicalDeserializati
|
|
37
53
|
table, std::move(function));
|
38
54
|
}
|
39
55
|
|
56
|
+
void LogicalCreateIndex::ResolveTypes() {
|
57
|
+
types.emplace_back(LogicalType::BIGINT);
|
58
|
+
}
|
59
|
+
|
40
60
|
} // namespace duckdb
|
@@ -2,6 +2,18 @@
|
|
2
2
|
|
3
3
|
namespace duckdb {
|
4
4
|
|
5
|
+
LogicalCreateTable::LogicalCreateTable(SchemaCatalogEntry &schema, unique_ptr<BoundCreateTableInfo> info)
|
6
|
+
: LogicalOperator(LogicalOperatorType::LOGICAL_CREATE_TABLE), schema(schema), info(std::move(info)) {
|
7
|
+
}
|
8
|
+
|
9
|
+
LogicalCreateTable::LogicalCreateTable(ClientContext &context, const string &catalog, const string &schema,
|
10
|
+
unique_ptr<CreateInfo> unbound_info)
|
11
|
+
: LogicalOperator(LogicalOperatorType::LOGICAL_CREATE_TABLE), schema(Catalog::GetSchema(context, catalog, schema)) {
|
12
|
+
D_ASSERT(unbound_info->type == CatalogType::TABLE_ENTRY);
|
13
|
+
auto binder = Binder::CreateBinder(context);
|
14
|
+
info = binder->BindCreateTableInfo(unique_ptr_cast<CreateInfo, CreateTableInfo>(std::move(unbound_info)));
|
15
|
+
}
|
16
|
+
|
5
17
|
void LogicalCreateTable::Serialize(FieldWriter &writer) const {
|
6
18
|
writer.WriteSerializable(*info);
|
7
19
|
}
|
@@ -16,4 +28,8 @@ idx_t LogicalCreateTable::EstimateCardinality(ClientContext &context) {
|
|
16
28
|
return 1;
|
17
29
|
}
|
18
30
|
|
31
|
+
void LogicalCreateTable::ResolveTypes() {
|
32
|
+
types.emplace_back(LogicalType::BIGINT);
|
33
|
+
}
|
34
|
+
|
19
35
|
} // namespace duckdb
|
@@ -11,6 +11,11 @@ LogicalDelete::LogicalDelete(TableCatalogEntry &table, idx_t table_index)
|
|
11
11
|
return_chunk(false) {
|
12
12
|
}
|
13
13
|
|
14
|
+
LogicalDelete::LogicalDelete(ClientContext &context, const string &catalog, const string &schema, const string &table)
|
15
|
+
: LogicalOperator(LogicalOperatorType::LOGICAL_DELETE),
|
16
|
+
table(Catalog::GetEntry<TableCatalogEntry>(context, catalog, schema, table)) {
|
17
|
+
}
|
18
|
+
|
14
19
|
void LogicalDelete::Serialize(FieldWriter &writer) const {
|
15
20
|
table.Serialize(writer.GetSerializer());
|
16
21
|
writer.WriteField(table_index);
|
@@ -20,9 +25,11 @@ void LogicalDelete::Serialize(FieldWriter &writer) const {
|
|
20
25
|
|
21
26
|
unique_ptr<LogicalOperator> LogicalDelete::Deserialize(LogicalDeserializationState &state, FieldReader &reader) {
|
22
27
|
auto &context = state.gstate.context;
|
23
|
-
auto info = TableCatalogEntry::Deserialize(reader.GetSource()
|
28
|
+
auto info = TableCatalogEntry::Deserialize(reader.GetSource());
|
29
|
+
auto &table_info = info->Cast<CreateTableInfo>();
|
24
30
|
|
25
|
-
auto &table_catalog_entry =
|
31
|
+
auto &table_catalog_entry =
|
32
|
+
Catalog::GetEntry<TableCatalogEntry>(context, info->catalog, info->schema, table_info.table);
|
26
33
|
|
27
34
|
auto table_index = reader.ReadRequired<idx_t>();
|
28
35
|
auto result = make_uniq<LogicalDelete>(table_catalog_entry, table_index);
|
@@ -9,10 +9,8 @@ LogicalDelimJoin::LogicalDelimJoin(JoinType type)
|
|
9
9
|
|
10
10
|
void LogicalDelimJoin::Serialize(FieldWriter &writer) const {
|
11
11
|
LogicalComparisonJoin::Serialize(writer);
|
12
|
-
if (type
|
13
|
-
|
14
|
-
// if the delim join has no delim columns anymore it is turned into a regular comparison join
|
15
|
-
return;
|
12
|
+
if (type != LogicalOperatorType::LOGICAL_DELIM_JOIN) {
|
13
|
+
throw InternalException("LogicalDelimJoin needs to have type LOGICAL_DELIM_JOIN");
|
16
14
|
}
|
17
15
|
writer.WriteSerializableList(duplicate_eliminated_columns);
|
18
16
|
}
|
@@ -4,6 +4,14 @@
|
|
4
4
|
|
5
5
|
namespace duckdb {
|
6
6
|
|
7
|
+
LogicalDistinct::LogicalDistinct(DistinctType distinct_type)
|
8
|
+
: LogicalOperator(LogicalOperatorType::LOGICAL_DISTINCT), distinct_type(distinct_type) {
|
9
|
+
}
|
10
|
+
LogicalDistinct::LogicalDistinct(vector<unique_ptr<Expression>> targets, DistinctType distinct_type)
|
11
|
+
: LogicalOperator(LogicalOperatorType::LOGICAL_DISTINCT), distinct_type(distinct_type),
|
12
|
+
distinct_targets(std::move(targets)) {
|
13
|
+
}
|
14
|
+
|
7
15
|
string LogicalDistinct::ParamsToString() const {
|
8
16
|
string result = LogicalOperator::ParamsToString();
|
9
17
|
if (!distinct_targets.empty()) {
|
@@ -13,6 +21,7 @@ string LogicalDistinct::ParamsToString() const {
|
|
13
21
|
|
14
22
|
return result;
|
15
23
|
}
|
24
|
+
|
16
25
|
void LogicalDistinct::Serialize(FieldWriter &writer) const {
|
17
26
|
writer.WriteField<DistinctType>(distinct_type);
|
18
27
|
writer.WriteSerializableList(distinct_targets);
|
@@ -28,4 +37,8 @@ unique_ptr<LogicalOperator> LogicalDistinct::Deserialize(LogicalDeserializationS
|
|
28
37
|
return std::move(ret);
|
29
38
|
}
|
30
39
|
|
40
|
+
void LogicalDistinct::ResolveTypes() {
|
41
|
+
types = children[0]->types;
|
42
|
+
}
|
43
|
+
|
31
44
|
} // namespace duckdb
|
@@ -12,11 +12,11 @@ void LogicalExplain::Serialize(FieldWriter &writer) const {
|
|
12
12
|
|
13
13
|
unique_ptr<LogicalOperator> LogicalExplain::Deserialize(LogicalDeserializationState &state, FieldReader &reader) {
|
14
14
|
auto explain_type = reader.ReadRequired<ExplainType>();
|
15
|
-
// TODO(stephwang) review if unique_ptr<LogicalOperator> plan is needed
|
16
15
|
auto result = unique_ptr<LogicalExplain>(new LogicalExplain(explain_type));
|
17
16
|
result->physical_plan = reader.ReadRequired<string>();
|
18
17
|
result->logical_plan_unopt = reader.ReadRequired<string>();
|
19
18
|
result->logical_plan_opt = reader.ReadRequired<string>();
|
20
19
|
return std::move(result);
|
21
20
|
}
|
21
|
+
|
22
22
|
} // namespace duckdb
|
@@ -12,6 +12,11 @@ LogicalInsert::LogicalInsert(TableCatalogEntry &table, idx_t table_index)
|
|
12
12
|
action_type(OnConflictAction::THROW) {
|
13
13
|
}
|
14
14
|
|
15
|
+
LogicalInsert::LogicalInsert(ClientContext &context, const string &catalog, const string &schema, const string &table)
|
16
|
+
: LogicalOperator(LogicalOperatorType::LOGICAL_INSERT),
|
17
|
+
table(Catalog::GetEntry<TableCatalogEntry>(context, catalog, schema, table)) {
|
18
|
+
}
|
19
|
+
|
15
20
|
void LogicalInsert::Serialize(FieldWriter &writer) const {
|
16
21
|
writer.WriteField<idx_t>(insert_values.size());
|
17
22
|
for (auto &entry : insert_values) {
|
@@ -47,7 +52,7 @@ unique_ptr<LogicalOperator> LogicalInsert::Deserialize(LogicalDeserializationSta
|
|
47
52
|
|
48
53
|
auto column_index_map = reader.ReadRequiredList<idx_t, physical_index_vector_t<idx_t>>();
|
49
54
|
auto expected_types = reader.ReadRequiredSerializableList<LogicalType, LogicalType>();
|
50
|
-
auto info = TableCatalogEntry::Deserialize(reader.GetSource()
|
55
|
+
auto info = TableCatalogEntry::Deserialize(reader.GetSource());
|
51
56
|
auto table_index = reader.ReadRequired<idx_t>();
|
52
57
|
auto return_chunk = reader.ReadRequired<bool>();
|
53
58
|
auto bound_defaults = reader.ReadRequiredSerializableList<Expression>(state.gstate);
|
@@ -65,7 +70,8 @@ unique_ptr<LogicalOperator> LogicalInsert::Deserialize(LogicalDeserializationSta
|
|
65
70
|
|
66
71
|
auto &catalog = Catalog::GetCatalog(context, info->catalog);
|
67
72
|
|
68
|
-
auto &table_catalog_entry =
|
73
|
+
auto &table_catalog_entry =
|
74
|
+
catalog.GetEntry<TableCatalogEntry>(context, info->schema, info->Cast<CreateTableInfo>().table);
|
69
75
|
auto result = make_uniq<LogicalInsert>(table_catalog_entry, table_index);
|
70
76
|
result->type = state.type;
|
71
77
|
result->return_chunk = return_chunk;
|
@@ -10,8 +10,9 @@ void LogicalMaterializedCTE::Serialize(FieldWriter &writer) const {
|
|
10
10
|
|
11
11
|
unique_ptr<LogicalOperator> LogicalMaterializedCTE::Deserialize(LogicalDeserializationState &state,
|
12
12
|
FieldReader &reader) {
|
13
|
-
auto
|
14
|
-
|
13
|
+
auto result = unique_ptr<LogicalMaterializedCTE>(new LogicalMaterializedCTE());
|
14
|
+
result->table_index = reader.ReadRequired<idx_t>();
|
15
|
+
return std::move(result);
|
15
16
|
}
|
16
17
|
|
17
18
|
vector<idx_t> LogicalMaterializedCTE::GetTableIndex() const {
|
@@ -4,6 +4,45 @@
|
|
4
4
|
|
5
5
|
namespace duckdb {
|
6
6
|
|
7
|
+
LogicalOrder::LogicalOrder(vector<BoundOrderByNode> orders)
|
8
|
+
: LogicalOperator(LogicalOperatorType::LOGICAL_ORDER_BY), orders(std::move(orders)) {
|
9
|
+
}
|
10
|
+
|
11
|
+
vector<ColumnBinding> LogicalOrder::GetColumnBindings() {
|
12
|
+
auto child_bindings = children[0]->GetColumnBindings();
|
13
|
+
if (projections.empty()) {
|
14
|
+
return child_bindings;
|
15
|
+
}
|
16
|
+
|
17
|
+
vector<ColumnBinding> result;
|
18
|
+
for (auto &col_idx : projections) {
|
19
|
+
result.push_back(child_bindings[col_idx]);
|
20
|
+
}
|
21
|
+
return result;
|
22
|
+
}
|
23
|
+
|
24
|
+
string LogicalOrder::ParamsToString() const {
|
25
|
+
string result = "ORDERS:\n";
|
26
|
+
for (idx_t i = 0; i < orders.size(); i++) {
|
27
|
+
if (i > 0) {
|
28
|
+
result += "\n";
|
29
|
+
}
|
30
|
+
result += orders[i].expression->GetName();
|
31
|
+
}
|
32
|
+
return result;
|
33
|
+
}
|
34
|
+
|
35
|
+
void LogicalOrder::ResolveTypes() {
|
36
|
+
const auto child_types = children[0]->types;
|
37
|
+
if (projections.empty()) {
|
38
|
+
types = child_types;
|
39
|
+
} else {
|
40
|
+
for (auto &col_idx : projections) {
|
41
|
+
types.push_back(child_types[col_idx]);
|
42
|
+
}
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
7
46
|
void LogicalOrder::Serialize(FieldWriter &writer) const {
|
8
47
|
writer.WriteRegularSerializableList(orders);
|
9
48
|
writer.WriteList<idx_t>(projections);
|
@@ -4,6 +4,9 @@
|
|
4
4
|
|
5
5
|
namespace duckdb {
|
6
6
|
|
7
|
+
LogicalPivot::LogicalPivot() : LogicalOperator(LogicalOperatorType::LOGICAL_PIVOT) {
|
8
|
+
}
|
9
|
+
|
7
10
|
LogicalPivot::LogicalPivot(idx_t pivot_idx, unique_ptr<LogicalOperator> plan, BoundPivotInfo info_p)
|
8
11
|
: LogicalOperator(LogicalOperatorType::LOGICAL_PIVOT), pivot_index(pivot_idx), bound_pivot(std::move(info_p)) {
|
9
12
|
D_ASSERT(plan);
|
@@ -12,11 +12,11 @@ void LogicalRecursiveCTE::Serialize(FieldWriter &writer) const {
|
|
12
12
|
}
|
13
13
|
|
14
14
|
unique_ptr<LogicalOperator> LogicalRecursiveCTE::Deserialize(LogicalDeserializationState &state, FieldReader &reader) {
|
15
|
-
auto
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
return
|
15
|
+
auto result = unique_ptr<LogicalRecursiveCTE>(new LogicalRecursiveCTE());
|
16
|
+
result->table_index = reader.ReadRequired<idx_t>();
|
17
|
+
result->column_count = reader.ReadRequired<idx_t>();
|
18
|
+
result->union_all = reader.ReadRequired<bool>();
|
19
|
+
return std::move(result);
|
20
20
|
}
|
21
21
|
|
22
22
|
vector<idx_t> LogicalRecursiveCTE::GetTableIndex() const {
|
@@ -3,6 +3,9 @@
|
|
3
3
|
|
4
4
|
namespace duckdb {
|
5
5
|
|
6
|
+
LogicalSample::LogicalSample() : LogicalOperator(LogicalOperatorType::LOGICAL_SAMPLE) {
|
7
|
+
}
|
8
|
+
|
6
9
|
LogicalSample::LogicalSample(unique_ptr<SampleOptions> sample_options_p, unique_ptr<LogicalOperator> child)
|
7
10
|
: LogicalOperator(LogicalOperatorType::LOGICAL_SAMPLE), sample_options(std::move(sample_options_p)) {
|
8
11
|
children.push_back(std::move(child));
|
@@ -10,6 +10,11 @@ LogicalUpdate::LogicalUpdate(TableCatalogEntry &table)
|
|
10
10
|
: LogicalOperator(LogicalOperatorType::LOGICAL_UPDATE), table(table), table_index(0), return_chunk(false) {
|
11
11
|
}
|
12
12
|
|
13
|
+
LogicalUpdate::LogicalUpdate(ClientContext &context, const string &catalog, const string &schema, const string &table)
|
14
|
+
: LogicalOperator(LogicalOperatorType::LOGICAL_UPDATE),
|
15
|
+
table(Catalog::GetEntry<TableCatalogEntry>(context, catalog, schema, table)) {
|
16
|
+
}
|
17
|
+
|
13
18
|
void LogicalUpdate::Serialize(FieldWriter &writer) const {
|
14
19
|
table.Serialize(writer.GetSerializer());
|
15
20
|
writer.WriteField(table_index);
|
@@ -22,10 +27,11 @@ void LogicalUpdate::Serialize(FieldWriter &writer) const {
|
|
22
27
|
|
23
28
|
unique_ptr<LogicalOperator> LogicalUpdate::Deserialize(LogicalDeserializationState &state, FieldReader &reader) {
|
24
29
|
auto &context = state.gstate.context;
|
25
|
-
auto info = TableCatalogEntry::Deserialize(reader.GetSource()
|
30
|
+
auto info = TableCatalogEntry::Deserialize(reader.GetSource());
|
26
31
|
auto &catalog = Catalog::GetCatalog(context, info->catalog);
|
27
32
|
|
28
|
-
auto &table_catalog_entry =
|
33
|
+
auto &table_catalog_entry =
|
34
|
+
catalog.GetEntry<TableCatalogEntry>(context, info->schema, info->Cast<CreateTableInfo>().table);
|
29
35
|
auto result = make_uniq<LogicalUpdate>(table_catalog_entry);
|
30
36
|
result->table_index = reader.ReadRequired<idx_t>();
|
31
37
|
result->return_chunk = reader.ReadRequired<bool>();
|
@@ -2,8 +2,11 @@
|
|
2
2
|
#include "duckdb/parser/parsed_data/create_schema_info.hpp"
|
3
3
|
#include "duckdb/catalog/catalog_entry/schema_catalog_entry.hpp"
|
4
4
|
#include "duckdb/common/field_writer.hpp"
|
5
|
+
#include "duckdb/common/serializer/format_serializer.hpp"
|
6
|
+
#include "duckdb/common/serializer/format_deserializer.hpp"
|
5
7
|
|
6
8
|
namespace duckdb {
|
9
|
+
|
7
10
|
void BoundCreateTableInfo::Serialize(Serializer &serializer) const {
|
8
11
|
serializer.WriteOptional(base);
|
9
12
|
}
|
@@ -11,10 +14,9 @@ void BoundCreateTableInfo::Serialize(Serializer &serializer) const {
|
|
11
14
|
unique_ptr<BoundCreateTableInfo> BoundCreateTableInfo::Deserialize(Deserializer &source,
|
12
15
|
PlanDeserializationState &state) {
|
13
16
|
auto info = source.ReadOptional<CreateInfo>();
|
14
|
-
auto schema_name = info->schema;
|
15
|
-
auto catalog = info->catalog;
|
16
17
|
auto binder = Binder::CreateBinder(state.context);
|
17
18
|
auto bound_info = binder->BindCreateTableInfo(std::move(info));
|
18
19
|
return bound_info;
|
19
20
|
}
|
21
|
+
|
20
22
|
} // namespace duckdb
|