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
@@ -3,7 +3,7 @@
3
3
 
4
4
  namespace duckdb {
5
5
 
6
- DetachInfo::DetachInfo() {
6
+ DetachInfo::DetachInfo() : ParseInfo(TYPE) {
7
7
  }
8
8
 
9
9
  unique_ptr<DetachInfo> DetachInfo::Copy() const {
@@ -2,7 +2,7 @@
2
2
 
3
3
  namespace duckdb {
4
4
 
5
- DropInfo::DropInfo() : catalog(INVALID_CATALOG), schema(INVALID_SCHEMA), cascade(false) {
5
+ DropInfo::DropInfo() : ParseInfo(TYPE), catalog(INVALID_CATALOG), schema(INVALID_SCHEMA), cascade(false) {
6
6
  }
7
7
 
8
8
  unique_ptr<DropInfo> DropInfo::Copy() const {
@@ -19,24 +19,6 @@ void SampleOptions::Serialize(Serializer &serializer) {
19
19
  writer.Finalize();
20
20
  }
21
21
 
22
- void SampleOptions::FormatSerialize(FormatSerializer &serializer) const {
23
- serializer.WriteProperty("sample_size", sample_size);
24
- serializer.WriteProperty("is_percentage", is_percentage);
25
- serializer.WriteProperty("method", method);
26
- serializer.WriteProperty("seed", seed);
27
- }
28
-
29
- unique_ptr<SampleOptions> SampleOptions::FormatDeserialize(FormatDeserializer &deserializer) {
30
- auto result = make_uniq<SampleOptions>();
31
-
32
- deserializer.ReadProperty("sample_size", result->sample_size);
33
- deserializer.ReadProperty("is_percentage", result->is_percentage);
34
- deserializer.ReadProperty("method", result->method);
35
- deserializer.ReadProperty("seed", result->seed);
36
-
37
- return result;
38
- }
39
-
40
22
  unique_ptr<SampleOptions> SampleOptions::Deserialize(Deserializer &source) {
41
23
  auto result = make_uniq<SampleOptions>();
42
24
 
@@ -3,7 +3,10 @@
3
3
 
4
4
  namespace duckdb {
5
5
 
6
- TransactionInfo::TransactionInfo(TransactionType type) : type(type) {
6
+ TransactionInfo::TransactionInfo() : ParseInfo(TYPE) {
7
+ }
8
+
9
+ TransactionInfo::TransactionInfo(TransactionType type) : ParseInfo(TYPE), type(type) {
7
10
  }
8
11
 
9
12
  void TransactionInfo::Serialize(Serializer &serializer) const {
@@ -3,7 +3,7 @@
3
3
 
4
4
  namespace duckdb {
5
5
 
6
- VacuumInfo::VacuumInfo(VacuumOptions options) : options(options), has_table(false) {
6
+ VacuumInfo::VacuumInfo(VacuumOptions options) : ParseInfo(TYPE), options(options), has_table(false) {
7
7
  }
8
8
 
9
9
  unique_ptr<VacuumInfo> VacuumInfo::Copy() {
@@ -75,16 +75,6 @@ string CommonTableExpressionMap::ToString() const {
75
75
  return result;
76
76
  }
77
77
 
78
- void CommonTableExpressionMap::FormatSerialize(FormatSerializer &serializer) const {
79
- serializer.WriteProperty("map", map);
80
- }
81
-
82
- CommonTableExpressionMap CommonTableExpressionMap::FormatDeserialize(FormatDeserializer &deserializer) {
83
- auto result = CommonTableExpressionMap();
84
- deserializer.ReadProperty("map", result.map);
85
- return result;
86
- }
87
-
88
78
  string QueryNode::ResultModifiersToString() const {
89
79
  string result;
90
80
  for (idx_t modifier_idx = 0; modifier_idx < modifiers.size(); modifier_idx++) {
@@ -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
- tableref->schema_name = stmt.relation->schemaname;
61
+ info->schema = stmt.relation->schemaname;
64
62
  }
65
- info->table = std::move(tableref);
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->delim_types.push_back(col.type);
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 bound_table = Bind(*base.table);
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 result = make_uniq<BoundParameterExpression>(parameter_nr);
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
- // check if we have already deserialized a parameter with this number
82
- auto entry = global_parameter_set.find(parameter_nr);
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
 
@@ -61,10 +61,7 @@ bool BoundWindowExpression::KeysAreCompatible(const BoundWindowExpression &other
61
61
  return false;
62
62
  }
63
63
  for (idx_t i = 0; i < orders.size(); i++) {
64
- if (orders[i].type != other.orders[i].type) {
65
- return false;
66
- }
67
- if (!Expression::Equals(*orders[i].expression, *other.orders[i].expression)) {
64
+ if (!orders[i].Equals(other.orders[i])) {
68
65
  return false;
69
66
  }
70
67
  }
@@ -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
- return;
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(), context);
28
+ auto info = TableCatalogEntry::Deserialize(reader.GetSource());
29
+ auto &table_info = info->Cast<CreateTableInfo>();
24
30
 
25
- auto &table_catalog_entry = Catalog::GetEntry<TableCatalogEntry>(context, info->catalog, info->schema, info->table);
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 == LogicalOperatorType::LOGICAL_COMPARISON_JOIN) {
13
- D_ASSERT(duplicate_eliminated_columns.empty());
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(), context);
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 = catalog.GetEntry<TableCatalogEntry>(context, info->schema, info->table);
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 table_index = reader.ReadRequired<idx_t>();
14
- return unique_ptr<LogicalMaterializedCTE>(new LogicalMaterializedCTE(table_index));
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 {