duckdb 0.7.2-dev2867.0 → 0.7.2-dev3117.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 (319) hide show
  1. package/binding.gyp +2 -0
  2. package/package.json +1 -1
  3. package/src/duckdb/extension/icu/icu-datepart.cpp +5 -1
  4. package/src/duckdb/extension/json/include/json_deserializer.hpp +1 -0
  5. package/src/duckdb/extension/json/include/json_serializer.hpp +8 -1
  6. package/src/duckdb/extension/json/json_functions/json_serialize_sql.cpp +1 -3
  7. package/src/duckdb/extension/json/json_functions/json_structure.cpp +3 -3
  8. package/src/duckdb/extension/json/json_functions/json_transform.cpp +3 -2
  9. package/src/duckdb/extension/parquet/parquet-extension.cpp +9 -7
  10. package/src/duckdb/src/catalog/catalog_entry/table_catalog_entry.cpp +18 -7
  11. package/src/duckdb/src/catalog/default/default_functions.cpp +2 -0
  12. package/src/duckdb/src/common/arrow/arrow_appender.cpp +3 -3
  13. package/src/duckdb/src/common/arrow/arrow_converter.cpp +2 -2
  14. package/src/duckdb/src/common/enum_util.cpp +5908 -0
  15. package/src/duckdb/src/common/enums/expression_type.cpp +216 -4
  16. package/src/duckdb/src/common/enums/join_type.cpp +6 -5
  17. package/src/duckdb/src/common/enums/physical_operator_type.cpp +2 -0
  18. package/src/duckdb/src/common/exception.cpp +1 -1
  19. package/src/duckdb/src/common/exception_format_value.cpp +2 -2
  20. package/src/duckdb/src/common/multi_file_reader.cpp +14 -0
  21. package/src/duckdb/src/common/serializer/binary_deserializer.cpp +143 -0
  22. package/src/duckdb/src/common/serializer/binary_serializer.cpp +160 -0
  23. package/src/duckdb/src/common/sort/partition_state.cpp +1 -1
  24. package/src/duckdb/src/common/string_util.cpp +6 -1
  25. package/src/duckdb/src/common/types/row/tuple_data_scatter_gather.cpp +3 -3
  26. package/src/duckdb/src/common/types.cpp +11 -10
  27. package/src/duckdb/src/common/vector_operations/is_distinct_from.cpp +4 -4
  28. package/src/duckdb/src/core_functions/function_list.cpp +2 -0
  29. package/src/duckdb/src/core_functions/scalar/date/date_part.cpp +2 -1
  30. package/src/duckdb/src/core_functions/scalar/list/list_sort.cpp +2 -3
  31. package/src/duckdb/src/core_functions/scalar/string/format_bytes.cpp +29 -0
  32. package/src/duckdb/src/execution/aggregate_hashtable.cpp +3 -3
  33. package/src/duckdb/src/execution/index/art/art.cpp +5 -1
  34. package/src/duckdb/src/execution/operator/aggregate/distinct_aggregate_data.cpp +1 -1
  35. package/src/duckdb/src/execution/operator/aggregate/grouped_aggregate_data.cpp +2 -2
  36. package/src/duckdb/src/execution/operator/aggregate/physical_hash_aggregate.cpp +65 -45
  37. package/src/duckdb/src/execution/operator/aggregate/physical_perfecthash_aggregate.cpp +17 -11
  38. package/src/duckdb/src/execution/operator/aggregate/physical_ungrouped_aggregate.cpp +32 -39
  39. package/src/duckdb/src/execution/operator/aggregate/physical_window.cpp +10 -9
  40. package/src/duckdb/src/execution/operator/helper/physical_batch_collector.cpp +4 -4
  41. package/src/duckdb/src/execution/operator/helper/physical_explain_analyze.cpp +6 -21
  42. package/src/duckdb/src/execution/operator/helper/physical_limit.cpp +13 -13
  43. package/src/duckdb/src/execution/operator/helper/physical_limit_percent.cpp +15 -14
  44. package/src/duckdb/src/execution/operator/helper/physical_load.cpp +3 -2
  45. package/src/duckdb/src/execution/operator/helper/physical_materialized_collector.cpp +4 -4
  46. package/src/duckdb/src/execution/operator/helper/physical_pragma.cpp +4 -2
  47. package/src/duckdb/src/execution/operator/helper/physical_prepare.cpp +4 -2
  48. package/src/duckdb/src/execution/operator/helper/physical_reservoir_sample.cpp +10 -8
  49. package/src/duckdb/src/execution/operator/helper/physical_reset.cpp +4 -3
  50. package/src/duckdb/src/execution/operator/helper/physical_set.cpp +7 -6
  51. package/src/duckdb/src/execution/operator/helper/physical_streaming_sample.cpp +2 -1
  52. package/src/duckdb/src/execution/operator/helper/physical_transaction.cpp +4 -2
  53. package/src/duckdb/src/execution/operator/helper/physical_vacuum.cpp +8 -8
  54. package/src/duckdb/src/execution/operator/join/physical_asof_join.cpp +17 -16
  55. package/src/duckdb/src/execution/operator/join/physical_blockwise_nl_join.cpp +12 -9
  56. package/src/duckdb/src/execution/operator/join/physical_comparison_join.cpp +2 -1
  57. package/src/duckdb/src/execution/operator/join/physical_cross_product.cpp +3 -4
  58. package/src/duckdb/src/execution/operator/join/physical_delim_join.cpp +5 -5
  59. package/src/duckdb/src/execution/operator/join/physical_hash_join.cpp +16 -15
  60. package/src/duckdb/src/execution/operator/join/physical_iejoin.cpp +13 -12
  61. package/src/duckdb/src/execution/operator/join/physical_nested_loop_join.cpp +12 -10
  62. package/src/duckdb/src/execution/operator/join/physical_piecewise_merge_join.cpp +13 -11
  63. package/src/duckdb/src/execution/operator/join/physical_positional_join.cpp +8 -6
  64. package/src/duckdb/src/execution/operator/join/physical_range_join.cpp +1 -1
  65. package/src/duckdb/src/execution/operator/order/physical_order.cpp +13 -13
  66. package/src/duckdb/src/execution/operator/order/physical_top_n.cpp +8 -8
  67. package/src/duckdb/src/execution/operator/persistent/physical_batch_copy_to_file.cpp +165 -0
  68. package/src/duckdb/src/execution/operator/persistent/physical_batch_insert.cpp +160 -145
  69. package/src/duckdb/src/execution/operator/persistent/physical_copy_to_file.cpp +11 -26
  70. package/src/duckdb/src/execution/operator/persistent/physical_delete.cpp +14 -19
  71. package/src/duckdb/src/execution/operator/persistent/physical_export.cpp +7 -6
  72. package/src/duckdb/src/execution/operator/persistent/physical_insert.cpp +18 -30
  73. package/src/duckdb/src/execution/operator/persistent/physical_update.cpp +14 -18
  74. package/src/duckdb/src/execution/operator/scan/physical_column_data_scan.cpp +6 -4
  75. package/src/duckdb/src/execution/operator/scan/physical_dummy_scan.cpp +4 -19
  76. package/src/duckdb/src/execution/operator/scan/physical_empty_result.cpp +3 -2
  77. package/src/duckdb/src/execution/operator/scan/physical_positional_scan.cpp +14 -5
  78. package/src/duckdb/src/execution/operator/scan/physical_table_scan.cpp +6 -4
  79. package/src/duckdb/src/execution/operator/schema/physical_alter.cpp +3 -19
  80. package/src/duckdb/src/execution/operator/schema/physical_attach.cpp +13 -25
  81. package/src/duckdb/src/execution/operator/schema/physical_create_function.cpp +4 -19
  82. package/src/duckdb/src/execution/operator/schema/physical_create_index.cpp +8 -9
  83. package/src/duckdb/src/execution/operator/schema/physical_create_schema.cpp +4 -19
  84. package/src/duckdb/src/execution/operator/schema/physical_create_sequence.cpp +4 -19
  85. package/src/duckdb/src/execution/operator/schema/physical_create_table.cpp +4 -19
  86. package/src/duckdb/src/execution/operator/schema/physical_create_type.cpp +9 -26
  87. package/src/duckdb/src/execution/operator/schema/physical_create_view.cpp +4 -19
  88. package/src/duckdb/src/execution/operator/schema/physical_detach.cpp +4 -19
  89. package/src/duckdb/src/execution/operator/schema/physical_drop.cpp +3 -19
  90. package/src/duckdb/src/execution/operator/set/physical_recursive_cte.cpp +9 -8
  91. package/src/duckdb/src/execution/operator/set/physical_union.cpp +1 -1
  92. package/src/duckdb/src/execution/partitionable_hashtable.cpp +2 -2
  93. package/src/duckdb/src/execution/physical_operator.cpp +11 -5
  94. package/src/duckdb/src/execution/physical_plan/plan_copy_to_file.cpp +25 -4
  95. package/src/duckdb/src/execution/physical_plan/plan_sample.cpp +2 -1
  96. package/src/duckdb/src/execution/radix_partitioned_hashtable.cpp +16 -16
  97. package/src/duckdb/src/function/scalar/operators/arithmetic.cpp +5 -4
  98. package/src/duckdb/src/function/table/arrow_conversion.cpp +3 -3
  99. package/src/duckdb/src/function/table/copy_csv.cpp +85 -29
  100. package/src/duckdb/src/function/table/read_csv.cpp +17 -11
  101. package/src/duckdb/src/function/table/system/duckdb_settings.cpp +2 -1
  102. package/src/duckdb/src/function/table/system/duckdb_types.cpp +2 -1
  103. package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
  104. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_catalog_entry.hpp +7 -1
  105. package/src/duckdb/src/include/duckdb/common/enum_util.hpp +958 -0
  106. package/src/duckdb/src/include/duckdb/common/enums/join_type.hpp +3 -3
  107. package/src/duckdb/src/include/duckdb/common/enums/operator_result_type.hpp +16 -4
  108. package/src/duckdb/src/include/duckdb/common/enums/physical_operator_type.hpp +1 -0
  109. package/src/duckdb/src/include/duckdb/common/exception.hpp +4 -4
  110. package/src/duckdb/src/include/duckdb/common/exception_format_value.hpp +3 -2
  111. package/src/duckdb/src/include/duckdb/common/multi_file_reader_options.hpp +44 -0
  112. package/src/duckdb/src/include/duckdb/common/optional_idx.hpp +45 -0
  113. package/src/duckdb/src/include/duckdb/common/serializer/binary_deserializer.hpp +93 -0
  114. package/src/duckdb/src/include/duckdb/common/serializer/binary_serializer.hpp +92 -0
  115. package/src/duckdb/src/include/duckdb/common/serializer/format_deserializer.hpp +7 -3
  116. package/src/duckdb/src/include/duckdb/common/serializer/format_serializer.hpp +2 -2
  117. package/src/duckdb/src/include/duckdb/common/set.hpp +2 -1
  118. package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_collection.hpp +1 -1
  119. package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_segment.hpp +1 -1
  120. package/src/duckdb/src/include/duckdb/common/types.hpp +1 -0
  121. package/src/duckdb/src/include/duckdb/common/vector.hpp +61 -14
  122. package/src/duckdb/src/include/duckdb/core_functions/scalar/string_functions.hpp +15 -0
  123. package/src/duckdb/src/include/duckdb/execution/aggregate_hashtable.hpp +3 -2
  124. package/src/duckdb/src/include/duckdb/execution/executor.hpp +10 -1
  125. package/src/duckdb/src/include/duckdb/execution/operator/aggregate/distinct_aggregate_data.hpp +2 -2
  126. package/src/duckdb/src/include/duckdb/execution/operator/aggregate/grouped_aggregate_data.hpp +2 -2
  127. package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_hash_aggregate.hpp +8 -11
  128. package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_perfecthash_aggregate.hpp +2 -4
  129. package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_ungrouped_aggregate.hpp +3 -7
  130. package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_window.hpp +2 -4
  131. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_batch_collector.hpp +1 -2
  132. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_explain_analyze.hpp +2 -5
  133. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_limit.hpp +2 -4
  134. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_limit_percent.hpp +2 -4
  135. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_load.hpp +1 -2
  136. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_materialized_collector.hpp +1 -2
  137. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_pragma.hpp +1 -2
  138. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_prepare.hpp +1 -2
  139. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_reservoir_sample.hpp +2 -4
  140. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_reset.hpp +1 -2
  141. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_set.hpp +1 -2
  142. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_transaction.hpp +1 -2
  143. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_vacuum.hpp +2 -4
  144. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_asof_join.hpp +2 -4
  145. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_blockwise_nl_join.hpp +2 -4
  146. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_cross_product.hpp +1 -2
  147. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_delim_join.hpp +1 -2
  148. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_hash_join.hpp +2 -4
  149. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_iejoin.hpp +2 -4
  150. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_nested_loop_join.hpp +2 -4
  151. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_piecewise_merge_join.hpp +2 -4
  152. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_positional_join.hpp +2 -4
  153. package/src/duckdb/src/include/duckdb/execution/operator/order/physical_order.hpp +2 -4
  154. package/src/duckdb/src/include/duckdb/execution/operator/order/physical_top_n.hpp +2 -4
  155. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_batch_copy_to_file.hpp +68 -0
  156. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_batch_insert.hpp +3 -5
  157. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_copy_to_file.hpp +4 -5
  158. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_delete.hpp +2 -4
  159. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_export.hpp +2 -4
  160. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_insert.hpp +2 -4
  161. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_update.hpp +2 -4
  162. package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_column_data_scan.hpp +1 -2
  163. package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_dummy_scan.hpp +1 -3
  164. package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_empty_result.hpp +1 -2
  165. package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_positional_scan.hpp +1 -2
  166. package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_table_scan.hpp +1 -2
  167. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_alter.hpp +1 -3
  168. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_attach.hpp +1 -3
  169. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_function.hpp +1 -3
  170. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_index.hpp +2 -4
  171. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_schema.hpp +1 -3
  172. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_sequence.hpp +1 -3
  173. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_table.hpp +1 -3
  174. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_type.hpp +2 -5
  175. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_view.hpp +1 -3
  176. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_detach.hpp +1 -3
  177. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_drop.hpp +1 -3
  178. package/src/duckdb/src/include/duckdb/execution/operator/set/physical_recursive_cte.hpp +2 -4
  179. package/src/duckdb/src/include/duckdb/execution/partitionable_hashtable.hpp +3 -3
  180. package/src/duckdb/src/include/duckdb/execution/physical_operator.hpp +7 -4
  181. package/src/duckdb/src/include/duckdb/execution/physical_operator_states.hpp +26 -6
  182. package/src/duckdb/src/include/duckdb/execution/radix_partitioned_hashtable.hpp +6 -6
  183. package/src/duckdb/src/include/duckdb/function/aggregate_function.hpp +2 -1
  184. package/src/duckdb/src/include/duckdb/function/copy_function.hpp +32 -4
  185. package/src/duckdb/src/include/duckdb/function/table/read_csv.hpp +4 -2
  186. package/src/duckdb/src/include/duckdb/function/table_function.hpp +0 -1
  187. package/src/duckdb/src/include/duckdb/main/client_config.hpp +2 -0
  188. package/src/duckdb/src/include/duckdb/main/config.hpp +4 -0
  189. package/src/duckdb/src/include/duckdb/main/database.hpp +1 -3
  190. package/src/duckdb/src/include/duckdb/main/database_path_and_type.hpp +24 -0
  191. package/src/duckdb/src/include/duckdb/main/relation/setop_relation.hpp +1 -0
  192. package/src/duckdb/src/include/duckdb/parallel/event.hpp +1 -1
  193. package/src/duckdb/src/include/duckdb/parallel/interrupt.hpp +63 -0
  194. package/src/duckdb/src/include/duckdb/parallel/pipeline.hpp +16 -3
  195. package/src/duckdb/src/include/duckdb/parallel/pipeline_executor.hpp +51 -7
  196. package/src/duckdb/src/include/duckdb/parallel/task.hpp +21 -2
  197. package/src/duckdb/src/include/duckdb/parallel/task_counter.hpp +2 -2
  198. package/src/duckdb/src/include/duckdb/parallel/task_scheduler.hpp +2 -2
  199. package/src/duckdb/src/include/duckdb/parser/parsed_data/sample_options.hpp +1 -0
  200. package/src/duckdb/src/include/duckdb/planner/column_binding.hpp +6 -0
  201. package/src/duckdb/src/include/duckdb/planner/expression/bound_columnref_expression.hpp +1 -0
  202. package/src/duckdb/src/include/duckdb/planner/expression_binder/base_select_binder.hpp +2 -0
  203. package/src/duckdb/src/include/duckdb/planner/expression_binder.hpp +2 -0
  204. package/src/duckdb/src/include/duckdb/planner/operator/logical_aggregate.hpp +2 -1
  205. package/src/duckdb/src/include/duckdb/planner/operator/logical_column_data_get.hpp +1 -0
  206. package/src/duckdb/src/include/duckdb/planner/operator/logical_cteref.hpp +1 -0
  207. package/src/duckdb/src/include/duckdb/planner/operator/logical_delete.hpp +1 -0
  208. package/src/duckdb/src/include/duckdb/planner/operator/logical_delim_get.hpp +1 -0
  209. package/src/duckdb/src/include/duckdb/planner/operator/logical_dummy_scan.hpp +1 -0
  210. package/src/duckdb/src/include/duckdb/planner/operator/logical_expression_get.hpp +1 -0
  211. package/src/duckdb/src/include/duckdb/planner/operator/logical_insert.hpp +1 -0
  212. package/src/duckdb/src/include/duckdb/planner/operator/logical_pivot.hpp +1 -0
  213. package/src/duckdb/src/include/duckdb/planner/operator/logical_projection.hpp +1 -0
  214. package/src/duckdb/src/include/duckdb/planner/operator/logical_recursive_cte.hpp +1 -0
  215. package/src/duckdb/src/include/duckdb/planner/operator/logical_set_operation.hpp +1 -0
  216. package/src/duckdb/src/include/duckdb/planner/operator/logical_unnest.hpp +1 -0
  217. package/src/duckdb/src/include/duckdb/planner/operator/logical_update.hpp +1 -0
  218. package/src/duckdb/src/include/duckdb/planner/operator/logical_window.hpp +1 -0
  219. package/src/duckdb/src/include/duckdb/planner/query_node/bound_select_node.hpp +1 -1
  220. package/src/duckdb/src/include/duckdb/storage/data_table.hpp +1 -0
  221. package/src/duckdb/src/include/duckdb/storage/optimistic_data_writer.hpp +46 -0
  222. package/src/duckdb/src/include/duckdb/storage/partial_block_manager.hpp +24 -3
  223. package/src/duckdb/src/include/duckdb/storage/table/column_checkpoint_state.hpp +46 -1
  224. package/src/duckdb/src/include/duckdb/storage/table/column_data.hpp +9 -10
  225. package/src/duckdb/src/include/duckdb/storage/table/column_segment.hpp +1 -1
  226. package/src/duckdb/src/include/duckdb/storage/table/list_column_data.hpp +2 -2
  227. package/src/duckdb/src/include/duckdb/storage/table/row_group.hpp +3 -3
  228. package/src/duckdb/src/include/duckdb/storage/table/row_group_collection.hpp +1 -0
  229. package/src/duckdb/src/include/duckdb/storage/table/segment_base.hpp +1 -1
  230. package/src/duckdb/src/include/duckdb/storage/table/segment_tree.hpp +22 -0
  231. package/src/duckdb/src/include/duckdb/storage/table/standard_column_data.hpp +3 -3
  232. package/src/duckdb/src/include/duckdb/storage/table/struct_column_data.hpp +2 -2
  233. package/src/duckdb/src/include/duckdb/storage/table/update_segment.hpp +0 -2
  234. package/src/duckdb/src/include/duckdb/storage/table/validity_column_data.hpp +1 -2
  235. package/src/duckdb/src/include/duckdb/transaction/local_storage.hpp +9 -34
  236. package/src/duckdb/src/include/duckdb/verification/deserialized_statement_verifier_v2.hpp +26 -0
  237. package/src/duckdb/src/include/duckdb/verification/no_operator_caching_verifier.hpp +25 -0
  238. package/src/duckdb/src/include/duckdb/verification/statement_verifier.hpp +6 -0
  239. package/src/duckdb/src/main/client_context.cpp +1 -0
  240. package/src/duckdb/src/main/client_verify.cpp +5 -0
  241. package/src/duckdb/src/main/config.cpp +4 -0
  242. package/src/duckdb/src/main/database.cpp +22 -34
  243. package/src/duckdb/src/main/database_path_and_type.cpp +23 -0
  244. package/src/duckdb/src/main/extension/extension_load.cpp +19 -15
  245. package/src/duckdb/src/main/relation/join_relation.cpp +2 -1
  246. package/src/duckdb/src/main/relation/setop_relation.cpp +2 -3
  247. package/src/duckdb/src/parallel/event.cpp +1 -1
  248. package/src/duckdb/src/parallel/executor.cpp +39 -3
  249. package/src/duckdb/src/parallel/executor_task.cpp +11 -0
  250. package/src/duckdb/src/parallel/interrupt.cpp +57 -0
  251. package/src/duckdb/src/parallel/pipeline.cpp +49 -6
  252. package/src/duckdb/src/parallel/pipeline_executor.cpp +248 -69
  253. package/src/duckdb/src/parallel/pipeline_initialize_event.cpp +1 -1
  254. package/src/duckdb/src/parallel/task_scheduler.cpp +57 -22
  255. package/src/duckdb/src/parser/base_expression.cpp +6 -0
  256. package/src/duckdb/src/parser/expression/window_expression.cpp +1 -1
  257. package/src/duckdb/src/parser/parsed_data/sample_options.cpp +2 -2
  258. package/src/duckdb/src/parser/query_node/select_node.cpp +1 -1
  259. package/src/duckdb/src/parser/result_modifier.cpp +2 -2
  260. package/src/duckdb/src/parser/statement/select_statement.cpp +0 -44
  261. package/src/duckdb/src/parser/tableref/joinref.cpp +3 -3
  262. package/src/duckdb/src/parser/tableref.cpp +1 -1
  263. package/src/duckdb/src/parser/transform/expression/transform_function.cpp +3 -3
  264. package/src/duckdb/src/planner/binder/expression/bind_columnref_expression.cpp +6 -0
  265. package/src/duckdb/src/planner/binder/expression/bind_function_expression.cpp +4 -1
  266. package/src/duckdb/src/planner/expression/bound_columnref_expression.cpp +17 -3
  267. package/src/duckdb/src/planner/expression/bound_reference_expression.cpp +8 -2
  268. package/src/duckdb/src/planner/expression_binder/base_select_binder.cpp +7 -0
  269. package/src/duckdb/src/planner/operator/logical_aggregate.cpp +14 -2
  270. package/src/duckdb/src/planner/operator/logical_column_data_get.cpp +11 -0
  271. package/src/duckdb/src/planner/operator/logical_comparison_join.cpp +2 -2
  272. package/src/duckdb/src/planner/operator/logical_cteref.cpp +11 -0
  273. package/src/duckdb/src/planner/operator/logical_delete.cpp +10 -0
  274. package/src/duckdb/src/planner/operator/logical_delim_get.cpp +12 -1
  275. package/src/duckdb/src/planner/operator/logical_dummy_scan.cpp +12 -1
  276. package/src/duckdb/src/planner/operator/logical_expression_get.cpp +12 -1
  277. package/src/duckdb/src/planner/operator/logical_get.cpp +10 -4
  278. package/src/duckdb/src/planner/operator/logical_insert.cpp +12 -1
  279. package/src/duckdb/src/planner/operator/logical_pivot.cpp +11 -0
  280. package/src/duckdb/src/planner/operator/logical_projection.cpp +11 -0
  281. package/src/duckdb/src/planner/operator/logical_recursive_cte.cpp +11 -0
  282. package/src/duckdb/src/planner/operator/logical_set_operation.cpp +11 -0
  283. package/src/duckdb/src/planner/operator/logical_unnest.cpp +12 -1
  284. package/src/duckdb/src/planner/operator/logical_update.cpp +10 -0
  285. package/src/duckdb/src/planner/operator/logical_window.cpp +11 -0
  286. package/src/duckdb/src/storage/checkpoint_manager.cpp +1 -1
  287. package/src/duckdb/src/storage/data_table.cpp +5 -0
  288. package/src/duckdb/src/storage/local_storage.cpp +40 -110
  289. package/src/duckdb/src/storage/optimistic_data_writer.cpp +96 -0
  290. package/src/duckdb/src/storage/partial_block_manager.cpp +73 -9
  291. package/src/duckdb/src/storage/single_file_block_manager.cpp +3 -1
  292. package/src/duckdb/src/storage/standard_buffer_manager.cpp +17 -12
  293. package/src/duckdb/src/storage/statistics/base_statistics.cpp +3 -0
  294. package/src/duckdb/src/storage/table/column_checkpoint_state.cpp +90 -82
  295. package/src/duckdb/src/storage/table/column_data.cpp +19 -45
  296. package/src/duckdb/src/storage/table/column_data_checkpointer.cpp +7 -7
  297. package/src/duckdb/src/storage/table/column_segment.cpp +1 -1
  298. package/src/duckdb/src/storage/table/list_column_data.cpp +6 -11
  299. package/src/duckdb/src/storage/table/row_group.cpp +13 -14
  300. package/src/duckdb/src/storage/table/row_group_collection.cpp +10 -4
  301. package/src/duckdb/src/storage/table/standard_column_data.cpp +6 -10
  302. package/src/duckdb/src/storage/table/struct_column_data.cpp +7 -13
  303. package/src/duckdb/src/storage/table/update_segment.cpp +0 -25
  304. package/src/duckdb/src/storage/table/validity_column_data.cpp +2 -6
  305. package/src/duckdb/src/transaction/commit_state.cpp +4 -4
  306. package/src/duckdb/src/verification/deserialized_statement_verifier.cpp +2 -1
  307. package/src/duckdb/src/verification/deserialized_statement_verifier_v2.cpp +20 -0
  308. package/src/duckdb/src/verification/no_operator_caching_verifier.cpp +13 -0
  309. package/src/duckdb/src/verification/statement_verifier.cpp +7 -0
  310. package/src/duckdb/ub_src_common.cpp +2 -2
  311. package/src/duckdb/ub_src_common_serializer.cpp +4 -2
  312. package/src/duckdb/ub_src_core_functions_scalar_string.cpp +2 -0
  313. package/src/duckdb/ub_src_execution_operator_persistent.cpp +2 -0
  314. package/src/duckdb/ub_src_main.cpp +2 -0
  315. package/src/duckdb/ub_src_parallel.cpp +2 -0
  316. package/src/duckdb/ub_src_storage.cpp +2 -0
  317. package/src/duckdb/src/common/serializer/enum_serializer.cpp +0 -1180
  318. package/src/duckdb/src/common/vector.cpp +0 -12
  319. package/src/duckdb/src/include/duckdb/common/serializer/enum_serializer.hpp +0 -113
@@ -1,16 +1,228 @@
1
1
  #include "duckdb/common/enums/expression_type.hpp"
2
2
 
3
3
  #include "duckdb/common/exception.hpp"
4
- #include "duckdb/common/serializer/enum_serializer.hpp"
4
+ #include "duckdb/common/enum_util.hpp"
5
5
 
6
6
  namespace duckdb {
7
7
 
8
8
  string ExpressionTypeToString(ExpressionType type) {
9
- return EnumSerializer::EnumToString(type);
9
+ switch (type) {
10
+ case ExpressionType::OPERATOR_CAST:
11
+ return "CAST";
12
+ case ExpressionType::OPERATOR_NOT:
13
+ return "NOT";
14
+ case ExpressionType::OPERATOR_IS_NULL:
15
+ return "IS_NULL";
16
+ case ExpressionType::OPERATOR_IS_NOT_NULL:
17
+ return "IS_NOT_NULL";
18
+ case ExpressionType::COMPARE_EQUAL:
19
+ return "EQUAL";
20
+ case ExpressionType::COMPARE_NOTEQUAL:
21
+ return "NOTEQUAL";
22
+ case ExpressionType::COMPARE_LESSTHAN:
23
+ return "LESSTHAN";
24
+ case ExpressionType::COMPARE_GREATERTHAN:
25
+ return "GREATERTHAN";
26
+ case ExpressionType::COMPARE_LESSTHANOREQUALTO:
27
+ return "LESSTHANOREQUALTO";
28
+ case ExpressionType::COMPARE_GREATERTHANOREQUALTO:
29
+ return "GREATERTHANOREQUALTO";
30
+ case ExpressionType::COMPARE_IN:
31
+ return "IN";
32
+ case ExpressionType::COMPARE_DISTINCT_FROM:
33
+ return "DISTINCT_FROM";
34
+ case ExpressionType::COMPARE_NOT_DISTINCT_FROM:
35
+ return "NOT_DISTINCT_FROM";
36
+ case ExpressionType::CONJUNCTION_AND:
37
+ return "AND";
38
+ case ExpressionType::CONJUNCTION_OR:
39
+ return "OR";
40
+ case ExpressionType::VALUE_CONSTANT:
41
+ return "CONSTANT";
42
+ case ExpressionType::VALUE_PARAMETER:
43
+ return "PARAMETER";
44
+ case ExpressionType::VALUE_TUPLE:
45
+ return "TUPLE";
46
+ case ExpressionType::VALUE_TUPLE_ADDRESS:
47
+ return "TUPLE_ADDRESS";
48
+ case ExpressionType::VALUE_NULL:
49
+ return "NULL";
50
+ case ExpressionType::VALUE_VECTOR:
51
+ return "VECTOR";
52
+ case ExpressionType::VALUE_SCALAR:
53
+ return "SCALAR";
54
+ case ExpressionType::AGGREGATE:
55
+ return "AGGREGATE";
56
+ case ExpressionType::WINDOW_AGGREGATE:
57
+ return "WINDOW_AGGREGATE";
58
+ case ExpressionType::WINDOW_RANK:
59
+ return "RANK";
60
+ case ExpressionType::WINDOW_RANK_DENSE:
61
+ return "RANK_DENSE";
62
+ case ExpressionType::WINDOW_PERCENT_RANK:
63
+ return "PERCENT_RANK";
64
+ case ExpressionType::WINDOW_ROW_NUMBER:
65
+ return "ROW_NUMBER";
66
+ case ExpressionType::WINDOW_FIRST_VALUE:
67
+ return "FIRST_VALUE";
68
+ case ExpressionType::WINDOW_LAST_VALUE:
69
+ return "LAST_VALUE";
70
+ case ExpressionType::WINDOW_NTH_VALUE:
71
+ return "NTH_VALUE";
72
+ case ExpressionType::WINDOW_CUME_DIST:
73
+ return "CUME_DIST";
74
+ case ExpressionType::WINDOW_LEAD:
75
+ return "LEAD";
76
+ case ExpressionType::WINDOW_LAG:
77
+ return "LAG";
78
+ case ExpressionType::WINDOW_NTILE:
79
+ return "NTILE";
80
+ case ExpressionType::FUNCTION:
81
+ return "FUNCTION";
82
+ case ExpressionType::CASE_EXPR:
83
+ return "CASE";
84
+ case ExpressionType::OPERATOR_NULLIF:
85
+ return "NULLIF";
86
+ case ExpressionType::OPERATOR_COALESCE:
87
+ return "COALESCE";
88
+ case ExpressionType::ARRAY_EXTRACT:
89
+ return "ARRAY_EXTRACT";
90
+ case ExpressionType::ARRAY_SLICE:
91
+ return "ARRAY_SLICE";
92
+ case ExpressionType::STRUCT_EXTRACT:
93
+ return "STRUCT_EXTRACT";
94
+ case ExpressionType::SUBQUERY:
95
+ return "SUBQUERY";
96
+ case ExpressionType::STAR:
97
+ return "STAR";
98
+ case ExpressionType::PLACEHOLDER:
99
+ return "PLACEHOLDER";
100
+ case ExpressionType::COLUMN_REF:
101
+ return "COLUMN_REF";
102
+ case ExpressionType::FUNCTION_REF:
103
+ return "FUNCTION_REF";
104
+ case ExpressionType::TABLE_REF:
105
+ return "TABLE_REF";
106
+ case ExpressionType::CAST:
107
+ return "CAST";
108
+ case ExpressionType::COMPARE_NOT_IN:
109
+ return "COMPARE_NOT_IN";
110
+ case ExpressionType::COMPARE_BETWEEN:
111
+ return "COMPARE_BETWEEN";
112
+ case ExpressionType::COMPARE_NOT_BETWEEN:
113
+ return "COMPARE_NOT_BETWEEN";
114
+ case ExpressionType::VALUE_DEFAULT:
115
+ return "VALUE_DEFAULT";
116
+ case ExpressionType::BOUND_REF:
117
+ return "BOUND_REF";
118
+ case ExpressionType::BOUND_COLUMN_REF:
119
+ return "BOUND_COLUMN_REF";
120
+ case ExpressionType::BOUND_FUNCTION:
121
+ return "BOUND_FUNCTION";
122
+ case ExpressionType::BOUND_AGGREGATE:
123
+ return "BOUND_AGGREGATE";
124
+ case ExpressionType::GROUPING_FUNCTION:
125
+ return "GROUPING";
126
+ case ExpressionType::ARRAY_CONSTRUCTOR:
127
+ return "ARRAY_CONSTRUCTOR";
128
+ case ExpressionType::TABLE_STAR:
129
+ return "TABLE_STAR";
130
+ case ExpressionType::BOUND_UNNEST:
131
+ return "BOUND_UNNEST";
132
+ case ExpressionType::COLLATE:
133
+ return "COLLATE";
134
+ case ExpressionType::POSITIONAL_REFERENCE:
135
+ return "POSITIONAL_REFERENCE";
136
+ case ExpressionType::BOUND_LAMBDA_REF:
137
+ return "BOUND_LAMBDA_REF";
138
+ case ExpressionType::LAMBDA:
139
+ return "LAMBDA";
140
+ case ExpressionType::ARROW:
141
+ return "ARROW";
142
+ case ExpressionType::INVALID:
143
+ break;
144
+ }
145
+ return "INVALID";
10
146
  }
11
-
12
147
  string ExpressionClassToString(ExpressionClass type) {
13
- return EnumSerializer::EnumToString(type);
148
+ switch (type) {
149
+ case ExpressionClass::INVALID:
150
+ return "INVALID";
151
+ case ExpressionClass::AGGREGATE:
152
+ return "AGGREGATE";
153
+ case ExpressionClass::CASE:
154
+ return "CASE";
155
+ case ExpressionClass::CAST:
156
+ return "CAST";
157
+ case ExpressionClass::COLUMN_REF:
158
+ return "COLUMN_REF";
159
+ case ExpressionClass::COMPARISON:
160
+ return "COMPARISON";
161
+ case ExpressionClass::CONJUNCTION:
162
+ return "CONJUNCTION";
163
+ case ExpressionClass::CONSTANT:
164
+ return "CONSTANT";
165
+ case ExpressionClass::DEFAULT:
166
+ return "DEFAULT";
167
+ case ExpressionClass::FUNCTION:
168
+ return "FUNCTION";
169
+ case ExpressionClass::OPERATOR:
170
+ return "OPERATOR";
171
+ case ExpressionClass::STAR:
172
+ return "STAR";
173
+ case ExpressionClass::SUBQUERY:
174
+ return "SUBQUERY";
175
+ case ExpressionClass::WINDOW:
176
+ return "WINDOW";
177
+ case ExpressionClass::PARAMETER:
178
+ return "PARAMETER";
179
+ case ExpressionClass::COLLATE:
180
+ return "COLLATE";
181
+ case ExpressionClass::LAMBDA:
182
+ return "LAMBDA";
183
+ case ExpressionClass::POSITIONAL_REFERENCE:
184
+ return "POSITIONAL_REFERENCE";
185
+ case ExpressionClass::BETWEEN:
186
+ return "BETWEEN";
187
+ case ExpressionClass::BOUND_AGGREGATE:
188
+ return "BOUND_AGGREGATE";
189
+ case ExpressionClass::BOUND_CASE:
190
+ return "BOUND_CASE";
191
+ case ExpressionClass::BOUND_CAST:
192
+ return "BOUND_CAST";
193
+ case ExpressionClass::BOUND_COLUMN_REF:
194
+ return "BOUND_COLUMN_REF";
195
+ case ExpressionClass::BOUND_COMPARISON:
196
+ return "BOUND_COMPARISON";
197
+ case ExpressionClass::BOUND_CONJUNCTION:
198
+ return "BOUND_CONJUNCTION";
199
+ case ExpressionClass::BOUND_CONSTANT:
200
+ return "BOUND_CONSTANT";
201
+ case ExpressionClass::BOUND_DEFAULT:
202
+ return "BOUND_DEFAULT";
203
+ case ExpressionClass::BOUND_FUNCTION:
204
+ return "BOUND_FUNCTION";
205
+ case ExpressionClass::BOUND_OPERATOR:
206
+ return "BOUND_OPERATOR";
207
+ case ExpressionClass::BOUND_PARAMETER:
208
+ return "BOUND_PARAMETER";
209
+ case ExpressionClass::BOUND_REF:
210
+ return "BOUND_REF";
211
+ case ExpressionClass::BOUND_SUBQUERY:
212
+ return "BOUND_SUBQUERY";
213
+ case ExpressionClass::BOUND_WINDOW:
214
+ return "BOUND_WINDOW";
215
+ case ExpressionClass::BOUND_BETWEEN:
216
+ return "BOUND_BETWEEN";
217
+ case ExpressionClass::BOUND_UNNEST:
218
+ return "BOUND_UNNEST";
219
+ case ExpressionClass::BOUND_LAMBDA:
220
+ return "BOUND_LAMBDA";
221
+ case ExpressionClass::BOUND_EXPRESSION:
222
+ return "BOUND_EXPRESSION";
223
+ default:
224
+ return "ExpressionClass::!!UNIMPLEMENTED_CASE!!";
225
+ }
14
226
  }
15
227
 
16
228
  string ExpressionTypeToOperator(ExpressionType type) {
@@ -1,12 +1,8 @@
1
1
  #include "duckdb/common/enums/join_type.hpp"
2
- #include "duckdb/common/serializer/enum_serializer.hpp"
2
+ #include "duckdb/common/enum_util.hpp"
3
3
 
4
4
  namespace duckdb {
5
5
 
6
- string JoinTypeToString(JoinType type) {
7
- return EnumSerializer::EnumToString(type);
8
- }
9
-
10
6
  bool IsLeftOuterJoin(JoinType type) {
11
7
  return type == JoinType::LEFT || type == JoinType::OUTER;
12
8
  }
@@ -15,4 +11,9 @@ bool IsRightOuterJoin(JoinType type) {
15
11
  return type == JoinType::OUTER || type == JoinType::RIGHT;
16
12
  }
17
13
 
14
+ // **DEPRECATED**: Use EnumUtil directly instead.
15
+ string JoinTypeToString(JoinType type) {
16
+ return EnumUtil::ToString(type);
17
+ }
18
+
18
19
  } // namespace duckdb
@@ -47,6 +47,8 @@ string PhysicalOperatorToString(PhysicalOperatorType type) {
47
47
  return "PROJECTION";
48
48
  case PhysicalOperatorType::COPY_TO_FILE:
49
49
  return "COPY_TO_FILE";
50
+ case PhysicalOperatorType::BATCH_COPY_TO_FILE:
51
+ return "BATCH_COPY_TO_FILE";
50
52
  case PhysicalOperatorType::DELIM_JOIN:
51
53
  return "DELIM_JOIN";
52
54
  case PhysicalOperatorType::BLOCKWISE_NL_JOIN:
@@ -58,7 +58,7 @@ string Exception::GetStackTrace(int max_depth) {
58
58
  #endif
59
59
  }
60
60
 
61
- string Exception::ConstructMessageRecursive(const string &msg, vector<ExceptionFormatValue> &values) {
61
+ string Exception::ConstructMessageRecursive(const string &msg, std::vector<ExceptionFormatValue> &values) {
62
62
  return ExceptionFormatValue::Format(msg, values);
63
63
  }
64
64
 
@@ -53,8 +53,8 @@ ExceptionFormatValue ExceptionFormatValue::CreateFormatValue(hugeint_t value) {
53
53
  return ExceptionFormatValue(value);
54
54
  }
55
55
 
56
- string ExceptionFormatValue::Format(const string &msg, vector<ExceptionFormatValue> &values) {
57
- vector<duckdb_fmt::basic_format_arg<duckdb_fmt::printf_context>> format_args;
56
+ string ExceptionFormatValue::Format(const string &msg, std::vector<ExceptionFormatValue> &values) {
57
+ std::vector<duckdb_fmt::basic_format_arg<duckdb_fmt::printf_context>> format_args;
58
58
  for (auto &val : values) {
59
59
  switch (val.type) {
60
60
  case ExceptionFormatValueType::FORMAT_VALUE_TYPE_DOUBLE:
@@ -52,6 +52,7 @@ bool MultiFileReader::ParseOption(const string &key, const Value &val, MultiFile
52
52
  options.filename = BooleanValue::Get(val);
53
53
  } else if (loption == "hive_partitioning") {
54
54
  options.hive_partitioning = BooleanValue::Get(val);
55
+ options.auto_detect_hive_partitioning = false;
55
56
  } else if (loption == "union_by_name") {
56
57
  options.union_by_name = BooleanValue::Get(val);
57
58
  } else {
@@ -107,12 +108,25 @@ MultiFileReaderBindData MultiFileReader::BindOptions(MultiFileReaderOptions &opt
107
108
  auto file_partitions = HivePartitioning::Parse(f);
108
109
  for (auto &part_info : partitions) {
109
110
  if (file_partitions.find(part_info.first) == file_partitions.end()) {
111
+ if (options.auto_detect_hive_partitioning == true) {
112
+ throw BinderException(
113
+ "Hive partitioning was enabled automatically, but an error was encountered: Hive partition "
114
+ "mismatch between file \"%s\" and \"%s\": key \"%s\" not found\n\nTo switch off hive "
115
+ "partition, set: HIVE_PARTITIONING=0",
116
+ files[0], f, part_info.first);
117
+ }
110
118
  throw BinderException(
111
119
  "Hive partition mismatch between file \"%s\" and \"%s\": key \"%s\" not found", files[0], f,
112
120
  part_info.first);
113
121
  }
114
122
  }
115
123
  if (partitions.size() != file_partitions.size()) {
124
+ if (options.auto_detect_hive_partitioning == true) {
125
+ throw BinderException("Hive partitioning was enabled automatically, but an error was encountered: "
126
+ "Hive partition mismatch between file \"%s\" and \"%s\"\n\nTo switch off "
127
+ "hive partition, set: HIVE_PARTITIONING=0",
128
+ files[0], f);
129
+ }
116
130
  throw BinderException("Hive partition mismatch between file \"%s\" and \"%s\"", files[0], f);
117
131
  }
118
132
  }
@@ -0,0 +1,143 @@
1
+ #include "duckdb/common/serializer/binary_deserializer.hpp"
2
+
3
+ namespace duckdb {
4
+
5
+ void BinaryDeserializer::SetTag(const char *tag) {
6
+ current_tag = tag;
7
+ stack.back().read_field_count++;
8
+ }
9
+
10
+ //===--------------------------------------------------------------------===//
11
+ // Nested Types Hooks
12
+ //===--------------------------------------------------------------------===//
13
+ void BinaryDeserializer::OnObjectBegin() {
14
+ auto expected_field_count = ReadPrimitive<uint32_t>();
15
+ auto expected_size = ReadPrimitive<uint64_t>();
16
+ D_ASSERT(expected_field_count > 0);
17
+ D_ASSERT(expected_size > 0);
18
+
19
+ stack.emplace_back(expected_field_count, expected_size);
20
+ }
21
+
22
+ void BinaryDeserializer::OnObjectEnd() {
23
+ auto &frame = stack.back();
24
+ if (frame.read_field_count < frame.expected_field_count) {
25
+ throw SerializationException("Not all fields were read. This file might have been written with a newer version "
26
+ "of DuckDB and is incompatible with this version of DuckDB.");
27
+ }
28
+ stack.pop_back();
29
+ }
30
+
31
+ idx_t BinaryDeserializer::OnListBegin() {
32
+ return ReadPrimitive<idx_t>();
33
+ }
34
+
35
+ void BinaryDeserializer::OnListEnd() {
36
+ }
37
+
38
+ // Deserialize maps as [ { key: ..., value: ... } ]
39
+ idx_t BinaryDeserializer::OnMapBegin() {
40
+ return ReadPrimitive<idx_t>();
41
+ }
42
+
43
+ void BinaryDeserializer::OnMapEntryBegin() {
44
+ }
45
+
46
+ void BinaryDeserializer::OnMapKeyBegin() {
47
+ }
48
+
49
+ void BinaryDeserializer::OnMapValueBegin() {
50
+ }
51
+
52
+ void BinaryDeserializer::OnMapEntryEnd() {
53
+ }
54
+
55
+ void BinaryDeserializer::OnMapEnd() {
56
+ }
57
+
58
+ void BinaryDeserializer::OnPairBegin() {
59
+ }
60
+
61
+ void BinaryDeserializer::OnPairKeyBegin() {
62
+ }
63
+
64
+ void BinaryDeserializer::OnPairValueBegin() {
65
+ }
66
+
67
+ void BinaryDeserializer::OnPairEnd() {
68
+ }
69
+
70
+ bool BinaryDeserializer::OnOptionalBegin() {
71
+ return ReadPrimitive<bool>();
72
+ }
73
+
74
+ //===--------------------------------------------------------------------===//
75
+ // Primitive Types
76
+ //===--------------------------------------------------------------------===//
77
+ bool BinaryDeserializer::ReadBool() {
78
+ return ReadPrimitive<bool>();
79
+ }
80
+
81
+ int8_t BinaryDeserializer::ReadSignedInt8() {
82
+ return ReadPrimitive<int8_t>();
83
+ }
84
+
85
+ uint8_t BinaryDeserializer::ReadUnsignedInt8() {
86
+ return ReadPrimitive<uint8_t>();
87
+ }
88
+
89
+ int16_t BinaryDeserializer::ReadSignedInt16() {
90
+ return ReadPrimitive<int16_t>();
91
+ }
92
+
93
+ uint16_t BinaryDeserializer::ReadUnsignedInt16() {
94
+ return ReadPrimitive<uint16_t>();
95
+ }
96
+
97
+ int32_t BinaryDeserializer::ReadSignedInt32() {
98
+ return ReadPrimitive<int32_t>();
99
+ }
100
+
101
+ uint32_t BinaryDeserializer::ReadUnsignedInt32() {
102
+ return ReadPrimitive<uint32_t>();
103
+ }
104
+
105
+ int64_t BinaryDeserializer::ReadSignedInt64() {
106
+ return ReadPrimitive<int64_t>();
107
+ }
108
+
109
+ uint64_t BinaryDeserializer::ReadUnsignedInt64() {
110
+ return ReadPrimitive<uint64_t>();
111
+ }
112
+
113
+ float BinaryDeserializer::ReadFloat() {
114
+ return ReadPrimitive<float>();
115
+ }
116
+
117
+ double BinaryDeserializer::ReadDouble() {
118
+ return ReadPrimitive<double>();
119
+ }
120
+
121
+ string BinaryDeserializer::ReadString() {
122
+ uint32_t size = ReadPrimitive<uint32_t>();
123
+ if (size == 0) {
124
+ return string();
125
+ }
126
+ auto buffer = unique_ptr<data_t[]>(new data_t[size]);
127
+ ReadData(buffer.get(), size);
128
+ return string((char *)buffer.get(), size);
129
+ }
130
+
131
+ interval_t BinaryDeserializer::ReadInterval() {
132
+ return ReadPrimitive<interval_t>();
133
+ }
134
+
135
+ hugeint_t BinaryDeserializer::ReadHugeInt() {
136
+ return ReadPrimitive<hugeint_t>();
137
+ }
138
+
139
+ void BinaryDeserializer::ReadDataPtr(data_ptr_t &ptr, idx_t count) {
140
+ ReadData(ptr, count);
141
+ }
142
+
143
+ } // namespace duckdb
@@ -0,0 +1,160 @@
1
+ #include "duckdb/common/serializer/binary_serializer.hpp"
2
+
3
+ namespace duckdb {
4
+
5
+ void BinarySerializer::SetTag(const char *tag) {
6
+ current_tag = tag;
7
+
8
+ // Increment the number of fields
9
+ stack.back().field_count++;
10
+ }
11
+
12
+ //===--------------------------------------------------------------------===//
13
+ // Nested types
14
+ //===--------------------------------------------------------------------===//
15
+ void BinarySerializer::OnOptionalBegin(bool present) {
16
+ Write(present);
17
+ }
18
+
19
+ void BinarySerializer::OnListBegin(idx_t count) {
20
+ Write(count);
21
+ }
22
+
23
+ void BinarySerializer::OnListEnd(idx_t count) {
24
+ }
25
+
26
+ // Serialize maps as arrays of objects with "key" and "value" properties.
27
+ void BinarySerializer::OnMapBegin(idx_t count) {
28
+ Write(count);
29
+ }
30
+
31
+ void BinarySerializer::OnMapEntryBegin() {
32
+ }
33
+
34
+ void BinarySerializer::OnMapKeyBegin() {
35
+ }
36
+
37
+ void BinarySerializer::OnMapValueBegin() {
38
+ }
39
+
40
+ void BinarySerializer::OnMapEntryEnd() {
41
+ }
42
+
43
+ void BinarySerializer::OnMapEnd(idx_t count) {
44
+ }
45
+
46
+ void BinarySerializer::OnObjectBegin() {
47
+ stack.push_back(State({0, 0, data.size()}));
48
+ Write<uint32_t>(0); // Placeholder for the field count
49
+ Write<uint64_t>(0); // Placeholder for the size
50
+ }
51
+
52
+ void BinarySerializer::OnObjectEnd() {
53
+ auto &frame = stack.back();
54
+ // Patch the field count and size
55
+ auto message_start = &data[frame.offset];
56
+ Store<uint32_t>(frame.field_count, message_start);
57
+ Store<uint64_t>(frame.size, message_start + sizeof(uint32_t));
58
+ stack.pop_back();
59
+ }
60
+
61
+ void BinarySerializer::OnPairBegin() {
62
+ }
63
+
64
+ void BinarySerializer::OnPairKeyBegin() {
65
+ }
66
+
67
+ void BinarySerializer::OnPairValueBegin() {
68
+ }
69
+
70
+ void BinarySerializer::OnPairEnd() {
71
+ }
72
+
73
+ //===--------------------------------------------------------------------===//
74
+ // Primitive types
75
+ //===--------------------------------------------------------------------===//
76
+ void BinarySerializer::WriteNull() {
77
+ // This should never be called, optional writes should be handled by OnOptionalBegin
78
+ }
79
+
80
+ void BinarySerializer::WriteValue(uint8_t value) {
81
+ Write(value);
82
+ }
83
+
84
+ void BinarySerializer::WriteValue(int8_t value) {
85
+ Write(value);
86
+ }
87
+
88
+ void BinarySerializer::WriteValue(uint16_t value) {
89
+ Write(value);
90
+ }
91
+
92
+ void BinarySerializer::WriteValue(int16_t value) {
93
+ Write(value);
94
+ }
95
+
96
+ void BinarySerializer::WriteValue(uint32_t value) {
97
+ Write(value);
98
+ }
99
+
100
+ void BinarySerializer::WriteValue(int32_t value) {
101
+ Write(value);
102
+ }
103
+
104
+ void BinarySerializer::WriteValue(uint64_t value) {
105
+ Write(value);
106
+ }
107
+
108
+ void BinarySerializer::WriteValue(int64_t value) {
109
+ Write(value);
110
+ }
111
+
112
+ void BinarySerializer::WriteValue(hugeint_t value) {
113
+ Write(value);
114
+ }
115
+
116
+ void BinarySerializer::WriteValue(float value) {
117
+ Write(value);
118
+ }
119
+
120
+ void BinarySerializer::WriteValue(double value) {
121
+ Write(value);
122
+ }
123
+
124
+ void BinarySerializer::WriteValue(interval_t value) {
125
+ Write(value);
126
+ }
127
+
128
+ void BinarySerializer::WriteValue(const string &value) {
129
+ auto len = value.length();
130
+ Write<uint32_t>((uint32_t)len);
131
+ if (len > 0) {
132
+ WriteData((const_data_ptr_t)value.c_str(), len);
133
+ }
134
+ }
135
+
136
+ void BinarySerializer::WriteValue(const string_t value) {
137
+ auto len = value.GetSize();
138
+ Write<uint32_t>((uint32_t)len);
139
+ if (len > 0) {
140
+ WriteData((const_data_ptr_t)value.GetDataUnsafe(), len);
141
+ }
142
+ }
143
+
144
+ void BinarySerializer::WriteValue(const char *value) {
145
+ auto len = strlen(value);
146
+ Write<uint32_t>((uint32_t)len);
147
+ if (len > 0) {
148
+ WriteData((const_data_ptr_t)value, len);
149
+ }
150
+ }
151
+
152
+ void BinarySerializer::WriteValue(bool value) {
153
+ Write(value);
154
+ }
155
+
156
+ void BinarySerializer::WriteDataPtr(const_data_ptr_t ptr, idx_t count) {
157
+ WriteData(ptr, count);
158
+ }
159
+
160
+ } // namespace duckdb
@@ -554,7 +554,7 @@ void PartitionMergeEvent::Schedule() {
554
554
  auto &ts = TaskScheduler::GetScheduler(context);
555
555
  idx_t num_threads = ts.NumberOfThreads();
556
556
 
557
- vector<unique_ptr<Task>> merge_tasks;
557
+ vector<shared_ptr<Task>> merge_tasks;
558
558
  for (idx_t tnum = 0; tnum < num_threads; tnum++) {
559
559
  merge_tasks.emplace_back(make_uniq<PartitionMergeTask>(shared_from_this(), context, merge_states));
560
560
  }
@@ -163,6 +163,11 @@ string StringUtil::BytesToHumanReadableString(idx_t bytes) {
163
163
  megabytes -= gigabytes * 1000;
164
164
  auto terabytes = gigabytes / 1000;
165
165
  gigabytes -= terabytes * 1000;
166
+ auto petabytes = terabytes / 1000;
167
+ terabytes -= petabytes * 1000;
168
+ if (petabytes > 0) {
169
+ return to_string(petabytes) + "." + to_string(terabytes / 100) + "PB";
170
+ }
166
171
  if (terabytes > 0) {
167
172
  return to_string(terabytes) + "." + to_string(gigabytes / 100) + "TB";
168
173
  } else if (gigabytes > 0) {
@@ -172,7 +177,7 @@ string StringUtil::BytesToHumanReadableString(idx_t bytes) {
172
177
  } else if (kilobytes > 0) {
173
178
  return to_string(kilobytes) + "KB";
174
179
  } else {
175
- return to_string(bytes) + " bytes";
180
+ return to_string(bytes) + (bytes == 1 ? " byte" : " bytes");
176
181
  }
177
182
  }
178
183
 
@@ -1,6 +1,7 @@
1
1
  #include "duckdb/common/fast_mem.hpp"
2
2
  #include "duckdb/common/types/null_value.hpp"
3
3
  #include "duckdb/common/types/row/tuple_data_collection.hpp"
4
+ #include "duckdb/common/enum_util.hpp"
4
5
 
5
6
  namespace duckdb {
6
7
 
@@ -135,7 +136,7 @@ void TupleDataCollection::ComputeHeapSizes(Vector &heap_sizes_v, const Vector &s
135
136
  break;
136
137
  }
137
138
  default:
138
- throw NotImplementedException("ComputeHeapSizes for %s", LogicalTypeIdToString(source_v.GetType().id()));
139
+ throw NotImplementedException("ComputeHeapSizes for %s", EnumUtil::ToString(source_v.GetType().id()));
139
140
  }
140
141
  }
141
142
 
@@ -164,8 +165,7 @@ void TupleDataCollection::WithinListHeapComputeSizes(Vector &heap_sizes_v, const
164
165
  append_count, list_data);
165
166
  break;
166
167
  default:
167
- throw NotImplementedException("WithinListHeapComputeSizes for %s",
168
- LogicalTypeIdToString(source_v.GetType().id()));
168
+ throw NotImplementedException("WithinListHeapComputeSizes for %s", EnumUtil::ToString(source_v.GetType().id()));
169
169
  }
170
170
  }
171
171