duckdb 0.8.2-dev1968.0 → 0.8.2-dev2068.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 (213) hide show
  1. package/configure.py +7 -2
  2. package/package.json +1 -1
  3. package/src/duckdb/src/catalog/catalog.cpp +1 -1
  4. package/src/duckdb/src/catalog/catalog_entry/index_catalog_entry.cpp +17 -41
  5. package/src/duckdb/src/catalog/catalog_entry/macro_catalog_entry.cpp +2 -10
  6. package/src/duckdb/src/catalog/catalog_entry/schema_catalog_entry.cpp +4 -14
  7. package/src/duckdb/src/catalog/catalog_entry/sequence_catalog_entry.cpp +11 -28
  8. package/src/duckdb/src/catalog/catalog_entry/table_catalog_entry.cpp +11 -38
  9. package/src/duckdb/src/catalog/catalog_entry/view_catalog_entry.cpp +11 -27
  10. package/src/duckdb/src/catalog/catalog_entry.cpp +25 -1
  11. package/src/duckdb/src/common/adbc/adbc.cpp +18 -4
  12. package/src/duckdb/src/common/enum_util.cpp +159 -0
  13. package/src/duckdb/src/common/extra_type_info.cpp +1 -2
  14. package/src/duckdb/src/common/serializer/binary_deserializer.cpp +3 -0
  15. package/src/duckdb/src/common/serializer/binary_serializer.cpp +4 -4
  16. package/src/duckdb/src/common/types/column/column_data_collection.cpp +43 -0
  17. package/src/duckdb/src/common/types/vector.cpp +1 -1
  18. package/src/duckdb/src/common/types.cpp +0 -12
  19. package/src/duckdb/src/execution/physical_plan/plan_comparison_join.cpp +1 -1
  20. package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
  21. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/index_catalog_entry.hpp +1 -2
  22. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/macro_catalog_entry.hpp +1 -4
  23. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/schema_catalog_entry.hpp +2 -5
  24. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/sequence_catalog_entry.hpp +1 -6
  25. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_catalog_entry.hpp +2 -11
  26. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/view_catalog_entry.hpp +2 -5
  27. package/src/duckdb/src/include/duckdb/catalog/catalog_entry.hpp +14 -0
  28. package/src/duckdb/src/include/duckdb/common/assert.hpp +1 -1
  29. package/src/duckdb/src/include/duckdb/common/constants.hpp +2 -0
  30. package/src/duckdb/src/include/duckdb/common/enum_util.hpp +32 -0
  31. package/src/duckdb/src/include/duckdb/common/enums/index_type.hpp +1 -1
  32. package/src/duckdb/src/include/duckdb/common/index_vector.hpp +12 -0
  33. package/src/duckdb/src/include/duckdb/common/serializer/binary_deserializer.hpp +28 -4
  34. package/src/duckdb/src/include/duckdb/common/serializer/binary_serializer.hpp +12 -5
  35. package/src/duckdb/src/include/duckdb/common/serializer/deserialization_data.hpp +110 -0
  36. package/src/duckdb/src/include/duckdb/common/serializer/format_deserializer.hpp +46 -1
  37. package/src/duckdb/src/include/duckdb/common/serializer/format_serializer.hpp +23 -21
  38. package/src/duckdb/src/include/duckdb/common/serializer/serialization_traits.hpp +12 -4
  39. package/src/duckdb/src/include/duckdb/common/types/column/column_data_collection.hpp +3 -0
  40. package/src/duckdb/src/include/duckdb/core_functions/scalar/math_functions.hpp +3 -3
  41. package/src/duckdb/src/include/duckdb/function/macro_function.hpp +3 -0
  42. package/src/duckdb/src/include/duckdb/function/scalar_macro_function.hpp +3 -0
  43. package/src/duckdb/src/include/duckdb/function/table_macro_function.hpp +3 -0
  44. package/src/duckdb/src/include/duckdb/parser/column_definition.hpp +6 -5
  45. package/src/duckdb/src/include/duckdb/parser/column_list.hpp +4 -0
  46. package/src/duckdb/src/include/duckdb/parser/constraint.hpp +5 -0
  47. package/src/duckdb/src/include/duckdb/parser/constraints/check_constraint.hpp +3 -0
  48. package/src/duckdb/src/include/duckdb/parser/constraints/foreign_key_constraint.hpp +6 -0
  49. package/src/duckdb/src/include/duckdb/parser/constraints/not_null_constraint.hpp +3 -0
  50. package/src/duckdb/src/include/duckdb/parser/constraints/unique_constraint.hpp +6 -0
  51. package/src/duckdb/src/include/duckdb/parser/expression/between_expression.hpp +1 -1
  52. package/src/duckdb/src/include/duckdb/parser/expression/case_expression.hpp +1 -1
  53. package/src/duckdb/src/include/duckdb/parser/expression/cast_expression.hpp +1 -1
  54. package/src/duckdb/src/include/duckdb/parser/expression/collate_expression.hpp +1 -1
  55. package/src/duckdb/src/include/duckdb/parser/expression/columnref_expression.hpp +1 -1
  56. package/src/duckdb/src/include/duckdb/parser/expression/comparison_expression.hpp +1 -1
  57. package/src/duckdb/src/include/duckdb/parser/expression/conjunction_expression.hpp +1 -1
  58. package/src/duckdb/src/include/duckdb/parser/expression/constant_expression.hpp +1 -1
  59. package/src/duckdb/src/include/duckdb/parser/expression/default_expression.hpp +1 -1
  60. package/src/duckdb/src/include/duckdb/parser/expression/function_expression.hpp +1 -1
  61. package/src/duckdb/src/include/duckdb/parser/expression/lambda_expression.hpp +1 -1
  62. package/src/duckdb/src/include/duckdb/parser/expression/operator_expression.hpp +1 -1
  63. package/src/duckdb/src/include/duckdb/parser/expression/parameter_expression.hpp +1 -1
  64. package/src/duckdb/src/include/duckdb/parser/expression/positional_reference_expression.hpp +1 -1
  65. package/src/duckdb/src/include/duckdb/parser/expression/star_expression.hpp +1 -1
  66. package/src/duckdb/src/include/duckdb/parser/expression/subquery_expression.hpp +1 -1
  67. package/src/duckdb/src/include/duckdb/parser/expression/window_expression.hpp +1 -1
  68. package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_info.hpp +12 -1
  69. package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_table_info.hpp +66 -2
  70. package/src/duckdb/src/include/duckdb/parser/parsed_data/attach_info.hpp +8 -1
  71. package/src/duckdb/src/include/duckdb/parser/parsed_data/copy_info.hpp +8 -1
  72. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_index_info.hpp +4 -1
  73. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_info.hpp +9 -2
  74. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_macro_info.hpp +3 -0
  75. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_schema_info.hpp +3 -0
  76. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_sequence_info.hpp +3 -0
  77. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_table_info.hpp +3 -0
  78. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_type_info.hpp +3 -0
  79. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_view_info.hpp +3 -0
  80. package/src/duckdb/src/include/duckdb/parser/parsed_data/detach_info.hpp +7 -0
  81. package/src/duckdb/src/include/duckdb/parser/parsed_data/drop_info.hpp +7 -0
  82. package/src/duckdb/src/include/duckdb/parser/parsed_data/exported_table_data.hpp +7 -0
  83. package/src/duckdb/src/include/duckdb/parser/parsed_data/load_info.hpp +13 -3
  84. package/src/duckdb/src/include/duckdb/parser/parsed_data/parse_info.hpp +22 -0
  85. package/src/duckdb/src/include/duckdb/parser/parsed_data/pragma_info.hpp +10 -0
  86. package/src/duckdb/src/include/duckdb/parser/parsed_data/show_select_info.hpp +7 -0
  87. package/src/duckdb/src/include/duckdb/parser/parsed_data/transaction_info.hpp +10 -0
  88. package/src/duckdb/src/include/duckdb/parser/parsed_data/vacuum_info.hpp +10 -0
  89. package/src/duckdb/src/include/duckdb/planner/bound_constraint.hpp +0 -8
  90. package/src/duckdb/src/include/duckdb/planner/bound_result_modifier.hpp +6 -0
  91. package/src/duckdb/src/include/duckdb/planner/column_binding.hpp +5 -0
  92. package/src/duckdb/src/include/duckdb/planner/expression/bound_between_expression.hpp +6 -0
  93. package/src/duckdb/src/include/duckdb/planner/expression/bound_case_expression.hpp +6 -0
  94. package/src/duckdb/src/include/duckdb/planner/expression/bound_cast_expression.hpp +6 -0
  95. package/src/duckdb/src/include/duckdb/planner/expression/bound_columnref_expression.hpp +3 -0
  96. package/src/duckdb/src/include/duckdb/planner/expression/bound_comparison_expression.hpp +3 -0
  97. package/src/duckdb/src/include/duckdb/planner/expression/bound_conjunction_expression.hpp +3 -0
  98. package/src/duckdb/src/include/duckdb/planner/expression/bound_constant_expression.hpp +3 -0
  99. package/src/duckdb/src/include/duckdb/planner/expression/bound_default_expression.hpp +3 -0
  100. package/src/duckdb/src/include/duckdb/planner/expression/bound_lambda_expression.hpp +3 -1
  101. package/src/duckdb/src/include/duckdb/planner/expression/bound_lambdaref_expression.hpp +3 -0
  102. package/src/duckdb/src/include/duckdb/planner/expression/bound_operator_expression.hpp +3 -0
  103. package/src/duckdb/src/include/duckdb/planner/expression/bound_parameter_data.hpp +5 -2
  104. package/src/duckdb/src/include/duckdb/planner/expression/bound_parameter_expression.hpp +7 -0
  105. package/src/duckdb/src/include/duckdb/planner/expression/bound_reference_expression.hpp +3 -0
  106. package/src/duckdb/src/include/duckdb/planner/expression/bound_unnest_expression.hpp +3 -0
  107. package/src/duckdb/src/include/duckdb/planner/expression/list.hpp +1 -0
  108. package/src/duckdb/src/include/duckdb/planner/expression.hpp +3 -0
  109. package/src/duckdb/src/include/duckdb/planner/joinside.hpp +3 -0
  110. package/src/duckdb/src/include/duckdb/planner/logical_operator.hpp +3 -0
  111. package/src/duckdb/src/include/duckdb/planner/operator/logical_aggregate.hpp +3 -0
  112. package/src/duckdb/src/include/duckdb/planner/operator/logical_any_join.hpp +3 -0
  113. package/src/duckdb/src/include/duckdb/planner/operator/logical_column_data_get.hpp +4 -0
  114. package/src/duckdb/src/include/duckdb/planner/operator/logical_comparison_join.hpp +9 -2
  115. package/src/duckdb/src/include/duckdb/planner/operator/logical_create.hpp +9 -6
  116. package/src/duckdb/src/include/duckdb/planner/operator/logical_create_index.hpp +2 -16
  117. package/src/duckdb/src/include/duckdb/planner/operator/logical_create_table.hpp +10 -6
  118. package/src/duckdb/src/include/duckdb/planner/operator/logical_cross_product.hpp +3 -0
  119. package/src/duckdb/src/include/duckdb/planner/operator/logical_cteref.hpp +2 -0
  120. package/src/duckdb/src/include/duckdb/planner/operator/logical_delete.hpp +7 -0
  121. package/src/duckdb/src/include/duckdb/planner/operator/logical_delim_get.hpp +3 -0
  122. package/src/duckdb/src/include/duckdb/planner/operator/logical_distinct.hpp +6 -10
  123. package/src/duckdb/src/include/duckdb/planner/operator/logical_dummy_scan.hpp +2 -0
  124. package/src/duckdb/src/include/duckdb/planner/operator/logical_empty_result.hpp +2 -0
  125. package/src/duckdb/src/include/duckdb/planner/operator/logical_explain.hpp +4 -0
  126. package/src/duckdb/src/include/duckdb/planner/operator/logical_expression_get.hpp +3 -0
  127. package/src/duckdb/src/include/duckdb/planner/operator/logical_filter.hpp +3 -0
  128. package/src/duckdb/src/include/duckdb/planner/operator/logical_insert.hpp +6 -0
  129. package/src/duckdb/src/include/duckdb/planner/operator/logical_limit.hpp +3 -0
  130. package/src/duckdb/src/include/duckdb/planner/operator/logical_limit_percent.hpp +3 -0
  131. package/src/duckdb/src/include/duckdb/planner/operator/logical_materialized_cte.hpp +5 -2
  132. package/src/duckdb/src/include/duckdb/planner/operator/logical_order.hpp +7 -35
  133. package/src/duckdb/src/include/duckdb/planner/operator/logical_pivot.hpp +6 -0
  134. package/src/duckdb/src/include/duckdb/planner/operator/logical_positional_join.hpp +3 -0
  135. package/src/duckdb/src/include/duckdb/planner/operator/logical_projection.hpp +3 -0
  136. package/src/duckdb/src/include/duckdb/planner/operator/logical_recursive_cte.hpp +5 -3
  137. package/src/duckdb/src/include/duckdb/planner/operator/logical_reset.hpp +4 -0
  138. package/src/duckdb/src/include/duckdb/planner/operator/logical_sample.hpp +6 -0
  139. package/src/duckdb/src/include/duckdb/planner/operator/logical_set.hpp +4 -0
  140. package/src/duckdb/src/include/duckdb/planner/operator/logical_set_operation.hpp +4 -0
  141. package/src/duckdb/src/include/duckdb/planner/operator/logical_show.hpp +3 -0
  142. package/src/duckdb/src/include/duckdb/planner/operator/logical_simple.hpp +3 -0
  143. package/src/duckdb/src/include/duckdb/planner/operator/logical_top_n.hpp +4 -0
  144. package/src/duckdb/src/include/duckdb/planner/operator/logical_unnest.hpp +2 -0
  145. package/src/duckdb/src/include/duckdb/planner/operator/logical_update.hpp +6 -0
  146. package/src/duckdb/src/include/duckdb/planner/operator/logical_window.hpp +3 -0
  147. package/src/duckdb/src/include/duckdb/planner/tableref/bound_pivotref.hpp +3 -0
  148. package/src/duckdb/src/optimizer/deliminator.cpp +5 -3
  149. package/src/duckdb/src/parser/column_definition.cpp +20 -32
  150. package/src/duckdb/src/parser/column_list.cpp +8 -0
  151. package/src/duckdb/src/parser/constraints/foreign_key_constraint.cpp +3 -0
  152. package/src/duckdb/src/parser/constraints/unique_constraint.cpp +3 -0
  153. package/src/duckdb/src/parser/expression/case_expression.cpp +0 -12
  154. package/src/duckdb/src/parser/parsed_data/alter_info.cpp +5 -2
  155. package/src/duckdb/src/parser/parsed_data/alter_table_info.cpp +38 -0
  156. package/src/duckdb/src/parser/parsed_data/create_index_info.cpp +3 -1
  157. package/src/duckdb/src/parser/parsed_data/create_sequence_info.cpp +2 -0
  158. package/src/duckdb/src/parser/parsed_data/detach_info.cpp +1 -1
  159. package/src/duckdb/src/parser/parsed_data/drop_info.cpp +1 -1
  160. package/src/duckdb/src/parser/parsed_data/sample_options.cpp +0 -18
  161. package/src/duckdb/src/parser/parsed_data/transaction_info.cpp +4 -1
  162. package/src/duckdb/src/parser/parsed_data/vacuum_info.cpp +1 -1
  163. package/src/duckdb/src/parser/query_node.cpp +0 -10
  164. package/src/duckdb/src/parser/result_modifier.cpp +0 -13
  165. package/src/duckdb/src/parser/statement/select_statement.cpp +0 -10
  166. package/src/duckdb/src/parser/tableref/pivotref.cpp +0 -16
  167. package/src/duckdb/src/parser/transform/statement/transform_create_index.cpp +5 -4
  168. package/src/duckdb/src/planner/binder/query_node/plan_subquery.cpp +1 -1
  169. package/src/duckdb/src/planner/binder/statement/bind_create.cpp +6 -1
  170. package/src/duckdb/src/planner/expression/bound_between_expression.cpp +4 -0
  171. package/src/duckdb/src/planner/expression/bound_cast_expression.cpp +13 -6
  172. package/src/duckdb/src/planner/expression/bound_parameter_expression.cpp +20 -12
  173. package/src/duckdb/src/planner/expression/bound_window_expression.cpp +1 -4
  174. package/src/duckdb/src/planner/logical_operator.cpp +13 -1
  175. package/src/duckdb/src/planner/operator/logical_comparison_join.cpp +16 -2
  176. package/src/duckdb/src/planner/operator/logical_create.cpp +14 -0
  177. package/src/duckdb/src/planner/operator/logical_create_index.cpp +20 -0
  178. package/src/duckdb/src/planner/operator/logical_create_table.cpp +16 -0
  179. package/src/duckdb/src/planner/operator/logical_delete.cpp +9 -2
  180. package/src/duckdb/src/planner/operator/logical_delim_join.cpp +2 -4
  181. package/src/duckdb/src/planner/operator/logical_distinct.cpp +13 -0
  182. package/src/duckdb/src/planner/operator/logical_explain.cpp +1 -1
  183. package/src/duckdb/src/planner/operator/logical_insert.cpp +8 -2
  184. package/src/duckdb/src/planner/operator/logical_materialized_cte.cpp +3 -2
  185. package/src/duckdb/src/planner/operator/logical_order.cpp +39 -0
  186. package/src/duckdb/src/planner/operator/logical_pivot.cpp +3 -0
  187. package/src/duckdb/src/planner/operator/logical_recursive_cte.cpp +5 -5
  188. package/src/duckdb/src/planner/operator/logical_sample.cpp +3 -0
  189. package/src/duckdb/src/planner/operator/logical_update.cpp +8 -2
  190. package/src/duckdb/src/planner/parsed_data/bound_create_table_info.cpp +4 -2
  191. package/src/duckdb/src/planner/planner.cpp +11 -0
  192. package/src/duckdb/src/storage/checkpoint_manager.cpp +23 -23
  193. package/src/duckdb/src/storage/serialization/serialize_constraint.cpp +98 -0
  194. package/src/duckdb/src/storage/serialization/serialize_create_info.cpp +188 -0
  195. package/src/duckdb/src/storage/serialization/serialize_expression.cpp +274 -0
  196. package/src/duckdb/src/storage/serialization/serialize_logical_operator.cpp +729 -0
  197. package/src/duckdb/src/storage/serialization/serialize_macro_function.cpp +62 -0
  198. package/src/duckdb/src/storage/serialization/serialize_nodes.cpp +242 -0
  199. package/src/duckdb/src/storage/serialization/serialize_parse_info.cpp +419 -0
  200. package/src/duckdb/src/storage/serialization/serialize_parsed_expression.cpp +40 -38
  201. package/src/duckdb/src/storage/serialization/serialize_query_node.cpp +36 -36
  202. package/src/duckdb/src/storage/serialization/serialize_result_modifier.cpp +25 -14
  203. package/src/duckdb/src/storage/serialization/serialize_statement.cpp +22 -0
  204. package/src/duckdb/src/storage/serialization/serialize_tableref.cpp +47 -47
  205. package/src/duckdb/src/storage/serialization/serialize_types.cpp +25 -25
  206. package/src/duckdb/src/storage/storage_info.cpp +3 -2
  207. package/src/duckdb/src/storage/wal_replay.cpp +20 -19
  208. package/src/duckdb/third_party/concurrentqueue/lightweightsemaphore.h +3 -76
  209. package/src/duckdb/third_party/libpg_query/pg_functions.cpp +13 -0
  210. package/src/duckdb/third_party/libpg_query/src_backend_parser_scansup.cpp +9 -0
  211. package/src/duckdb/ub_src_parser.cpp +0 -2
  212. package/src/duckdb/ub_src_storage_serialization.cpp +16 -0
  213. package/src/duckdb/src/parser/common_table_expression_info.cpp +0 -21
@@ -321,7 +321,6 @@ struct EnumTypeInfoTemplated : public EnumTypeInfo {
321
321
  }
322
322
 
323
323
  static shared_ptr<EnumTypeInfoTemplated> Deserialize(FieldReader &reader, uint32_t size, string enum_name) {
324
-
325
324
  Vector values_insert_order(LogicalType::VARCHAR, size);
326
325
  values_insert_order.Deserialize(size, reader.GetSource());
327
326
  return make_shared<EnumTypeInfoTemplated>(std::move(enum_name), values_insert_order, size);
@@ -451,7 +450,7 @@ shared_ptr<ExtraTypeInfo> EnumTypeInfo::Deserialize(FieldReader &reader) {
451
450
  }
452
451
 
453
452
  shared_ptr<ExtraTypeInfo> EnumTypeInfo::FormatDeserialize(FormatDeserializer &deserializer) {
454
- auto enum_size = deserializer.ReadProperty<uint32_t>("enum_size");
453
+ auto enum_size = deserializer.ReadProperty<idx_t>("enum_size");
455
454
  auto enum_internal_type = EnumTypeInfo::DictType(enum_size);
456
455
  switch (enum_internal_type) {
457
456
  case PhysicalType::UINT8:
@@ -5,6 +5,9 @@ namespace duckdb {
5
5
  void BinaryDeserializer::SetTag(const char *tag) {
6
6
  current_tag = tag;
7
7
  stack.back().read_field_count++;
8
+ if (stack.back().read_field_count > stack.back().expected_field_count) {
9
+ throw SerializationException("Attempting to read a required field, but field is missing");
10
+ }
8
11
  }
9
12
 
10
13
  //===--------------------------------------------------------------------===//
@@ -129,7 +129,7 @@ void BinarySerializer::WriteValue(const string &value) {
129
129
  auto len = value.length();
130
130
  Write<uint32_t>((uint32_t)len);
131
131
  if (len > 0) {
132
- WriteData(value.c_str(), len);
132
+ WriteDataInternal(value.c_str(), len);
133
133
  }
134
134
  }
135
135
 
@@ -137,7 +137,7 @@ void BinarySerializer::WriteValue(const string_t value) {
137
137
  auto len = value.GetSize();
138
138
  Write<uint32_t>((uint32_t)len);
139
139
  if (len > 0) {
140
- WriteData(value.GetDataUnsafe(), len);
140
+ WriteDataInternal(value.GetDataUnsafe(), len);
141
141
  }
142
142
  }
143
143
 
@@ -145,7 +145,7 @@ void BinarySerializer::WriteValue(const char *value) {
145
145
  auto len = strlen(value);
146
146
  Write<uint32_t>((uint32_t)len);
147
147
  if (len > 0) {
148
- WriteData(value, len);
148
+ WriteDataInternal(value, len);
149
149
  }
150
150
  }
151
151
 
@@ -154,7 +154,7 @@ void BinarySerializer::WriteValue(bool value) {
154
154
  }
155
155
 
156
156
  void BinarySerializer::WriteDataPtr(const_data_ptr_t ptr, idx_t count) {
157
- WriteData(ptr, count);
157
+ WriteDataInternal(ptr, count);
158
158
  }
159
159
 
160
160
  } // namespace duckdb
@@ -6,6 +6,8 @@
6
6
  #include "duckdb/common/types/value_map.hpp"
7
7
  #include "duckdb/common/vector_operations/vector_operations.hpp"
8
8
  #include "duckdb/storage/buffer_manager.hpp"
9
+ #include "duckdb/common/serializer/format_serializer.hpp"
10
+ #include "duckdb/common/serializer/format_deserializer.hpp"
9
11
 
10
12
  namespace duckdb {
11
13
 
@@ -1057,4 +1059,45 @@ const vector<unique_ptr<ColumnDataCollectionSegment>> &ColumnDataCollection::Get
1057
1059
  return segments;
1058
1060
  }
1059
1061
 
1062
+ void ColumnDataCollection::FormatSerialize(FormatSerializer &serializer) const {
1063
+ vector<vector<Value>> values;
1064
+ values.resize(ColumnCount());
1065
+ for (auto &chunk : Chunks()) {
1066
+ for (idx_t c = 0; c < chunk.ColumnCount(); c++) {
1067
+ for (idx_t r = 0; r < chunk.size(); r++) {
1068
+ values[c].push_back(chunk.GetValue(c, r));
1069
+ }
1070
+ }
1071
+ }
1072
+ serializer.WriteProperty("types", types);
1073
+ serializer.WriteProperty("values", values);
1074
+ }
1075
+
1076
+ unique_ptr<ColumnDataCollection> ColumnDataCollection::FormatDeserialize(FormatDeserializer &deserializer) {
1077
+ auto types = deserializer.ReadProperty<vector<LogicalType>>("types");
1078
+ auto values = deserializer.ReadProperty<vector<vector<Value>>>("values");
1079
+
1080
+ auto collection = make_uniq<ColumnDataCollection>(Allocator::DefaultAllocator(), types);
1081
+ if (values.empty()) {
1082
+ return collection;
1083
+ }
1084
+ DataChunk chunk;
1085
+ chunk.Initialize(Allocator::DefaultAllocator(), types);
1086
+
1087
+ for (idx_t r = 0; r < values[0].size(); r++) {
1088
+ for (idx_t c = 0; c < types.size(); c++) {
1089
+ chunk.SetValue(c, chunk.size(), values[c][r]);
1090
+ }
1091
+ chunk.SetCardinality(chunk.size() + 1);
1092
+ if (chunk.size() == STANDARD_VECTOR_SIZE) {
1093
+ collection->Append(chunk);
1094
+ chunk.Reset();
1095
+ }
1096
+ }
1097
+ if (chunk.size() > 0) {
1098
+ collection->Append(chunk);
1099
+ }
1100
+ return collection;
1101
+ }
1102
+
1060
1103
  } // namespace duckdb
@@ -977,7 +977,7 @@ void Vector::FormatSerialize(FormatSerializer &serializer, idx_t count) {
977
977
  UnifiedVectorFormat vdata;
978
978
  ToUnifiedFormat(count, vdata);
979
979
 
980
- const auto all_valid = (count > 0) && !vdata.validity.AllValid();
980
+ const bool all_valid = (count > 0) && !vdata.validity.AllValid();
981
981
  serializer.WriteProperty("all_valid", all_valid);
982
982
  if (all_valid) {
983
983
  ValidityMask flat_mask(count);
@@ -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-dev2068"
3
3
  #endif
4
4
  #ifndef DUCKDB_SOURCE_ID
5
- #define DUCKDB_SOURCE_ID "b1d5e20f31"
5
+ #define DUCKDB_SOURCE_ID "83481168e0"
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() {
@@ -10,7 +10,7 @@
10
10
 
11
11
  #pragma once
12
12
 
13
- #if (defined(DUCKDB_USE_STANDARD_ASSERT) || !defined(DEBUG)) && !defined(DUCKDB_FORCE_ASSERT)
13
+ #if (defined(DUCKDB_USE_STANDARD_ASSERT) || !defined(DEBUG)) && !defined(DUCKDB_FORCE_ASSERT) && !defined(__MVS__)
14
14
 
15
15
  #include <assert.h>
16
16
  #define D_ASSERT assert
@@ -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() {