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.
Files changed (205) hide show
  1. package/package.json +1 -1
  2. package/src/duckdb/src/catalog/catalog.cpp +1 -1
  3. package/src/duckdb/src/catalog/catalog_entry/index_catalog_entry.cpp +17 -41
  4. package/src/duckdb/src/catalog/catalog_entry/macro_catalog_entry.cpp +2 -10
  5. package/src/duckdb/src/catalog/catalog_entry/schema_catalog_entry.cpp +4 -14
  6. package/src/duckdb/src/catalog/catalog_entry/sequence_catalog_entry.cpp +11 -28
  7. package/src/duckdb/src/catalog/catalog_entry/table_catalog_entry.cpp +11 -38
  8. package/src/duckdb/src/catalog/catalog_entry/view_catalog_entry.cpp +11 -27
  9. package/src/duckdb/src/catalog/catalog_entry.cpp +25 -1
  10. package/src/duckdb/src/common/enum_util.cpp +159 -0
  11. package/src/duckdb/src/common/extra_type_info.cpp +1 -2
  12. package/src/duckdb/src/common/serializer/binary_deserializer.cpp +3 -0
  13. package/src/duckdb/src/common/serializer/binary_serializer.cpp +4 -4
  14. package/src/duckdb/src/common/types/column/column_data_collection.cpp +43 -0
  15. package/src/duckdb/src/common/types/vector.cpp +1 -1
  16. package/src/duckdb/src/common/types.cpp +0 -12
  17. package/src/duckdb/src/execution/physical_plan/plan_comparison_join.cpp +1 -1
  18. package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
  19. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/index_catalog_entry.hpp +1 -2
  20. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/macro_catalog_entry.hpp +1 -4
  21. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/schema_catalog_entry.hpp +2 -5
  22. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/sequence_catalog_entry.hpp +1 -6
  23. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_catalog_entry.hpp +2 -11
  24. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/view_catalog_entry.hpp +2 -5
  25. package/src/duckdb/src/include/duckdb/catalog/catalog_entry.hpp +14 -0
  26. package/src/duckdb/src/include/duckdb/common/constants.hpp +2 -0
  27. package/src/duckdb/src/include/duckdb/common/enum_util.hpp +32 -0
  28. package/src/duckdb/src/include/duckdb/common/enums/index_type.hpp +1 -1
  29. package/src/duckdb/src/include/duckdb/common/index_vector.hpp +12 -0
  30. package/src/duckdb/src/include/duckdb/common/serializer/binary_deserializer.hpp +28 -4
  31. package/src/duckdb/src/include/duckdb/common/serializer/binary_serializer.hpp +12 -5
  32. package/src/duckdb/src/include/duckdb/common/serializer/deserialization_data.hpp +110 -0
  33. package/src/duckdb/src/include/duckdb/common/serializer/format_deserializer.hpp +46 -1
  34. package/src/duckdb/src/include/duckdb/common/serializer/format_serializer.hpp +23 -21
  35. package/src/duckdb/src/include/duckdb/common/serializer/serialization_traits.hpp +12 -4
  36. package/src/duckdb/src/include/duckdb/common/types/column/column_data_collection.hpp +3 -0
  37. package/src/duckdb/src/include/duckdb/function/macro_function.hpp +3 -0
  38. package/src/duckdb/src/include/duckdb/function/scalar_macro_function.hpp +3 -0
  39. package/src/duckdb/src/include/duckdb/function/table_macro_function.hpp +3 -0
  40. package/src/duckdb/src/include/duckdb/parser/column_definition.hpp +6 -5
  41. package/src/duckdb/src/include/duckdb/parser/column_list.hpp +4 -0
  42. package/src/duckdb/src/include/duckdb/parser/constraint.hpp +5 -0
  43. package/src/duckdb/src/include/duckdb/parser/constraints/check_constraint.hpp +3 -0
  44. package/src/duckdb/src/include/duckdb/parser/constraints/foreign_key_constraint.hpp +6 -0
  45. package/src/duckdb/src/include/duckdb/parser/constraints/not_null_constraint.hpp +3 -0
  46. package/src/duckdb/src/include/duckdb/parser/constraints/unique_constraint.hpp +6 -0
  47. package/src/duckdb/src/include/duckdb/parser/expression/between_expression.hpp +1 -1
  48. package/src/duckdb/src/include/duckdb/parser/expression/case_expression.hpp +1 -1
  49. package/src/duckdb/src/include/duckdb/parser/expression/cast_expression.hpp +1 -1
  50. package/src/duckdb/src/include/duckdb/parser/expression/collate_expression.hpp +1 -1
  51. package/src/duckdb/src/include/duckdb/parser/expression/columnref_expression.hpp +1 -1
  52. package/src/duckdb/src/include/duckdb/parser/expression/comparison_expression.hpp +1 -1
  53. package/src/duckdb/src/include/duckdb/parser/expression/conjunction_expression.hpp +1 -1
  54. package/src/duckdb/src/include/duckdb/parser/expression/constant_expression.hpp +1 -1
  55. package/src/duckdb/src/include/duckdb/parser/expression/default_expression.hpp +1 -1
  56. package/src/duckdb/src/include/duckdb/parser/expression/function_expression.hpp +1 -1
  57. package/src/duckdb/src/include/duckdb/parser/expression/lambda_expression.hpp +1 -1
  58. package/src/duckdb/src/include/duckdb/parser/expression/operator_expression.hpp +1 -1
  59. package/src/duckdb/src/include/duckdb/parser/expression/parameter_expression.hpp +1 -1
  60. package/src/duckdb/src/include/duckdb/parser/expression/positional_reference_expression.hpp +1 -1
  61. package/src/duckdb/src/include/duckdb/parser/expression/star_expression.hpp +1 -1
  62. package/src/duckdb/src/include/duckdb/parser/expression/subquery_expression.hpp +1 -1
  63. package/src/duckdb/src/include/duckdb/parser/expression/window_expression.hpp +1 -1
  64. package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_info.hpp +12 -1
  65. package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_table_info.hpp +66 -2
  66. package/src/duckdb/src/include/duckdb/parser/parsed_data/attach_info.hpp +8 -1
  67. package/src/duckdb/src/include/duckdb/parser/parsed_data/copy_info.hpp +8 -1
  68. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_index_info.hpp +4 -1
  69. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_info.hpp +9 -2
  70. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_macro_info.hpp +3 -0
  71. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_schema_info.hpp +3 -0
  72. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_sequence_info.hpp +3 -0
  73. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_table_info.hpp +3 -0
  74. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_type_info.hpp +3 -0
  75. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_view_info.hpp +3 -0
  76. package/src/duckdb/src/include/duckdb/parser/parsed_data/detach_info.hpp +7 -0
  77. package/src/duckdb/src/include/duckdb/parser/parsed_data/drop_info.hpp +7 -0
  78. package/src/duckdb/src/include/duckdb/parser/parsed_data/exported_table_data.hpp +7 -0
  79. package/src/duckdb/src/include/duckdb/parser/parsed_data/load_info.hpp +13 -3
  80. package/src/duckdb/src/include/duckdb/parser/parsed_data/parse_info.hpp +22 -0
  81. package/src/duckdb/src/include/duckdb/parser/parsed_data/pragma_info.hpp +10 -0
  82. package/src/duckdb/src/include/duckdb/parser/parsed_data/show_select_info.hpp +7 -0
  83. package/src/duckdb/src/include/duckdb/parser/parsed_data/transaction_info.hpp +10 -0
  84. package/src/duckdb/src/include/duckdb/parser/parsed_data/vacuum_info.hpp +10 -0
  85. package/src/duckdb/src/include/duckdb/planner/bound_constraint.hpp +0 -8
  86. package/src/duckdb/src/include/duckdb/planner/bound_result_modifier.hpp +6 -0
  87. package/src/duckdb/src/include/duckdb/planner/column_binding.hpp +5 -0
  88. package/src/duckdb/src/include/duckdb/planner/expression/bound_between_expression.hpp +6 -0
  89. package/src/duckdb/src/include/duckdb/planner/expression/bound_case_expression.hpp +6 -0
  90. package/src/duckdb/src/include/duckdb/planner/expression/bound_cast_expression.hpp +6 -0
  91. package/src/duckdb/src/include/duckdb/planner/expression/bound_columnref_expression.hpp +3 -0
  92. package/src/duckdb/src/include/duckdb/planner/expression/bound_comparison_expression.hpp +3 -0
  93. package/src/duckdb/src/include/duckdb/planner/expression/bound_conjunction_expression.hpp +3 -0
  94. package/src/duckdb/src/include/duckdb/planner/expression/bound_constant_expression.hpp +3 -0
  95. package/src/duckdb/src/include/duckdb/planner/expression/bound_default_expression.hpp +3 -0
  96. package/src/duckdb/src/include/duckdb/planner/expression/bound_lambda_expression.hpp +3 -1
  97. package/src/duckdb/src/include/duckdb/planner/expression/bound_lambdaref_expression.hpp +3 -0
  98. package/src/duckdb/src/include/duckdb/planner/expression/bound_operator_expression.hpp +3 -0
  99. package/src/duckdb/src/include/duckdb/planner/expression/bound_parameter_data.hpp +5 -2
  100. package/src/duckdb/src/include/duckdb/planner/expression/bound_parameter_expression.hpp +7 -0
  101. package/src/duckdb/src/include/duckdb/planner/expression/bound_reference_expression.hpp +3 -0
  102. package/src/duckdb/src/include/duckdb/planner/expression/bound_unnest_expression.hpp +3 -0
  103. package/src/duckdb/src/include/duckdb/planner/expression/list.hpp +1 -0
  104. package/src/duckdb/src/include/duckdb/planner/expression.hpp +3 -0
  105. package/src/duckdb/src/include/duckdb/planner/joinside.hpp +3 -0
  106. package/src/duckdb/src/include/duckdb/planner/logical_operator.hpp +3 -0
  107. package/src/duckdb/src/include/duckdb/planner/operator/logical_aggregate.hpp +3 -0
  108. package/src/duckdb/src/include/duckdb/planner/operator/logical_any_join.hpp +3 -0
  109. package/src/duckdb/src/include/duckdb/planner/operator/logical_column_data_get.hpp +4 -0
  110. package/src/duckdb/src/include/duckdb/planner/operator/logical_comparison_join.hpp +9 -2
  111. package/src/duckdb/src/include/duckdb/planner/operator/logical_create.hpp +9 -6
  112. package/src/duckdb/src/include/duckdb/planner/operator/logical_create_index.hpp +2 -16
  113. package/src/duckdb/src/include/duckdb/planner/operator/logical_create_table.hpp +10 -6
  114. package/src/duckdb/src/include/duckdb/planner/operator/logical_cross_product.hpp +3 -0
  115. package/src/duckdb/src/include/duckdb/planner/operator/logical_cteref.hpp +2 -0
  116. package/src/duckdb/src/include/duckdb/planner/operator/logical_delete.hpp +7 -0
  117. package/src/duckdb/src/include/duckdb/planner/operator/logical_delim_get.hpp +3 -0
  118. package/src/duckdb/src/include/duckdb/planner/operator/logical_distinct.hpp +6 -10
  119. package/src/duckdb/src/include/duckdb/planner/operator/logical_dummy_scan.hpp +2 -0
  120. package/src/duckdb/src/include/duckdb/planner/operator/logical_empty_result.hpp +2 -0
  121. package/src/duckdb/src/include/duckdb/planner/operator/logical_explain.hpp +4 -0
  122. package/src/duckdb/src/include/duckdb/planner/operator/logical_expression_get.hpp +3 -0
  123. package/src/duckdb/src/include/duckdb/planner/operator/logical_filter.hpp +3 -0
  124. package/src/duckdb/src/include/duckdb/planner/operator/logical_insert.hpp +6 -0
  125. package/src/duckdb/src/include/duckdb/planner/operator/logical_limit.hpp +3 -0
  126. package/src/duckdb/src/include/duckdb/planner/operator/logical_limit_percent.hpp +3 -0
  127. package/src/duckdb/src/include/duckdb/planner/operator/logical_materialized_cte.hpp +5 -2
  128. package/src/duckdb/src/include/duckdb/planner/operator/logical_order.hpp +7 -35
  129. package/src/duckdb/src/include/duckdb/planner/operator/logical_pivot.hpp +6 -0
  130. package/src/duckdb/src/include/duckdb/planner/operator/logical_positional_join.hpp +3 -0
  131. package/src/duckdb/src/include/duckdb/planner/operator/logical_projection.hpp +3 -0
  132. package/src/duckdb/src/include/duckdb/planner/operator/logical_recursive_cte.hpp +5 -3
  133. package/src/duckdb/src/include/duckdb/planner/operator/logical_reset.hpp +4 -0
  134. package/src/duckdb/src/include/duckdb/planner/operator/logical_sample.hpp +6 -0
  135. package/src/duckdb/src/include/duckdb/planner/operator/logical_set.hpp +4 -0
  136. package/src/duckdb/src/include/duckdb/planner/operator/logical_set_operation.hpp +4 -0
  137. package/src/duckdb/src/include/duckdb/planner/operator/logical_show.hpp +3 -0
  138. package/src/duckdb/src/include/duckdb/planner/operator/logical_simple.hpp +3 -0
  139. package/src/duckdb/src/include/duckdb/planner/operator/logical_top_n.hpp +4 -0
  140. package/src/duckdb/src/include/duckdb/planner/operator/logical_unnest.hpp +2 -0
  141. package/src/duckdb/src/include/duckdb/planner/operator/logical_update.hpp +6 -0
  142. package/src/duckdb/src/include/duckdb/planner/operator/logical_window.hpp +3 -0
  143. package/src/duckdb/src/include/duckdb/planner/tableref/bound_pivotref.hpp +3 -0
  144. package/src/duckdb/src/optimizer/deliminator.cpp +5 -3
  145. package/src/duckdb/src/parser/column_definition.cpp +20 -32
  146. package/src/duckdb/src/parser/column_list.cpp +8 -0
  147. package/src/duckdb/src/parser/constraints/foreign_key_constraint.cpp +3 -0
  148. package/src/duckdb/src/parser/constraints/unique_constraint.cpp +3 -0
  149. package/src/duckdb/src/parser/expression/case_expression.cpp +0 -12
  150. package/src/duckdb/src/parser/parsed_data/alter_info.cpp +5 -2
  151. package/src/duckdb/src/parser/parsed_data/alter_table_info.cpp +38 -0
  152. package/src/duckdb/src/parser/parsed_data/create_index_info.cpp +3 -1
  153. package/src/duckdb/src/parser/parsed_data/create_sequence_info.cpp +2 -0
  154. package/src/duckdb/src/parser/parsed_data/detach_info.cpp +1 -1
  155. package/src/duckdb/src/parser/parsed_data/drop_info.cpp +1 -1
  156. package/src/duckdb/src/parser/parsed_data/sample_options.cpp +0 -18
  157. package/src/duckdb/src/parser/parsed_data/transaction_info.cpp +4 -1
  158. package/src/duckdb/src/parser/parsed_data/vacuum_info.cpp +1 -1
  159. package/src/duckdb/src/parser/query_node.cpp +0 -10
  160. package/src/duckdb/src/parser/result_modifier.cpp +0 -13
  161. package/src/duckdb/src/parser/statement/select_statement.cpp +0 -10
  162. package/src/duckdb/src/parser/tableref/pivotref.cpp +0 -16
  163. package/src/duckdb/src/parser/transform/statement/transform_create_index.cpp +5 -4
  164. package/src/duckdb/src/planner/binder/query_node/plan_subquery.cpp +1 -1
  165. package/src/duckdb/src/planner/binder/statement/bind_create.cpp +6 -1
  166. package/src/duckdb/src/planner/expression/bound_between_expression.cpp +4 -0
  167. package/src/duckdb/src/planner/expression/bound_cast_expression.cpp +13 -6
  168. package/src/duckdb/src/planner/expression/bound_parameter_expression.cpp +20 -12
  169. package/src/duckdb/src/planner/logical_operator.cpp +13 -1
  170. package/src/duckdb/src/planner/operator/logical_comparison_join.cpp +16 -2
  171. package/src/duckdb/src/planner/operator/logical_create.cpp +14 -0
  172. package/src/duckdb/src/planner/operator/logical_create_index.cpp +20 -0
  173. package/src/duckdb/src/planner/operator/logical_create_table.cpp +16 -0
  174. package/src/duckdb/src/planner/operator/logical_delete.cpp +9 -2
  175. package/src/duckdb/src/planner/operator/logical_delim_join.cpp +2 -4
  176. package/src/duckdb/src/planner/operator/logical_distinct.cpp +13 -0
  177. package/src/duckdb/src/planner/operator/logical_explain.cpp +1 -1
  178. package/src/duckdb/src/planner/operator/logical_insert.cpp +8 -2
  179. package/src/duckdb/src/planner/operator/logical_materialized_cte.cpp +3 -2
  180. package/src/duckdb/src/planner/operator/logical_order.cpp +39 -0
  181. package/src/duckdb/src/planner/operator/logical_pivot.cpp +3 -0
  182. package/src/duckdb/src/planner/operator/logical_recursive_cte.cpp +5 -5
  183. package/src/duckdb/src/planner/operator/logical_sample.cpp +3 -0
  184. package/src/duckdb/src/planner/operator/logical_update.cpp +8 -2
  185. package/src/duckdb/src/planner/parsed_data/bound_create_table_info.cpp +4 -2
  186. package/src/duckdb/src/planner/planner.cpp +11 -0
  187. package/src/duckdb/src/storage/checkpoint_manager.cpp +23 -23
  188. package/src/duckdb/src/storage/serialization/serialize_constraint.cpp +98 -0
  189. package/src/duckdb/src/storage/serialization/serialize_create_info.cpp +188 -0
  190. package/src/duckdb/src/storage/serialization/serialize_expression.cpp +274 -0
  191. package/src/duckdb/src/storage/serialization/serialize_logical_operator.cpp +729 -0
  192. package/src/duckdb/src/storage/serialization/serialize_macro_function.cpp +62 -0
  193. package/src/duckdb/src/storage/serialization/serialize_nodes.cpp +242 -0
  194. package/src/duckdb/src/storage/serialization/serialize_parse_info.cpp +419 -0
  195. package/src/duckdb/src/storage/serialization/serialize_parsed_expression.cpp +40 -38
  196. package/src/duckdb/src/storage/serialization/serialize_query_node.cpp +36 -36
  197. package/src/duckdb/src/storage/serialization/serialize_result_modifier.cpp +25 -14
  198. package/src/duckdb/src/storage/serialization/serialize_statement.cpp +22 -0
  199. package/src/duckdb/src/storage/serialization/serialize_tableref.cpp +47 -47
  200. package/src/duckdb/src/storage/serialization/serialize_types.cpp +25 -25
  201. package/src/duckdb/src/storage/storage_info.cpp +3 -2
  202. package/src/duckdb/src/storage/wal_replay.cpp +20 -19
  203. package/src/duckdb/ub_src_parser.cpp +0 -2
  204. package/src/duckdb/ub_src_storage_serialization.cpp +16 -0
  205. package/src/duckdb/src/parser/common_table_expression_info.cpp +0 -21
@@ -1108,18 +1108,6 @@ LogicalType LogicalType::Deserialize(Deserializer &source) {
1108
1108
  return LogicalType(id, std::move(info));
1109
1109
  }
1110
1110
 
1111
- void LogicalType::FormatSerialize(FormatSerializer &serializer) const {
1112
- serializer.WriteProperty("id", id_);
1113
- serializer.WriteOptionalProperty("type_info", type_info_.get());
1114
- }
1115
-
1116
- LogicalType LogicalType::FormatDeserialize(FormatDeserializer &deserializer) {
1117
- auto id = deserializer.ReadProperty<LogicalTypeId>("id");
1118
- auto info = deserializer.ReadOptionalProperty<shared_ptr<ExtraTypeInfo>>("type_info");
1119
-
1120
- return LogicalType(id, std::move(info));
1121
- }
1122
-
1123
1111
  bool LogicalType::EqualTypeInfo(const LogicalType &rhs) const {
1124
1112
  if (type_info_.get() == rhs.type_info_.get()) {
1125
1113
  return true;
@@ -305,7 +305,7 @@ unique_ptr<PhysicalOperator> PhysicalPlanGenerator::CreatePlan(LogicalComparison
305
305
  CheckForPerfectJoinOpt(op, perfect_join_stats);
306
306
  plan = make_uniq<PhysicalHashJoin>(op, std::move(left), std::move(right), std::move(op.conditions),
307
307
  op.join_type, op.left_projection_map, op.right_projection_map,
308
- std::move(op.delim_types), op.estimated_cardinality, perfect_join_stats);
308
+ std::move(op.mark_types), op.estimated_cardinality, perfect_join_stats);
309
309
 
310
310
  } else {
311
311
  static constexpr const idx_t NESTED_LOOP_JOIN_THRESHOLD = 5;
@@ -1,8 +1,8 @@
1
1
  #ifndef DUCKDB_VERSION
2
- #define DUCKDB_VERSION "0.8.2-dev1968"
2
+ #define DUCKDB_VERSION "0.8.2-dev2044"
3
3
  #endif
4
4
  #ifndef DUCKDB_SOURCE_ID
5
- #define DUCKDB_SOURCE_ID "b1d5e20f31"
5
+ #define DUCKDB_SOURCE_ID "762396f87b"
6
6
  #endif
7
7
  #include "duckdb/function/table/system_functions.hpp"
8
8
  #include "duckdb/main/database.hpp"
@@ -33,9 +33,8 @@ public:
33
33
  vector<unique_ptr<ParsedExpression>> parsed_expressions;
34
34
 
35
35
  public:
36
+ unique_ptr<CreateInfo> GetInfo() const override;
36
37
  string ToSQL() const override;
37
- void Serialize(Serializer &serializer) const;
38
- static unique_ptr<CreateIndexInfo> Deserialize(Deserializer &source, ClientContext &context);
39
38
 
40
39
  virtual string GetSchemaName() const = 0;
41
40
  virtual string GetTableName() const = 0;
@@ -24,10 +24,7 @@ public:
24
24
  unique_ptr<MacroFunction> function;
25
25
 
26
26
  public:
27
- virtual unique_ptr<CreateMacroInfo> GetInfoForSerialization() const;
28
- //! Serialize the meta information
29
- virtual void Serialize(Serializer &serializer) const;
30
- static unique_ptr<CreateMacroInfo> Deserialize(Deserializer &main_source, ClientContext &context);
27
+ unique_ptr<CreateInfo> GetInfo() const override;
31
28
 
32
29
  string ToSQL() const override {
33
30
  return function->ToSQL(schema.name, name);
@@ -49,17 +49,14 @@ public:
49
49
  SchemaCatalogEntry(Catalog &catalog, string name, bool is_internal);
50
50
 
51
51
  public:
52
+ unique_ptr<CreateInfo> GetInfo() const override;
53
+
52
54
  //! Scan the specified catalog set, invoking the callback method for every entry
53
55
  virtual void Scan(ClientContext &context, CatalogType type,
54
56
  const std::function<void(CatalogEntry &)> &callback) = 0;
55
57
  //! Scan the specified catalog set, invoking the callback method for every committed entry
56
58
  virtual void Scan(CatalogType type, const std::function<void(CatalogEntry &)> &callback) = 0;
57
59
 
58
- //! Serialize the meta information of the SchemaCatalogEntry a serializer
59
- virtual void Serialize(Serializer &serializer) const;
60
- //! Deserializes to a CreateSchemaInfo
61
- static unique_ptr<CreateSchemaInfo> Deserialize(Deserializer &source);
62
-
63
60
  string ToSQL() const override;
64
61
 
65
62
  //! Creates an index with the given name in the schema
@@ -57,13 +57,8 @@ public:
57
57
  bool cycle;
58
58
 
59
59
  public:
60
- //! Serialize the meta information of the SequenceCatalogEntry a serializer
61
- virtual void Serialize(Serializer &serializer) const;
62
- //! Deserializes to a CreateTableInfo
63
- static unique_ptr<CreateSequenceInfo> Deserialize(Deserializer &source);
60
+ unique_ptr<CreateInfo> GetInfo() const override;
64
61
 
65
62
  string ToSQL() const override;
66
-
67
- CatalogEntry *AlterOwnership(ClientContext &context, AlterInfo *info);
68
63
  };
69
64
  } // namespace duckdb
@@ -55,6 +55,8 @@ public:
55
55
  DUCKDB_API TableCatalogEntry(Catalog &catalog, SchemaCatalogEntry &schema, CreateTableInfo &info);
56
56
 
57
57
  public:
58
+ DUCKDB_API unique_ptr<CreateInfo> GetInfo() const override;
59
+
58
60
  DUCKDB_API bool HasGeneratedColumns() const;
59
61
 
60
62
  //! Returns whether or not a column with the given name exists
@@ -83,11 +85,6 @@ public:
83
85
  //! Get statistics of a column (physical or virtual) within the table
84
86
  virtual unique_ptr<BaseStatistics> GetStatistics(ClientContext &context, column_t column_id) = 0;
85
87
 
86
- //! Serialize the meta information of the TableCatalogEntry a serializer
87
- void Serialize(Serializer &serializer) const;
88
- //! Deserializes to a CreateTableInfo
89
- static unique_ptr<CreateTableInfo> Deserialize(Deserializer &source, ClientContext &context);
90
-
91
88
  //! Returns the column index of the specified column name.
92
89
  //! If the column does not exist:
93
90
  //! If if_column_exists is true, returns DConstants::INVALID_INDEX
@@ -113,12 +110,6 @@ public:
113
110
  ClientContext &context);
114
111
 
115
112
  protected:
116
- // This is used to serialize the entry by #Serialize(Serializer& ). It is virtual to allow
117
- // Custom catalog implementations to override the default implementation. We can not make
118
- // The Serialize method itself virtual as the logic is tightly coupled to the static
119
- // Deserialize method.
120
- virtual CreateTableInfo GetTableInfoForSerialization() const;
121
-
122
113
  //! A list of columns that are part of this table
123
114
  ColumnList columns;
124
115
  //! A list of constraints that are part of this table
@@ -38,12 +38,9 @@ public:
38
38
  vector<LogicalType> types;
39
39
 
40
40
  public:
41
- unique_ptr<CatalogEntry> AlterEntry(ClientContext &context, AlterInfo &info) override;
41
+ unique_ptr<CreateInfo> GetInfo() const override;
42
42
 
43
- //! Serialize the meta information of the ViewCatalogEntry a serializer
44
- virtual void Serialize(Serializer &serializer) const;
45
- //! Deserializes to a CreateTableInfo
46
- static unique_ptr<CreateViewInfo> Deserialize(Deserializer &source, ClientContext &context);
43
+ unique_ptr<CatalogEntry> AlterEntry(ClientContext &context, AlterInfo &info) override;
47
44
 
48
45
  unique_ptr<CatalogEntry> Copy(ClientContext &context) const override;
49
46
 
@@ -21,6 +21,10 @@ class Catalog;
21
21
  class CatalogSet;
22
22
  class ClientContext;
23
23
  class SchemaCatalogEntry;
24
+ class FormatSerializer;
25
+ class FormatDeserializer;
26
+
27
+ struct CreateInfo;
24
28
 
25
29
  //! Abstract base class of an entry in the catalog
26
30
  class CatalogEntry {
@@ -56,6 +60,8 @@ public:
56
60
 
57
61
  virtual unique_ptr<CatalogEntry> Copy(ClientContext &context) const;
58
62
 
63
+ virtual unique_ptr<CreateInfo> GetInfo() const;
64
+
59
65
  //! Sets the CatalogEntry as the new root entry (i.e. the newest entry)
60
66
  // this is called on a rollback to an AlterEntry
61
67
  virtual void SetAsRoot();
@@ -68,6 +74,14 @@ public:
68
74
 
69
75
  virtual void Verify(Catalog &catalog);
70
76
 
77
+ //! Serialize the meta information of the CatalogEntry a serializer
78
+ void Serialize(Serializer &serializer) const;
79
+ //! Deserializes to a CreateInfo
80
+ static unique_ptr<CreateInfo> Deserialize(Deserializer &source);
81
+
82
+ void FormatSerialize(FormatSerializer &serializer) const;
83
+ static unique_ptr<CreateInfo> FormatDeserialize(FormatDeserializer &deserializer);
84
+
71
85
  public:
72
86
  template <class TARGET>
73
87
  TARGET &Cast() {
@@ -17,6 +17,8 @@
17
17
  namespace duckdb {
18
18
  class Serializer;
19
19
  class Deserializer;
20
+ class FormatSerializer;
21
+ class FormatDeserializer;
20
22
 
21
23
  //! inline std directives that we use frequently
22
24
  #ifndef DUCKDB_DEBUG_MOVE
@@ -40,6 +40,8 @@ enum class AggregateOrderDependent : uint8_t;
40
40
 
41
41
  enum class AggregateType : uint8_t;
42
42
 
43
+ enum class AlterForeignKeyType : uint8_t;
44
+
43
45
  enum class AlterScalarFunctionType : uint8_t;
44
46
 
45
47
  enum class AlterTableFunctionType : uint8_t;
@@ -128,6 +130,8 @@ enum class FunctionNullHandling : uint8_t;
128
130
 
129
131
  enum class FunctionSideEffects : uint8_t;
130
132
 
133
+ enum class IndexConstraintType : uint8_t;
134
+
131
135
  enum class IndexType : uint8_t;
132
136
 
133
137
  enum class InsertColumnOrder : uint8_t;
@@ -140,6 +144,8 @@ enum class JoinType : uint8_t;
140
144
 
141
145
  enum class KeywordCategory : uint8_t;
142
146
 
147
+ enum class LoadType : uint8_t;
148
+
143
149
  enum class LogicalOperatorType : uint8_t;
144
150
 
145
151
  enum class LogicalTypeId : uint8_t;
@@ -174,6 +180,8 @@ enum class OrderType : uint8_t;
174
180
 
175
181
  enum class OutputStream : uint8_t;
176
182
 
183
+ enum class ParseInfoType : uint8_t;
184
+
177
185
  enum class ParserExtensionResultType : uint8_t;
178
186
 
179
187
  enum class ParserMode : uint8_t;
@@ -285,6 +293,9 @@ const char* EnumUtil::ToChars<AggregateOrderDependent>(AggregateOrderDependent v
285
293
  template<>
286
294
  const char* EnumUtil::ToChars<AggregateType>(AggregateType value);
287
295
 
296
+ template<>
297
+ const char* EnumUtil::ToChars<AlterForeignKeyType>(AlterForeignKeyType value);
298
+
288
299
  template<>
289
300
  const char* EnumUtil::ToChars<AlterScalarFunctionType>(AlterScalarFunctionType value);
290
301
 
@@ -417,6 +428,9 @@ const char* EnumUtil::ToChars<FunctionNullHandling>(FunctionNullHandling value);
417
428
  template<>
418
429
  const char* EnumUtil::ToChars<FunctionSideEffects>(FunctionSideEffects value);
419
430
 
431
+ template<>
432
+ const char* EnumUtil::ToChars<IndexConstraintType>(IndexConstraintType value);
433
+
420
434
  template<>
421
435
  const char* EnumUtil::ToChars<IndexType>(IndexType value);
422
436
 
@@ -435,6 +449,9 @@ const char* EnumUtil::ToChars<JoinType>(JoinType value);
435
449
  template<>
436
450
  const char* EnumUtil::ToChars<KeywordCategory>(KeywordCategory value);
437
451
 
452
+ template<>
453
+ const char* EnumUtil::ToChars<LoadType>(LoadType value);
454
+
438
455
  template<>
439
456
  const char* EnumUtil::ToChars<LogicalOperatorType>(LogicalOperatorType value);
440
457
 
@@ -486,6 +503,9 @@ const char* EnumUtil::ToChars<OrderType>(OrderType value);
486
503
  template<>
487
504
  const char* EnumUtil::ToChars<OutputStream>(OutputStream value);
488
505
 
506
+ template<>
507
+ const char* EnumUtil::ToChars<ParseInfoType>(ParseInfoType value);
508
+
489
509
  template<>
490
510
  const char* EnumUtil::ToChars<ParserExtensionResultType>(ParserExtensionResultType value);
491
511
 
@@ -646,6 +666,9 @@ AggregateOrderDependent EnumUtil::FromString<AggregateOrderDependent>(const char
646
666
  template<>
647
667
  AggregateType EnumUtil::FromString<AggregateType>(const char *value);
648
668
 
669
+ template<>
670
+ AlterForeignKeyType EnumUtil::FromString<AlterForeignKeyType>(const char *value);
671
+
649
672
  template<>
650
673
  AlterScalarFunctionType EnumUtil::FromString<AlterScalarFunctionType>(const char *value);
651
674
 
@@ -778,6 +801,9 @@ FunctionNullHandling EnumUtil::FromString<FunctionNullHandling>(const char *valu
778
801
  template<>
779
802
  FunctionSideEffects EnumUtil::FromString<FunctionSideEffects>(const char *value);
780
803
 
804
+ template<>
805
+ IndexConstraintType EnumUtil::FromString<IndexConstraintType>(const char *value);
806
+
781
807
  template<>
782
808
  IndexType EnumUtil::FromString<IndexType>(const char *value);
783
809
 
@@ -796,6 +822,9 @@ JoinType EnumUtil::FromString<JoinType>(const char *value);
796
822
  template<>
797
823
  KeywordCategory EnumUtil::FromString<KeywordCategory>(const char *value);
798
824
 
825
+ template<>
826
+ LoadType EnumUtil::FromString<LoadType>(const char *value);
827
+
799
828
  template<>
800
829
  LogicalOperatorType EnumUtil::FromString<LogicalOperatorType>(const char *value);
801
830
 
@@ -847,6 +876,9 @@ OrderType EnumUtil::FromString<OrderType>(const char *value);
847
876
  template<>
848
877
  OutputStream EnumUtil::FromString<OutputStream>(const char *value);
849
878
 
879
+ template<>
880
+ ParseInfoType EnumUtil::FromString<ParseInfoType>(const char *value);
881
+
850
882
  template<>
851
883
  ParserExtensionResultType EnumUtil::FromString<ParserExtensionResultType>(const char *value);
852
884
 
@@ -23,7 +23,7 @@ enum class IndexType : uint8_t {
23
23
  //===--------------------------------------------------------------------===//
24
24
  // Index Constraint Types
25
25
  //===--------------------------------------------------------------------===//
26
- enum IndexConstraintType : uint8_t {
26
+ enum class IndexConstraintType : uint8_t {
27
27
  NONE = 0, // index is an index don't built to any constraint
28
28
  UNIQUE = 1, // index is an index built to enforce a UNIQUE constraint
29
29
  PRIMARY = 2, // index is an index built to enforce a PRIMARY KEY constraint
@@ -10,6 +10,8 @@
10
10
 
11
11
  #include "duckdb/common/constants.hpp"
12
12
  #include "duckdb/common/vector.hpp"
13
+ #include "duckdb/common/serializer/format_serializer.hpp"
14
+ #include "duckdb/common/serializer/format_deserializer.hpp"
13
15
 
14
16
  namespace duckdb {
15
17
 
@@ -59,6 +61,16 @@ public:
59
61
  return internal_vector.end();
60
62
  }
61
63
 
64
+ void FormatSerialize(FormatSerializer &serializer) const {
65
+ serializer.WriteProperty("internal_vector", internal_vector);
66
+ }
67
+
68
+ static IndexVector<T, INDEX_TYPE> FormatDeserialize(FormatDeserializer &deserializer) {
69
+ IndexVector<T, INDEX_TYPE> result;
70
+ deserializer.ReadProperty("internal_vector", result.internal_vector);
71
+ return result;
72
+ }
73
+
62
74
  private:
63
75
  vector<T> internal_vector;
64
76
  };
@@ -1,17 +1,41 @@
1
+ //===----------------------------------------------------------------------===//
2
+ // DuckDB
3
+ //
4
+ // duckdb/common/serializer/binary_deserializer.hpp
5
+ //
6
+ //
7
+ //===----------------------------------------------------------------------===//
8
+
1
9
  #pragma once
10
+
2
11
  #include "duckdb/common/serializer/format_deserializer.hpp"
3
12
 
4
13
  namespace duckdb {
14
+ class ClientContext;
5
15
 
6
16
  class BinaryDeserializer : public FormatDeserializer {
7
17
  public:
18
+ template <class T>
19
+ unique_ptr<T> Deserialize() {
20
+ OnObjectBegin();
21
+ auto result = T::FormatDeserialize(*this);
22
+ OnObjectEnd();
23
+ return result;
24
+ }
25
+
8
26
  template <class T>
9
27
  static unique_ptr<T> Deserialize(data_ptr_t ptr, idx_t length) {
10
28
  BinaryDeserializer deserializer(ptr, length);
11
- deserializer.OnObjectBegin();
12
- auto result = T::FormatDeserialize(deserializer);
13
- deserializer.OnObjectEnd();
14
- return result;
29
+ return deserializer.template Deserialize<T>();
30
+ }
31
+
32
+ template <class T>
33
+ static unique_ptr<T> Deserialize(ClientContext &context, bound_parameter_map_t &parameters, data_ptr_t ptr,
34
+ idx_t length) {
35
+ BinaryDeserializer deserializer(ptr, length);
36
+ deserializer.Set<ClientContext &>(context);
37
+ deserializer.Set<bound_parameter_map_t &>(parameters);
38
+ return deserializer.template Deserialize<T>();
15
39
  }
16
40
 
17
41
  private:
@@ -1,3 +1,11 @@
1
+ //===----------------------------------------------------------------------===//
2
+ // DuckDB
3
+ //
4
+ // duckdb/common/serializer/binary_serializer.hpp
5
+ //
6
+ //
7
+ //===----------------------------------------------------------------------===//
8
+
1
9
  #pragma once
2
10
 
3
11
  #include "duckdb/common/serializer/format_serializer.hpp"
@@ -5,7 +13,6 @@
5
13
  namespace duckdb {
6
14
 
7
15
  struct BinarySerializer : public FormatSerializer {
8
-
9
16
  private:
10
17
  struct State {
11
18
  // how many fields are present in the object
@@ -24,14 +31,14 @@ private:
24
31
  template <class T>
25
32
  void Write(T element) {
26
33
  static_assert(std::is_trivially_destructible<T>(), "Write element must be trivially destructible");
27
- WriteData(const_data_ptr_cast(&element), sizeof(T));
34
+ WriteDataInternal(const_data_ptr_cast(&element), sizeof(T));
28
35
  }
29
- void WriteData(const_data_ptr_t buffer, idx_t write_size) {
36
+ void WriteDataInternal(const_data_ptr_t buffer, idx_t write_size) {
30
37
  data.insert(data.end(), buffer, buffer + write_size);
31
38
  stack.back().size += write_size;
32
39
  }
33
- void WriteData(const char *ptr, idx_t write_size) {
34
- WriteData(const_data_ptr_cast(ptr), write_size);
40
+ void WriteDataInternal(const char *ptr, idx_t write_size) {
41
+ WriteDataInternal(const_data_ptr_cast(ptr), write_size);
35
42
  }
36
43
 
37
44
  explicit BinarySerializer() {
@@ -0,0 +1,110 @@
1
+ //===----------------------------------------------------------------------===//
2
+ // DuckDB
3
+ //
4
+ // duckdb/common/serializer/deserialization_data.hpp
5
+ //
6
+ //
7
+ //===----------------------------------------------------------------------===//
8
+
9
+ #pragma once
10
+
11
+ #include "duckdb/common/common.hpp"
12
+ #include "duckdb/common/stack.hpp"
13
+ #include "duckdb/planner/bound_parameter_map.hpp"
14
+
15
+ namespace duckdb {
16
+ class ClientContext;
17
+ class Catalog;
18
+ enum class ExpressionType : uint8_t;
19
+
20
+ struct DeserializationData {
21
+ stack<reference<ClientContext>> contexts;
22
+ stack<idx_t> enums;
23
+ stack<reference<bound_parameter_map_t>> parameter_data;
24
+
25
+ template <class T>
26
+ void Set(T entry) = delete;
27
+
28
+ template <class T>
29
+ T Get() = delete;
30
+
31
+ template <class T>
32
+ void Unset() = delete;
33
+
34
+ template <class T>
35
+ inline void AssertNotEmpty(const stack<T> &e) {
36
+ if (e.empty()) {
37
+ throw InternalException("DeserializationData - unexpected empty stack");
38
+ }
39
+ }
40
+ };
41
+
42
+ template <>
43
+ inline void DeserializationData::Set(ExpressionType type) {
44
+ enums.push(idx_t(type));
45
+ }
46
+
47
+ template <>
48
+ inline ExpressionType DeserializationData::Get() {
49
+ AssertNotEmpty(enums);
50
+ return ExpressionType(enums.top());
51
+ }
52
+
53
+ template <>
54
+ inline void DeserializationData::Unset<ExpressionType>() {
55
+ AssertNotEmpty(enums);
56
+ enums.pop();
57
+ }
58
+
59
+ template <>
60
+ inline void DeserializationData::Set(LogicalOperatorType type) {
61
+ enums.push(idx_t(type));
62
+ }
63
+
64
+ template <>
65
+ inline LogicalOperatorType DeserializationData::Get() {
66
+ AssertNotEmpty(enums);
67
+ return LogicalOperatorType(enums.top());
68
+ }
69
+
70
+ template <>
71
+ inline void DeserializationData::Unset<LogicalOperatorType>() {
72
+ AssertNotEmpty(enums);
73
+ enums.pop();
74
+ }
75
+
76
+ template <>
77
+ inline void DeserializationData::Set(ClientContext &context) {
78
+ contexts.push(context);
79
+ }
80
+
81
+ template <>
82
+ inline ClientContext &DeserializationData::Get() {
83
+ AssertNotEmpty(contexts);
84
+ return contexts.top();
85
+ }
86
+
87
+ template <>
88
+ inline void DeserializationData::Unset<ClientContext>() {
89
+ AssertNotEmpty(contexts);
90
+ contexts.pop();
91
+ }
92
+
93
+ template <>
94
+ inline void DeserializationData::Set(bound_parameter_map_t &context) {
95
+ parameter_data.push(context);
96
+ }
97
+
98
+ template <>
99
+ inline bound_parameter_map_t &DeserializationData::Get() {
100
+ AssertNotEmpty(parameter_data);
101
+ return parameter_data.top();
102
+ }
103
+
104
+ template <>
105
+ inline void DeserializationData::Unset<bound_parameter_map_t>() {
106
+ AssertNotEmpty(parameter_data);
107
+ parameter_data.pop();
108
+ }
109
+
110
+ } // namespace duckdb
@@ -12,6 +12,7 @@
12
12
  #include "duckdb/common/serializer.hpp"
13
13
  #include "duckdb/common/enum_util.hpp"
14
14
  #include "duckdb/common/serializer/serialization_traits.hpp"
15
+ #include "duckdb/common/serializer/deserialization_data.hpp"
15
16
  #include "duckdb/common/types/interval.hpp"
16
17
  #include "duckdb/common/types/string_type.hpp"
17
18
  #include "duckdb/common/unordered_map.hpp"
@@ -24,6 +25,7 @@ class FormatDeserializer {
24
25
 
25
26
  protected:
26
27
  bool deserialize_enum_from_string = false;
28
+ DeserializationData data;
27
29
 
28
30
  public:
29
31
  // Read into an existing value
@@ -107,6 +109,24 @@ public:
107
109
  ReadDataPtr(ret, count);
108
110
  }
109
111
 
112
+ //! Set a serialization property
113
+ template <class T>
114
+ void Set(T entry) {
115
+ return data.Set<T>(entry);
116
+ }
117
+
118
+ //! Retrieve the last set serialization property of this type
119
+ template <class T>
120
+ T Get() {
121
+ return data.Get<T>();
122
+ }
123
+
124
+ //! Unset a serialization property
125
+ template <class T>
126
+ void Unset() {
127
+ return data.Unset<T>();
128
+ }
129
+
110
130
  private:
111
131
  // Deserialize anything implementing a FormatDeserialize method
112
132
  template <typename T = void>
@@ -152,6 +172,19 @@ private:
152
172
  return vec;
153
173
  }
154
174
 
175
+ template <typename T = void>
176
+ inline typename std::enable_if<is_unsafe_vector<T>::value, T>::type Read() {
177
+ using ELEMENT_TYPE = typename is_unsafe_vector<T>::ELEMENT_TYPE;
178
+ T vec;
179
+ auto size = OnListBegin();
180
+ for (idx_t i = 0; i < size; i++) {
181
+ vec.push_back(Read<ELEMENT_TYPE>());
182
+ }
183
+ OnListEnd();
184
+
185
+ return vec;
186
+ }
187
+
155
188
  // Deserialize a map
156
189
  template <typename T = void>
157
190
  inline typename std::enable_if<is_unordered_map<T>::value, T>::type Read() {
@@ -308,12 +341,24 @@ private:
308
341
  return ReadInterval();
309
342
  }
310
343
 
311
- // Deserialize a interval_t
344
+ // Deserialize a hugeint_t
312
345
  template <typename T = void>
313
346
  inline typename std::enable_if<std::is_same<T, hugeint_t>::value, T>::type Read() {
314
347
  return ReadHugeInt();
315
348
  }
316
349
 
350
+ // Deserialize a LogicalIndex
351
+ template <typename T = void>
352
+ inline typename std::enable_if<std::is_same<T, LogicalIndex>::value, T>::type Read() {
353
+ return LogicalIndex(ReadUnsignedInt64());
354
+ }
355
+
356
+ // Deserialize a PhysicalIndex
357
+ template <typename T = void>
358
+ inline typename std::enable_if<std::is_same<T, PhysicalIndex>::value, T>::type Read() {
359
+ return PhysicalIndex(ReadUnsignedInt64());
360
+ }
361
+
317
362
  protected:
318
363
  virtual void SetTag(const char *tag) {
319
364
  (void)tag;