duckdb 0.8.2-dev1862.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 (283) hide show
  1. package/binding.gyp +9 -9
  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/enum_util.cpp +187 -0
  12. package/src/duckdb/src/common/extra_type_info.cpp +1 -2
  13. package/src/duckdb/src/common/serializer/binary_deserializer.cpp +3 -0
  14. package/src/duckdb/src/common/serializer/binary_serializer.cpp +4 -4
  15. package/src/duckdb/src/common/types/column/column_data_collection.cpp +43 -0
  16. package/src/duckdb/src/common/types/hugeint.cpp +40 -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/core_functions/function_list.cpp +1 -0
  20. package/src/duckdb/src/core_functions/scalar/string/to_base.cpp +66 -0
  21. package/src/duckdb/src/execution/operator/aggregate/physical_hash_aggregate.cpp +14 -11
  22. package/src/duckdb/src/execution/operator/aggregate/physical_perfecthash_aggregate.cpp +6 -4
  23. package/src/duckdb/src/execution/operator/aggregate/physical_ungrouped_aggregate.cpp +14 -12
  24. package/src/duckdb/src/execution/operator/aggregate/physical_window.cpp +6 -4
  25. package/src/duckdb/src/execution/operator/helper/physical_batch_collector.cpp +8 -6
  26. package/src/duckdb/src/execution/operator/helper/physical_explain_analyze.cpp +2 -2
  27. package/src/duckdb/src/execution/operator/helper/physical_limit.cpp +5 -3
  28. package/src/duckdb/src/execution/operator/helper/physical_materialized_collector.cpp +7 -5
  29. package/src/duckdb/src/execution/operator/helper/physical_vacuum.cpp +7 -5
  30. package/src/duckdb/src/execution/operator/join/physical_asof_join.cpp +5 -4
  31. package/src/duckdb/src/execution/operator/join/physical_blockwise_nl_join.cpp +2 -2
  32. package/src/duckdb/src/execution/operator/join/physical_delim_join.cpp +13 -6
  33. package/src/duckdb/src/execution/operator/join/physical_hash_join.cpp +7 -5
  34. package/src/duckdb/src/execution/operator/join/physical_iejoin.cpp +7 -5
  35. package/src/duckdb/src/execution/operator/join/physical_nested_loop_join.cpp +7 -4
  36. package/src/duckdb/src/execution/operator/join/physical_piecewise_merge_join.cpp +8 -6
  37. package/src/duckdb/src/execution/operator/order/physical_order.cpp +7 -5
  38. package/src/duckdb/src/execution/operator/order/physical_top_n.cpp +7 -5
  39. package/src/duckdb/src/execution/operator/persistent/physical_batch_copy_to_file.cpp +8 -6
  40. package/src/duckdb/src/execution/operator/persistent/physical_batch_insert.cpp +8 -7
  41. package/src/duckdb/src/execution/operator/persistent/physical_copy_to_file.cpp +8 -6
  42. package/src/duckdb/src/execution/operator/persistent/physical_fixed_batch_copy.cpp +11 -9
  43. package/src/duckdb/src/execution/operator/persistent/physical_insert.cpp +10 -10
  44. package/src/duckdb/src/execution/operator/persistent/physical_update.cpp +4 -2
  45. package/src/duckdb/src/execution/operator/schema/physical_create_index.cpp +7 -6
  46. package/src/duckdb/src/execution/physical_operator.cpp +3 -2
  47. package/src/duckdb/src/execution/physical_plan/plan_comparison_join.cpp +1 -1
  48. package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
  49. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/index_catalog_entry.hpp +1 -2
  50. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/macro_catalog_entry.hpp +1 -4
  51. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/schema_catalog_entry.hpp +2 -5
  52. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/sequence_catalog_entry.hpp +1 -6
  53. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_catalog_entry.hpp +2 -11
  54. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/view_catalog_entry.hpp +2 -5
  55. package/src/duckdb/src/include/duckdb/catalog/catalog_entry.hpp +14 -0
  56. package/src/duckdb/src/include/duckdb/common/bitpacking.hpp +70 -55
  57. package/src/duckdb/src/include/duckdb/common/constants.hpp +2 -0
  58. package/src/duckdb/src/include/duckdb/common/enum_util.hpp +40 -0
  59. package/src/duckdb/src/include/duckdb/common/enums/index_type.hpp +1 -1
  60. package/src/duckdb/src/include/duckdb/common/enums/operator_result_type.hpp +5 -1
  61. package/src/duckdb/src/include/duckdb/common/hugeint.hpp +15 -0
  62. package/src/duckdb/src/include/duckdb/common/index_vector.hpp +12 -0
  63. package/src/duckdb/src/include/duckdb/common/limits.hpp +52 -149
  64. package/src/duckdb/src/include/duckdb/common/numeric_utils.hpp +48 -0
  65. package/src/duckdb/src/include/duckdb/common/serializer/binary_deserializer.hpp +28 -4
  66. package/src/duckdb/src/include/duckdb/common/serializer/binary_serializer.hpp +12 -5
  67. package/src/duckdb/src/include/duckdb/common/serializer/deserialization_data.hpp +110 -0
  68. package/src/duckdb/src/include/duckdb/common/serializer/format_deserializer.hpp +46 -1
  69. package/src/duckdb/src/include/duckdb/common/serializer/format_serializer.hpp +23 -21
  70. package/src/duckdb/src/include/duckdb/common/serializer/serialization_traits.hpp +12 -4
  71. package/src/duckdb/src/include/duckdb/common/types/column/column_data_collection.hpp +3 -0
  72. package/src/duckdb/src/include/duckdb/core_functions/aggregate/distributive_functions.hpp +1 -1
  73. package/src/duckdb/src/include/duckdb/core_functions/scalar/operators_functions.hpp +1 -1
  74. package/src/duckdb/src/include/duckdb/core_functions/scalar/string_functions.hpp +9 -0
  75. package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_hash_aggregate.hpp +3 -3
  76. package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_perfecthash_aggregate.hpp +1 -1
  77. package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_ungrouped_aggregate.hpp +3 -3
  78. package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_window.hpp +2 -2
  79. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_batch_collector.hpp +2 -2
  80. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_explain_analyze.hpp +1 -1
  81. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_limit.hpp +1 -1
  82. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_materialized_collector.hpp +1 -1
  83. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_vacuum.hpp +2 -2
  84. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_asof_join.hpp +2 -2
  85. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_blockwise_nl_join.hpp +1 -1
  86. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_delim_join.hpp +2 -2
  87. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_hash_join.hpp +2 -2
  88. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_iejoin.hpp +2 -2
  89. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_nested_loop_join.hpp +2 -2
  90. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_piecewise_merge_join.hpp +2 -2
  91. package/src/duckdb/src/include/duckdb/execution/operator/order/physical_order.hpp +2 -2
  92. package/src/duckdb/src/include/duckdb/execution/operator/order/physical_top_n.hpp +2 -2
  93. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_batch_copy_to_file.hpp +2 -2
  94. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_batch_insert.hpp +2 -2
  95. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_copy_to_file.hpp +2 -2
  96. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_fixed_batch_copy.hpp +2 -2
  97. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_insert.hpp +2 -2
  98. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_update.hpp +1 -1
  99. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_index.hpp +2 -2
  100. package/src/duckdb/src/include/duckdb/execution/physical_operator.hpp +3 -3
  101. package/src/duckdb/src/include/duckdb/execution/physical_operator_states.hpp +11 -0
  102. package/src/duckdb/src/include/duckdb/function/macro_function.hpp +3 -0
  103. package/src/duckdb/src/include/duckdb/function/scalar_macro_function.hpp +3 -0
  104. package/src/duckdb/src/include/duckdb/function/table_macro_function.hpp +3 -0
  105. package/src/duckdb/src/include/duckdb/main/extension_entries.hpp +3 -0
  106. package/src/duckdb/src/include/duckdb/parallel/pipeline.hpp +0 -3
  107. package/src/duckdb/src/include/duckdb/parallel/pipeline_executor.hpp +3 -2
  108. package/src/duckdb/src/include/duckdb/parser/column_definition.hpp +6 -5
  109. package/src/duckdb/src/include/duckdb/parser/column_list.hpp +4 -0
  110. package/src/duckdb/src/include/duckdb/parser/constraint.hpp +5 -0
  111. package/src/duckdb/src/include/duckdb/parser/constraints/check_constraint.hpp +3 -0
  112. package/src/duckdb/src/include/duckdb/parser/constraints/foreign_key_constraint.hpp +6 -0
  113. package/src/duckdb/src/include/duckdb/parser/constraints/not_null_constraint.hpp +3 -0
  114. package/src/duckdb/src/include/duckdb/parser/constraints/unique_constraint.hpp +6 -0
  115. package/src/duckdb/src/include/duckdb/parser/expression/between_expression.hpp +1 -1
  116. package/src/duckdb/src/include/duckdb/parser/expression/case_expression.hpp +1 -1
  117. package/src/duckdb/src/include/duckdb/parser/expression/cast_expression.hpp +1 -1
  118. package/src/duckdb/src/include/duckdb/parser/expression/collate_expression.hpp +1 -1
  119. package/src/duckdb/src/include/duckdb/parser/expression/columnref_expression.hpp +1 -1
  120. package/src/duckdb/src/include/duckdb/parser/expression/comparison_expression.hpp +1 -1
  121. package/src/duckdb/src/include/duckdb/parser/expression/conjunction_expression.hpp +1 -1
  122. package/src/duckdb/src/include/duckdb/parser/expression/constant_expression.hpp +1 -1
  123. package/src/duckdb/src/include/duckdb/parser/expression/default_expression.hpp +1 -1
  124. package/src/duckdb/src/include/duckdb/parser/expression/function_expression.hpp +1 -1
  125. package/src/duckdb/src/include/duckdb/parser/expression/lambda_expression.hpp +1 -1
  126. package/src/duckdb/src/include/duckdb/parser/expression/operator_expression.hpp +1 -1
  127. package/src/duckdb/src/include/duckdb/parser/expression/parameter_expression.hpp +1 -1
  128. package/src/duckdb/src/include/duckdb/parser/expression/positional_reference_expression.hpp +1 -1
  129. package/src/duckdb/src/include/duckdb/parser/expression/star_expression.hpp +1 -1
  130. package/src/duckdb/src/include/duckdb/parser/expression/subquery_expression.hpp +1 -1
  131. package/src/duckdb/src/include/duckdb/parser/expression/window_expression.hpp +1 -1
  132. package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_info.hpp +12 -1
  133. package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_table_info.hpp +66 -2
  134. package/src/duckdb/src/include/duckdb/parser/parsed_data/attach_info.hpp +8 -1
  135. package/src/duckdb/src/include/duckdb/parser/parsed_data/copy_info.hpp +8 -1
  136. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_index_info.hpp +4 -1
  137. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_info.hpp +9 -2
  138. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_macro_info.hpp +3 -0
  139. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_schema_info.hpp +3 -0
  140. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_sequence_info.hpp +3 -0
  141. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_table_info.hpp +3 -0
  142. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_type_info.hpp +3 -0
  143. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_view_info.hpp +3 -0
  144. package/src/duckdb/src/include/duckdb/parser/parsed_data/detach_info.hpp +7 -0
  145. package/src/duckdb/src/include/duckdb/parser/parsed_data/drop_info.hpp +7 -0
  146. package/src/duckdb/src/include/duckdb/parser/parsed_data/exported_table_data.hpp +7 -0
  147. package/src/duckdb/src/include/duckdb/parser/parsed_data/load_info.hpp +13 -3
  148. package/src/duckdb/src/include/duckdb/parser/parsed_data/parse_info.hpp +22 -0
  149. package/src/duckdb/src/include/duckdb/parser/parsed_data/pragma_info.hpp +10 -0
  150. package/src/duckdb/src/include/duckdb/parser/parsed_data/show_select_info.hpp +7 -0
  151. package/src/duckdb/src/include/duckdb/parser/parsed_data/transaction_info.hpp +10 -0
  152. package/src/duckdb/src/include/duckdb/parser/parsed_data/vacuum_info.hpp +10 -0
  153. package/src/duckdb/src/include/duckdb/planner/bound_constraint.hpp +0 -8
  154. package/src/duckdb/src/include/duckdb/planner/bound_result_modifier.hpp +6 -0
  155. package/src/duckdb/src/include/duckdb/planner/column_binding.hpp +5 -0
  156. package/src/duckdb/src/include/duckdb/planner/expression/bound_between_expression.hpp +6 -0
  157. package/src/duckdb/src/include/duckdb/planner/expression/bound_case_expression.hpp +6 -0
  158. package/src/duckdb/src/include/duckdb/planner/expression/bound_cast_expression.hpp +6 -0
  159. package/src/duckdb/src/include/duckdb/planner/expression/bound_columnref_expression.hpp +3 -0
  160. package/src/duckdb/src/include/duckdb/planner/expression/bound_comparison_expression.hpp +3 -0
  161. package/src/duckdb/src/include/duckdb/planner/expression/bound_conjunction_expression.hpp +3 -0
  162. package/src/duckdb/src/include/duckdb/planner/expression/bound_constant_expression.hpp +3 -0
  163. package/src/duckdb/src/include/duckdb/planner/expression/bound_default_expression.hpp +3 -0
  164. package/src/duckdb/src/include/duckdb/planner/expression/bound_lambda_expression.hpp +3 -1
  165. package/src/duckdb/src/include/duckdb/planner/expression/bound_lambdaref_expression.hpp +3 -0
  166. package/src/duckdb/src/include/duckdb/planner/expression/bound_operator_expression.hpp +3 -0
  167. package/src/duckdb/src/include/duckdb/planner/expression/bound_parameter_data.hpp +5 -2
  168. package/src/duckdb/src/include/duckdb/planner/expression/bound_parameter_expression.hpp +7 -0
  169. package/src/duckdb/src/include/duckdb/planner/expression/bound_reference_expression.hpp +3 -0
  170. package/src/duckdb/src/include/duckdb/planner/expression/bound_unnest_expression.hpp +3 -0
  171. package/src/duckdb/src/include/duckdb/planner/expression/list.hpp +1 -0
  172. package/src/duckdb/src/include/duckdb/planner/expression.hpp +3 -0
  173. package/src/duckdb/src/include/duckdb/planner/joinside.hpp +3 -0
  174. package/src/duckdb/src/include/duckdb/planner/logical_operator.hpp +3 -0
  175. package/src/duckdb/src/include/duckdb/planner/operator/logical_aggregate.hpp +3 -0
  176. package/src/duckdb/src/include/duckdb/planner/operator/logical_any_join.hpp +3 -0
  177. package/src/duckdb/src/include/duckdb/planner/operator/logical_column_data_get.hpp +4 -0
  178. package/src/duckdb/src/include/duckdb/planner/operator/logical_comparison_join.hpp +9 -2
  179. package/src/duckdb/src/include/duckdb/planner/operator/logical_create.hpp +9 -6
  180. package/src/duckdb/src/include/duckdb/planner/operator/logical_create_index.hpp +2 -16
  181. package/src/duckdb/src/include/duckdb/planner/operator/logical_create_table.hpp +10 -6
  182. package/src/duckdb/src/include/duckdb/planner/operator/logical_cross_product.hpp +3 -0
  183. package/src/duckdb/src/include/duckdb/planner/operator/logical_cteref.hpp +2 -0
  184. package/src/duckdb/src/include/duckdb/planner/operator/logical_delete.hpp +7 -0
  185. package/src/duckdb/src/include/duckdb/planner/operator/logical_delim_get.hpp +3 -0
  186. package/src/duckdb/src/include/duckdb/planner/operator/logical_distinct.hpp +6 -10
  187. package/src/duckdb/src/include/duckdb/planner/operator/logical_dummy_scan.hpp +2 -0
  188. package/src/duckdb/src/include/duckdb/planner/operator/logical_empty_result.hpp +2 -0
  189. package/src/duckdb/src/include/duckdb/planner/operator/logical_explain.hpp +4 -0
  190. package/src/duckdb/src/include/duckdb/planner/operator/logical_expression_get.hpp +3 -0
  191. package/src/duckdb/src/include/duckdb/planner/operator/logical_filter.hpp +3 -0
  192. package/src/duckdb/src/include/duckdb/planner/operator/logical_insert.hpp +6 -0
  193. package/src/duckdb/src/include/duckdb/planner/operator/logical_limit.hpp +3 -0
  194. package/src/duckdb/src/include/duckdb/planner/operator/logical_limit_percent.hpp +3 -0
  195. package/src/duckdb/src/include/duckdb/planner/operator/logical_materialized_cte.hpp +5 -2
  196. package/src/duckdb/src/include/duckdb/planner/operator/logical_order.hpp +7 -35
  197. package/src/duckdb/src/include/duckdb/planner/operator/logical_pivot.hpp +6 -0
  198. package/src/duckdb/src/include/duckdb/planner/operator/logical_positional_join.hpp +3 -0
  199. package/src/duckdb/src/include/duckdb/planner/operator/logical_projection.hpp +3 -0
  200. package/src/duckdb/src/include/duckdb/planner/operator/logical_recursive_cte.hpp +5 -3
  201. package/src/duckdb/src/include/duckdb/planner/operator/logical_reset.hpp +4 -0
  202. package/src/duckdb/src/include/duckdb/planner/operator/logical_sample.hpp +6 -0
  203. package/src/duckdb/src/include/duckdb/planner/operator/logical_set.hpp +4 -0
  204. package/src/duckdb/src/include/duckdb/planner/operator/logical_set_operation.hpp +4 -0
  205. package/src/duckdb/src/include/duckdb/planner/operator/logical_show.hpp +3 -0
  206. package/src/duckdb/src/include/duckdb/planner/operator/logical_simple.hpp +3 -0
  207. package/src/duckdb/src/include/duckdb/planner/operator/logical_top_n.hpp +4 -0
  208. package/src/duckdb/src/include/duckdb/planner/operator/logical_unnest.hpp +2 -0
  209. package/src/duckdb/src/include/duckdb/planner/operator/logical_update.hpp +6 -0
  210. package/src/duckdb/src/include/duckdb/planner/operator/logical_window.hpp +3 -0
  211. package/src/duckdb/src/include/duckdb/planner/tableref/bound_pivotref.hpp +3 -0
  212. package/src/duckdb/src/main/relation/join_relation.cpp +1 -1
  213. package/src/duckdb/src/optimizer/deliminator.cpp +5 -3
  214. package/src/duckdb/src/parallel/pipeline.cpp +0 -17
  215. package/src/duckdb/src/parallel/pipeline_executor.cpp +26 -7
  216. package/src/duckdb/src/parallel/pipeline_finish_event.cpp +55 -1
  217. package/src/duckdb/src/parser/column_definition.cpp +20 -32
  218. package/src/duckdb/src/parser/column_list.cpp +8 -0
  219. package/src/duckdb/src/parser/constraints/foreign_key_constraint.cpp +3 -0
  220. package/src/duckdb/src/parser/constraints/unique_constraint.cpp +3 -0
  221. package/src/duckdb/src/parser/expression/case_expression.cpp +0 -12
  222. package/src/duckdb/src/parser/parsed_data/alter_info.cpp +5 -2
  223. package/src/duckdb/src/parser/parsed_data/alter_table_info.cpp +38 -0
  224. package/src/duckdb/src/parser/parsed_data/create_index_info.cpp +3 -1
  225. package/src/duckdb/src/parser/parsed_data/create_sequence_info.cpp +2 -0
  226. package/src/duckdb/src/parser/parsed_data/detach_info.cpp +1 -1
  227. package/src/duckdb/src/parser/parsed_data/drop_info.cpp +1 -1
  228. package/src/duckdb/src/parser/parsed_data/sample_options.cpp +0 -18
  229. package/src/duckdb/src/parser/parsed_data/transaction_info.cpp +4 -1
  230. package/src/duckdb/src/parser/parsed_data/vacuum_info.cpp +1 -1
  231. package/src/duckdb/src/parser/query_node.cpp +0 -10
  232. package/src/duckdb/src/parser/result_modifier.cpp +0 -13
  233. package/src/duckdb/src/parser/statement/select_statement.cpp +0 -10
  234. package/src/duckdb/src/parser/tableref/pivotref.cpp +0 -16
  235. package/src/duckdb/src/parser/transform/statement/transform_create_index.cpp +5 -4
  236. package/src/duckdb/src/planner/binder/query_node/plan_subquery.cpp +1 -1
  237. package/src/duckdb/src/planner/binder/statement/bind_create.cpp +6 -1
  238. package/src/duckdb/src/planner/binder/tableref/bind_basetableref.cpp +13 -3
  239. package/src/duckdb/src/planner/expression/bound_between_expression.cpp +4 -0
  240. package/src/duckdb/src/planner/expression/bound_cast_expression.cpp +13 -6
  241. package/src/duckdb/src/planner/expression/bound_parameter_expression.cpp +20 -12
  242. package/src/duckdb/src/planner/logical_operator.cpp +13 -1
  243. package/src/duckdb/src/planner/operator/logical_comparison_join.cpp +16 -2
  244. package/src/duckdb/src/planner/operator/logical_create.cpp +14 -0
  245. package/src/duckdb/src/planner/operator/logical_create_index.cpp +20 -0
  246. package/src/duckdb/src/planner/operator/logical_create_table.cpp +16 -0
  247. package/src/duckdb/src/planner/operator/logical_delete.cpp +9 -2
  248. package/src/duckdb/src/planner/operator/logical_delim_join.cpp +2 -4
  249. package/src/duckdb/src/planner/operator/logical_distinct.cpp +13 -0
  250. package/src/duckdb/src/planner/operator/logical_explain.cpp +1 -1
  251. package/src/duckdb/src/planner/operator/logical_insert.cpp +8 -2
  252. package/src/duckdb/src/planner/operator/logical_materialized_cte.cpp +3 -2
  253. package/src/duckdb/src/planner/operator/logical_order.cpp +39 -0
  254. package/src/duckdb/src/planner/operator/logical_pivot.cpp +3 -0
  255. package/src/duckdb/src/planner/operator/logical_recursive_cte.cpp +5 -5
  256. package/src/duckdb/src/planner/operator/logical_sample.cpp +3 -0
  257. package/src/duckdb/src/planner/operator/logical_update.cpp +8 -2
  258. package/src/duckdb/src/planner/parsed_data/bound_create_table_info.cpp +4 -2
  259. package/src/duckdb/src/planner/planner.cpp +11 -0
  260. package/src/duckdb/src/storage/checkpoint_manager.cpp +23 -23
  261. package/src/duckdb/src/storage/compression/bitpacking.cpp +87 -63
  262. package/src/duckdb/src/storage/compression/bitpacking_hugeint.cpp +295 -0
  263. package/src/duckdb/src/storage/serialization/serialize_constraint.cpp +98 -0
  264. package/src/duckdb/src/storage/serialization/serialize_create_info.cpp +188 -0
  265. package/src/duckdb/src/storage/serialization/serialize_expression.cpp +274 -0
  266. package/src/duckdb/src/storage/serialization/serialize_logical_operator.cpp +729 -0
  267. package/src/duckdb/src/storage/serialization/serialize_macro_function.cpp +62 -0
  268. package/src/duckdb/src/storage/serialization/serialize_nodes.cpp +242 -0
  269. package/src/duckdb/src/storage/serialization/serialize_parse_info.cpp +419 -0
  270. package/src/duckdb/src/storage/serialization/serialize_parsed_expression.cpp +40 -38
  271. package/src/duckdb/src/storage/serialization/serialize_query_node.cpp +36 -36
  272. package/src/duckdb/src/storage/serialization/serialize_result_modifier.cpp +25 -14
  273. package/src/duckdb/src/storage/serialization/serialize_statement.cpp +22 -0
  274. package/src/duckdb/src/storage/serialization/serialize_tableref.cpp +47 -47
  275. package/src/duckdb/src/storage/serialization/serialize_types.cpp +25 -25
  276. package/src/duckdb/src/storage/storage_info.cpp +3 -2
  277. package/src/duckdb/src/storage/wal_replay.cpp +20 -19
  278. package/src/duckdb/ub_extension_icu_third_party_icu_i18n.cpp +6 -6
  279. package/src/duckdb/ub_src_core_functions_scalar_string.cpp +2 -0
  280. package/src/duckdb/ub_src_parser.cpp +0 -2
  281. package/src/duckdb/ub_src_storage_compression.cpp +2 -0
  282. package/src/duckdb/ub_src_storage_serialization.cpp +16 -0
  283. package/src/duckdb/src/parser/common_table_expression_info.cpp +0 -21
@@ -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
 
@@ -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 {
@@ -4,6 +4,45 @@
4
4
 
5
5
  namespace duckdb {
6
6
 
7
+ LogicalOrder::LogicalOrder(vector<BoundOrderByNode> orders)
8
+ : LogicalOperator(LogicalOperatorType::LOGICAL_ORDER_BY), orders(std::move(orders)) {
9
+ }
10
+
11
+ vector<ColumnBinding> LogicalOrder::GetColumnBindings() {
12
+ auto child_bindings = children[0]->GetColumnBindings();
13
+ if (projections.empty()) {
14
+ return child_bindings;
15
+ }
16
+
17
+ vector<ColumnBinding> result;
18
+ for (auto &col_idx : projections) {
19
+ result.push_back(child_bindings[col_idx]);
20
+ }
21
+ return result;
22
+ }
23
+
24
+ string LogicalOrder::ParamsToString() const {
25
+ string result = "ORDERS:\n";
26
+ for (idx_t i = 0; i < orders.size(); i++) {
27
+ if (i > 0) {
28
+ result += "\n";
29
+ }
30
+ result += orders[i].expression->GetName();
31
+ }
32
+ return result;
33
+ }
34
+
35
+ void LogicalOrder::ResolveTypes() {
36
+ const auto child_types = children[0]->types;
37
+ if (projections.empty()) {
38
+ types = child_types;
39
+ } else {
40
+ for (auto &col_idx : projections) {
41
+ types.push_back(child_types[col_idx]);
42
+ }
43
+ }
44
+ }
45
+
7
46
  void LogicalOrder::Serialize(FieldWriter &writer) const {
8
47
  writer.WriteRegularSerializableList(orders);
9
48
  writer.WriteList<idx_t>(projections);
@@ -4,6 +4,9 @@
4
4
 
5
5
  namespace duckdb {
6
6
 
7
+ LogicalPivot::LogicalPivot() : LogicalOperator(LogicalOperatorType::LOGICAL_PIVOT) {
8
+ }
9
+
7
10
  LogicalPivot::LogicalPivot(idx_t pivot_idx, unique_ptr<LogicalOperator> plan, BoundPivotInfo info_p)
8
11
  : LogicalOperator(LogicalOperatorType::LOGICAL_PIVOT), pivot_index(pivot_idx), bound_pivot(std::move(info_p)) {
9
12
  D_ASSERT(plan);
@@ -12,11 +12,11 @@ void LogicalRecursiveCTE::Serialize(FieldWriter &writer) const {
12
12
  }
13
13
 
14
14
  unique_ptr<LogicalOperator> LogicalRecursiveCTE::Deserialize(LogicalDeserializationState &state, FieldReader &reader) {
15
- auto table_index = reader.ReadRequired<idx_t>();
16
- auto column_count = reader.ReadRequired<idx_t>();
17
- auto union_all = reader.ReadRequired<bool>();
18
- // TODO(stephwang): review if unique_ptr<LogicalOperator> plan is needed
19
- return unique_ptr<LogicalRecursiveCTE>(new LogicalRecursiveCTE(table_index, column_count, union_all));
15
+ auto result = unique_ptr<LogicalRecursiveCTE>(new LogicalRecursiveCTE());
16
+ result->table_index = reader.ReadRequired<idx_t>();
17
+ result->column_count = reader.ReadRequired<idx_t>();
18
+ result->union_all = reader.ReadRequired<bool>();
19
+ return std::move(result);
20
20
  }
21
21
 
22
22
  vector<idx_t> LogicalRecursiveCTE::GetTableIndex() const {
@@ -3,6 +3,9 @@
3
3
 
4
4
  namespace duckdb {
5
5
 
6
+ LogicalSample::LogicalSample() : LogicalOperator(LogicalOperatorType::LOGICAL_SAMPLE) {
7
+ }
8
+
6
9
  LogicalSample::LogicalSample(unique_ptr<SampleOptions> sample_options_p, unique_ptr<LogicalOperator> child)
7
10
  : LogicalOperator(LogicalOperatorType::LOGICAL_SAMPLE), sample_options(std::move(sample_options_p)) {
8
11
  children.push_back(std::move(child));
@@ -10,6 +10,11 @@ LogicalUpdate::LogicalUpdate(TableCatalogEntry &table)
10
10
  : LogicalOperator(LogicalOperatorType::LOGICAL_UPDATE), table(table), table_index(0), return_chunk(false) {
11
11
  }
12
12
 
13
+ LogicalUpdate::LogicalUpdate(ClientContext &context, const string &catalog, const string &schema, const string &table)
14
+ : LogicalOperator(LogicalOperatorType::LOGICAL_UPDATE),
15
+ table(Catalog::GetEntry<TableCatalogEntry>(context, catalog, schema, table)) {
16
+ }
17
+
13
18
  void LogicalUpdate::Serialize(FieldWriter &writer) const {
14
19
  table.Serialize(writer.GetSerializer());
15
20
  writer.WriteField(table_index);
@@ -22,10 +27,11 @@ void LogicalUpdate::Serialize(FieldWriter &writer) const {
22
27
 
23
28
  unique_ptr<LogicalOperator> LogicalUpdate::Deserialize(LogicalDeserializationState &state, FieldReader &reader) {
24
29
  auto &context = state.gstate.context;
25
- auto info = TableCatalogEntry::Deserialize(reader.GetSource(), context);
30
+ auto info = TableCatalogEntry::Deserialize(reader.GetSource());
26
31
  auto &catalog = Catalog::GetCatalog(context, info->catalog);
27
32
 
28
- auto &table_catalog_entry = catalog.GetEntry<TableCatalogEntry>(context, info->schema, info->table);
33
+ auto &table_catalog_entry =
34
+ catalog.GetEntry<TableCatalogEntry>(context, info->schema, info->Cast<CreateTableInfo>().table);
29
35
  auto result = make_uniq<LogicalUpdate>(table_catalog_entry);
30
36
  result->table_index = reader.ReadRequired<idx_t>();
31
37
  result->return_chunk = reader.ReadRequired<bool>();
@@ -2,8 +2,11 @@
2
2
  #include "duckdb/parser/parsed_data/create_schema_info.hpp"
3
3
  #include "duckdb/catalog/catalog_entry/schema_catalog_entry.hpp"
4
4
  #include "duckdb/common/field_writer.hpp"
5
+ #include "duckdb/common/serializer/format_serializer.hpp"
6
+ #include "duckdb/common/serializer/format_deserializer.hpp"
5
7
 
6
8
  namespace duckdb {
9
+
7
10
  void BoundCreateTableInfo::Serialize(Serializer &serializer) const {
8
11
  serializer.WriteOptional(base);
9
12
  }
@@ -11,10 +14,9 @@ void BoundCreateTableInfo::Serialize(Serializer &serializer) const {
11
14
  unique_ptr<BoundCreateTableInfo> BoundCreateTableInfo::Deserialize(Deserializer &source,
12
15
  PlanDeserializationState &state) {
13
16
  auto info = source.ReadOptional<CreateInfo>();
14
- auto schema_name = info->schema;
15
- auto catalog = info->catalog;
16
17
  auto binder = Binder::CreateBinder(state.context);
17
18
  auto bound_info = binder->BindCreateTableInfo(std::move(info));
18
19
  return bound_info;
19
20
  }
21
+
20
22
  } // namespace duckdb
@@ -11,6 +11,8 @@
11
11
  #include "duckdb/planner/binder.hpp"
12
12
  #include "duckdb/planner/expression/bound_parameter_expression.hpp"
13
13
  #include "duckdb/transaction/meta_transaction.hpp"
14
+ #include "duckdb/common/serializer/binary_serializer.hpp"
15
+ #include "duckdb/common/serializer/binary_deserializer.hpp"
14
16
 
15
17
  namespace duckdb {
16
18
 
@@ -164,6 +166,15 @@ void Planner::VerifyPlan(ClientContext &context, unique_ptr<LogicalOperator> &op
164
166
  return;
165
167
  }
166
168
 
169
+ // format (de)serialization of this operator
170
+ try {
171
+ auto blob = BinarySerializer::Serialize(*op);
172
+ bound_parameter_map_t parameters;
173
+ auto result = BinaryDeserializer::Deserialize<LogicalOperator>(context, parameters, blob.data(), blob.size());
174
+ } catch (SerializationException &ex) {
175
+ // pass
176
+ }
177
+
167
178
  BufferedSerializer serializer;
168
179
  serializer.is_query_plan = true;
169
180
  try {
@@ -254,10 +254,10 @@ void CheckpointWriter::WriteSchema(SchemaCatalogEntry &schema) {
254
254
 
255
255
  void CheckpointReader::ReadSchema(ClientContext &context, MetaBlockReader &reader) {
256
256
  // read the schema and create it in the catalog
257
- auto info = SchemaCatalogEntry::Deserialize(reader);
257
+ auto info = CatalogEntry::Deserialize(reader);
258
258
  // we set create conflict to ignore to ignore the failure of recreating the main schema
259
259
  info->on_conflict = OnCreateConflict::IGNORE_ON_CONFLICT;
260
- catalog.CreateSchema(context, *info);
260
+ catalog.CreateSchema(context, info->Cast<CreateSchemaInfo>());
261
261
 
262
262
  // first read all the counts
263
263
  FieldReader field_reader(reader);
@@ -309,8 +309,8 @@ void CheckpointWriter::WriteView(ViewCatalogEntry &view) {
309
309
  }
310
310
 
311
311
  void CheckpointReader::ReadView(ClientContext &context, MetaBlockReader &reader) {
312
- auto info = ViewCatalogEntry::Deserialize(reader, context);
313
- catalog.CreateView(context, *info);
312
+ auto info = CatalogEntry::Deserialize(reader);
313
+ catalog.CreateView(context, info->Cast<CreateViewInfo>());
314
314
  }
315
315
 
316
316
  //===--------------------------------------------------------------------===//
@@ -322,7 +322,7 @@ void CheckpointWriter::WriteSequence(SequenceCatalogEntry &seq) {
322
322
 
323
323
  void CheckpointReader::ReadSequence(ClientContext &context, MetaBlockReader &reader) {
324
324
  auto info = SequenceCatalogEntry::Deserialize(reader);
325
- catalog.CreateSequence(context, *info);
325
+ catalog.CreateSequence(context, info->Cast<CreateSequenceInfo>());
326
326
  }
327
327
 
328
328
  //===--------------------------------------------------------------------===//
@@ -341,13 +341,14 @@ void CheckpointWriter::WriteIndex(IndexCatalogEntry &index_catalog) {
341
341
 
342
342
  void CheckpointReader::ReadIndex(ClientContext &context, MetaBlockReader &reader) {
343
343
  // deserialize the index metadata
344
- auto info = IndexCatalogEntry::Deserialize(reader, context);
344
+ auto info = IndexCatalogEntry::Deserialize(reader);
345
+ auto &index_info = info->Cast<CreateIndexInfo>();
345
346
 
346
347
  // create the index in the catalog
347
348
  auto &schema_catalog = catalog.GetSchema(context, info->schema);
348
- auto &table_catalog = catalog.GetEntry(context, CatalogType::TABLE_ENTRY, info->schema, info->table->table_name)
349
- .Cast<DuckTableEntry>();
350
- auto &index_catalog = schema_catalog.CreateIndex(context, *info, table_catalog)->Cast<DuckIndexEntry>();
349
+ auto &table_catalog =
350
+ catalog.GetEntry(context, CatalogType::TABLE_ENTRY, info->schema, index_info.table).Cast<DuckTableEntry>();
351
+ auto &index_catalog = schema_catalog.CreateIndex(context, index_info, table_catalog)->Cast<DuckIndexEntry>();
351
352
  index_catalog.info = table_catalog.GetStorage().info;
352
353
 
353
354
  // we deserialize the index lazily, i.e., we do not need to load any node information
@@ -358,7 +359,7 @@ void CheckpointReader::ReadIndex(ClientContext &context, MetaBlockReader &reader
358
359
  // obtain the expressions of the ART from the index metadata
359
360
  vector<unique_ptr<Expression>> unbound_expressions;
360
361
  vector<unique_ptr<ParsedExpression>> parsed_expressions;
361
- for (auto &p_exp : info->parsed_expressions) {
362
+ for (auto &p_exp : index_info.parsed_expressions) {
362
363
  parsed_expressions.push_back(p_exp->Copy());
363
364
  }
364
365
 
@@ -372,8 +373,7 @@ void CheckpointReader::ReadIndex(ClientContext &context, MetaBlockReader &reader
372
373
  column_names.push_back(col.Name());
373
374
  }
374
375
  vector<column_t> column_ids;
375
- binder->bind_context.AddBaseTable(0, info->table->table_name, column_names, column_types, column_ids,
376
- &table_catalog);
376
+ binder->bind_context.AddBaseTable(0, index_info.table, column_names, column_types, column_ids, &table_catalog);
377
377
  IndexBinder idx_binder(*binder, context);
378
378
  unbound_expressions.reserve(parsed_expressions.size());
379
379
  for (auto &expr : parsed_expressions) {
@@ -382,20 +382,20 @@ void CheckpointReader::ReadIndex(ClientContext &context, MetaBlockReader &reader
382
382
 
383
383
  if (parsed_expressions.empty()) {
384
384
  // this is a PK/FK index: we create the necessary bound column ref expressions
385
- unbound_expressions.reserve(info->column_ids.size());
386
- for (idx_t key_nr = 0; key_nr < info->column_ids.size(); key_nr++) {
387
- auto &col = table_catalog.GetColumn(LogicalIndex(info->column_ids[key_nr]));
385
+ unbound_expressions.reserve(index_info.column_ids.size());
386
+ for (idx_t key_nr = 0; key_nr < index_info.column_ids.size(); key_nr++) {
387
+ auto &col = table_catalog.GetColumn(LogicalIndex(index_info.column_ids[key_nr]));
388
388
  unbound_expressions.push_back(
389
389
  make_uniq<BoundColumnRefExpression>(col.GetName(), col.GetType(), ColumnBinding(0, key_nr)));
390
390
  }
391
391
  }
392
392
 
393
393
  // create the index and add it to the storage
394
- switch (info->index_type) {
394
+ switch (index_info.index_type) {
395
395
  case IndexType::ART: {
396
396
  auto &storage = table_catalog.GetStorage();
397
- auto art = make_uniq<ART>(info->column_ids, TableIOManager::Get(storage), std::move(unbound_expressions),
398
- info->constraint_type, storage.db, root_block_id, root_offset);
397
+ auto art = make_uniq<ART>(index_info.column_ids, TableIOManager::Get(storage), std::move(unbound_expressions),
398
+ index_info.constraint_type, storage.db, root_block_id, root_offset);
399
399
  index_catalog.index = art.get();
400
400
  storage.info->indexes.AddIndex(std::move(art));
401
401
  break;
@@ -428,8 +428,8 @@ void CheckpointWriter::WriteMacro(ScalarMacroCatalogEntry &macro) {
428
428
  }
429
429
 
430
430
  void CheckpointReader::ReadMacro(ClientContext &context, MetaBlockReader &reader) {
431
- auto info = MacroCatalogEntry::Deserialize(reader, context);
432
- catalog.CreateFunction(context, *info);
431
+ auto info = MacroCatalogEntry::Deserialize(reader);
432
+ catalog.CreateFunction(context, info->Cast<CreateMacroInfo>());
433
433
  }
434
434
 
435
435
  void CheckpointWriter::WriteTableMacro(TableMacroCatalogEntry &macro) {
@@ -437,8 +437,8 @@ void CheckpointWriter::WriteTableMacro(TableMacroCatalogEntry &macro) {
437
437
  }
438
438
 
439
439
  void CheckpointReader::ReadTableMacro(ClientContext &context, MetaBlockReader &reader) {
440
- auto info = MacroCatalogEntry::Deserialize(reader, context);
441
- catalog.CreateFunction(context, *info);
440
+ auto info = MacroCatalogEntry::Deserialize(reader);
441
+ catalog.CreateFunction(context, info->Cast<CreateMacroInfo>());
442
442
  }
443
443
 
444
444
  //===--------------------------------------------------------------------===//
@@ -455,7 +455,7 @@ void CheckpointWriter::WriteTable(TableCatalogEntry &table) {
455
455
 
456
456
  void CheckpointReader::ReadTable(ClientContext &context, MetaBlockReader &reader) {
457
457
  // deserialize the table meta data
458
- auto info = TableCatalogEntry::Deserialize(reader, context);
458
+ auto info = TableCatalogEntry::Deserialize(reader);
459
459
  // bind the info
460
460
  auto binder = Binder::CreateBinder(context);
461
461
  auto &schema = catalog.GetSchema(context, info->schema);