duckdb 0.7.2-dev2867.0 → 0.7.2-dev2995.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 (231) hide show
  1. package/binding.gyp +1 -0
  2. package/package.json +1 -1
  3. package/src/duckdb/extension/icu/icu-datepart.cpp +5 -1
  4. package/src/duckdb/src/catalog/catalog_entry/table_catalog_entry.cpp +18 -7
  5. package/src/duckdb/src/catalog/default/default_functions.cpp +2 -0
  6. package/src/duckdb/src/common/arrow/arrow_appender.cpp +3 -3
  7. package/src/duckdb/src/common/arrow/arrow_converter.cpp +2 -2
  8. package/src/duckdb/src/common/sort/partition_state.cpp +1 -1
  9. package/src/duckdb/src/common/string_util.cpp +6 -1
  10. package/src/duckdb/src/core_functions/function_list.cpp +2 -0
  11. package/src/duckdb/src/core_functions/scalar/string/format_bytes.cpp +29 -0
  12. package/src/duckdb/src/execution/index/art/art.cpp +5 -1
  13. package/src/duckdb/src/execution/operator/aggregate/physical_hash_aggregate.cpp +62 -43
  14. package/src/duckdb/src/execution/operator/aggregate/physical_perfecthash_aggregate.cpp +17 -11
  15. package/src/duckdb/src/execution/operator/aggregate/physical_ungrouped_aggregate.cpp +32 -39
  16. package/src/duckdb/src/execution/operator/aggregate/physical_window.cpp +10 -9
  17. package/src/duckdb/src/execution/operator/helper/physical_batch_collector.cpp +4 -4
  18. package/src/duckdb/src/execution/operator/helper/physical_explain_analyze.cpp +6 -21
  19. package/src/duckdb/src/execution/operator/helper/physical_limit.cpp +13 -13
  20. package/src/duckdb/src/execution/operator/helper/physical_limit_percent.cpp +15 -14
  21. package/src/duckdb/src/execution/operator/helper/physical_load.cpp +3 -2
  22. package/src/duckdb/src/execution/operator/helper/physical_materialized_collector.cpp +4 -4
  23. package/src/duckdb/src/execution/operator/helper/physical_pragma.cpp +4 -2
  24. package/src/duckdb/src/execution/operator/helper/physical_prepare.cpp +4 -2
  25. package/src/duckdb/src/execution/operator/helper/physical_reservoir_sample.cpp +10 -8
  26. package/src/duckdb/src/execution/operator/helper/physical_reset.cpp +4 -3
  27. package/src/duckdb/src/execution/operator/helper/physical_set.cpp +7 -6
  28. package/src/duckdb/src/execution/operator/helper/physical_transaction.cpp +4 -2
  29. package/src/duckdb/src/execution/operator/helper/physical_vacuum.cpp +8 -8
  30. package/src/duckdb/src/execution/operator/join/physical_asof_join.cpp +17 -16
  31. package/src/duckdb/src/execution/operator/join/physical_blockwise_nl_join.cpp +10 -8
  32. package/src/duckdb/src/execution/operator/join/physical_cross_product.cpp +3 -4
  33. package/src/duckdb/src/execution/operator/join/physical_delim_join.cpp +5 -5
  34. package/src/duckdb/src/execution/operator/join/physical_hash_join.cpp +16 -15
  35. package/src/duckdb/src/execution/operator/join/physical_iejoin.cpp +13 -12
  36. package/src/duckdb/src/execution/operator/join/physical_nested_loop_join.cpp +12 -10
  37. package/src/duckdb/src/execution/operator/join/physical_piecewise_merge_join.cpp +13 -11
  38. package/src/duckdb/src/execution/operator/join/physical_positional_join.cpp +8 -6
  39. package/src/duckdb/src/execution/operator/join/physical_range_join.cpp +1 -1
  40. package/src/duckdb/src/execution/operator/order/physical_order.cpp +13 -13
  41. package/src/duckdb/src/execution/operator/order/physical_top_n.cpp +8 -8
  42. package/src/duckdb/src/execution/operator/persistent/physical_batch_insert.cpp +160 -145
  43. package/src/duckdb/src/execution/operator/persistent/physical_copy_to_file.cpp +10 -25
  44. package/src/duckdb/src/execution/operator/persistent/physical_delete.cpp +14 -19
  45. package/src/duckdb/src/execution/operator/persistent/physical_export.cpp +7 -6
  46. package/src/duckdb/src/execution/operator/persistent/physical_insert.cpp +18 -30
  47. package/src/duckdb/src/execution/operator/persistent/physical_update.cpp +14 -18
  48. package/src/duckdb/src/execution/operator/scan/physical_column_data_scan.cpp +6 -4
  49. package/src/duckdb/src/execution/operator/scan/physical_dummy_scan.cpp +4 -19
  50. package/src/duckdb/src/execution/operator/scan/physical_empty_result.cpp +3 -2
  51. package/src/duckdb/src/execution/operator/scan/physical_positional_scan.cpp +14 -5
  52. package/src/duckdb/src/execution/operator/scan/physical_table_scan.cpp +6 -4
  53. package/src/duckdb/src/execution/operator/schema/physical_alter.cpp +3 -19
  54. package/src/duckdb/src/execution/operator/schema/physical_attach.cpp +4 -18
  55. package/src/duckdb/src/execution/operator/schema/physical_create_function.cpp +4 -19
  56. package/src/duckdb/src/execution/operator/schema/physical_create_index.cpp +8 -9
  57. package/src/duckdb/src/execution/operator/schema/physical_create_schema.cpp +4 -19
  58. package/src/duckdb/src/execution/operator/schema/physical_create_sequence.cpp +4 -19
  59. package/src/duckdb/src/execution/operator/schema/physical_create_table.cpp +4 -19
  60. package/src/duckdb/src/execution/operator/schema/physical_create_type.cpp +9 -26
  61. package/src/duckdb/src/execution/operator/schema/physical_create_view.cpp +4 -19
  62. package/src/duckdb/src/execution/operator/schema/physical_detach.cpp +4 -19
  63. package/src/duckdb/src/execution/operator/schema/physical_drop.cpp +3 -19
  64. package/src/duckdb/src/execution/operator/set/physical_recursive_cte.cpp +9 -8
  65. package/src/duckdb/src/execution/operator/set/physical_union.cpp +1 -1
  66. package/src/duckdb/src/execution/physical_operator.cpp +11 -5
  67. package/src/duckdb/src/execution/radix_partitioned_hashtable.cpp +16 -16
  68. package/src/duckdb/src/function/table/arrow_conversion.cpp +3 -3
  69. package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
  70. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_catalog_entry.hpp +7 -1
  71. package/src/duckdb/src/include/duckdb/common/enums/operator_result_type.hpp +16 -4
  72. package/src/duckdb/src/include/duckdb/common/optional_idx.hpp +45 -0
  73. package/src/duckdb/src/include/duckdb/common/set.hpp +2 -1
  74. package/src/duckdb/src/include/duckdb/core_functions/scalar/string_functions.hpp +15 -0
  75. package/src/duckdb/src/include/duckdb/execution/executor.hpp +10 -1
  76. package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_hash_aggregate.hpp +5 -8
  77. package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_perfecthash_aggregate.hpp +2 -4
  78. package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_ungrouped_aggregate.hpp +3 -7
  79. package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_window.hpp +2 -4
  80. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_batch_collector.hpp +1 -2
  81. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_explain_analyze.hpp +2 -5
  82. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_limit.hpp +2 -4
  83. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_limit_percent.hpp +2 -4
  84. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_load.hpp +1 -2
  85. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_materialized_collector.hpp +1 -2
  86. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_pragma.hpp +1 -2
  87. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_prepare.hpp +1 -2
  88. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_reservoir_sample.hpp +2 -4
  89. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_reset.hpp +1 -2
  90. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_set.hpp +1 -2
  91. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_transaction.hpp +1 -2
  92. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_vacuum.hpp +2 -4
  93. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_asof_join.hpp +2 -4
  94. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_blockwise_nl_join.hpp +2 -4
  95. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_cross_product.hpp +1 -2
  96. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_delim_join.hpp +1 -2
  97. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_hash_join.hpp +2 -4
  98. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_iejoin.hpp +2 -4
  99. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_nested_loop_join.hpp +2 -4
  100. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_piecewise_merge_join.hpp +2 -4
  101. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_positional_join.hpp +2 -4
  102. package/src/duckdb/src/include/duckdb/execution/operator/order/physical_order.hpp +2 -4
  103. package/src/duckdb/src/include/duckdb/execution/operator/order/physical_top_n.hpp +2 -4
  104. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_batch_insert.hpp +3 -5
  105. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_copy_to_file.hpp +2 -5
  106. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_delete.hpp +2 -4
  107. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_export.hpp +2 -4
  108. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_insert.hpp +2 -4
  109. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_update.hpp +2 -4
  110. package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_column_data_scan.hpp +1 -2
  111. package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_dummy_scan.hpp +1 -3
  112. package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_empty_result.hpp +1 -2
  113. package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_positional_scan.hpp +1 -2
  114. package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_table_scan.hpp +1 -2
  115. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_alter.hpp +1 -3
  116. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_attach.hpp +1 -3
  117. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_function.hpp +1 -3
  118. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_index.hpp +2 -4
  119. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_schema.hpp +1 -3
  120. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_sequence.hpp +1 -3
  121. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_table.hpp +1 -3
  122. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_type.hpp +2 -5
  123. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_view.hpp +1 -3
  124. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_detach.hpp +1 -3
  125. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_drop.hpp +1 -3
  126. package/src/duckdb/src/include/duckdb/execution/operator/set/physical_recursive_cte.hpp +2 -4
  127. package/src/duckdb/src/include/duckdb/execution/physical_operator.hpp +7 -4
  128. package/src/duckdb/src/include/duckdb/execution/physical_operator_states.hpp +26 -6
  129. package/src/duckdb/src/include/duckdb/execution/radix_partitioned_hashtable.hpp +5 -5
  130. package/src/duckdb/src/include/duckdb/function/aggregate_function.hpp +2 -1
  131. package/src/duckdb/src/include/duckdb/function/table_function.hpp +0 -1
  132. package/src/duckdb/src/include/duckdb/main/client_config.hpp +2 -0
  133. package/src/duckdb/src/include/duckdb/main/config.hpp +2 -0
  134. package/src/duckdb/src/include/duckdb/parallel/event.hpp +1 -1
  135. package/src/duckdb/src/include/duckdb/parallel/interrupt.hpp +63 -0
  136. package/src/duckdb/src/include/duckdb/parallel/pipeline.hpp +16 -3
  137. package/src/duckdb/src/include/duckdb/parallel/pipeline_executor.hpp +51 -7
  138. package/src/duckdb/src/include/duckdb/parallel/task.hpp +21 -2
  139. package/src/duckdb/src/include/duckdb/parallel/task_counter.hpp +2 -2
  140. package/src/duckdb/src/include/duckdb/parallel/task_scheduler.hpp +2 -2
  141. package/src/duckdb/src/include/duckdb/planner/column_binding.hpp +6 -0
  142. package/src/duckdb/src/include/duckdb/planner/expression/bound_columnref_expression.hpp +1 -0
  143. package/src/duckdb/src/include/duckdb/planner/operator/logical_aggregate.hpp +1 -0
  144. package/src/duckdb/src/include/duckdb/planner/operator/logical_column_data_get.hpp +1 -0
  145. package/src/duckdb/src/include/duckdb/planner/operator/logical_cteref.hpp +1 -0
  146. package/src/duckdb/src/include/duckdb/planner/operator/logical_delete.hpp +1 -0
  147. package/src/duckdb/src/include/duckdb/planner/operator/logical_delim_get.hpp +1 -0
  148. package/src/duckdb/src/include/duckdb/planner/operator/logical_dummy_scan.hpp +1 -0
  149. package/src/duckdb/src/include/duckdb/planner/operator/logical_expression_get.hpp +1 -0
  150. package/src/duckdb/src/include/duckdb/planner/operator/logical_insert.hpp +1 -0
  151. package/src/duckdb/src/include/duckdb/planner/operator/logical_pivot.hpp +1 -0
  152. package/src/duckdb/src/include/duckdb/planner/operator/logical_projection.hpp +1 -0
  153. package/src/duckdb/src/include/duckdb/planner/operator/logical_recursive_cte.hpp +1 -0
  154. package/src/duckdb/src/include/duckdb/planner/operator/logical_set_operation.hpp +1 -0
  155. package/src/duckdb/src/include/duckdb/planner/operator/logical_unnest.hpp +1 -0
  156. package/src/duckdb/src/include/duckdb/planner/operator/logical_update.hpp +1 -0
  157. package/src/duckdb/src/include/duckdb/planner/operator/logical_window.hpp +1 -0
  158. package/src/duckdb/src/include/duckdb/storage/data_table.hpp +1 -0
  159. package/src/duckdb/src/include/duckdb/storage/optimistic_data_writer.hpp +46 -0
  160. package/src/duckdb/src/include/duckdb/storage/partial_block_manager.hpp +24 -3
  161. package/src/duckdb/src/include/duckdb/storage/table/column_checkpoint_state.hpp +46 -1
  162. package/src/duckdb/src/include/duckdb/storage/table/column_data.hpp +9 -10
  163. package/src/duckdb/src/include/duckdb/storage/table/column_segment.hpp +1 -1
  164. package/src/duckdb/src/include/duckdb/storage/table/list_column_data.hpp +2 -2
  165. package/src/duckdb/src/include/duckdb/storage/table/row_group.hpp +3 -3
  166. package/src/duckdb/src/include/duckdb/storage/table/row_group_collection.hpp +1 -0
  167. package/src/duckdb/src/include/duckdb/storage/table/segment_base.hpp +1 -1
  168. package/src/duckdb/src/include/duckdb/storage/table/segment_tree.hpp +22 -0
  169. package/src/duckdb/src/include/duckdb/storage/table/standard_column_data.hpp +3 -3
  170. package/src/duckdb/src/include/duckdb/storage/table/struct_column_data.hpp +2 -2
  171. package/src/duckdb/src/include/duckdb/storage/table/update_segment.hpp +0 -2
  172. package/src/duckdb/src/include/duckdb/storage/table/validity_column_data.hpp +1 -2
  173. package/src/duckdb/src/include/duckdb/transaction/local_storage.hpp +9 -34
  174. package/src/duckdb/src/include/duckdb/verification/no_operator_caching_verifier.hpp +25 -0
  175. package/src/duckdb/src/include/duckdb/verification/statement_verifier.hpp +5 -0
  176. package/src/duckdb/src/main/client_verify.cpp +4 -0
  177. package/src/duckdb/src/main/config.cpp +4 -0
  178. package/src/duckdb/src/main/database.cpp +11 -11
  179. package/src/duckdb/src/main/extension/extension_load.cpp +19 -15
  180. package/src/duckdb/src/parallel/event.cpp +1 -1
  181. package/src/duckdb/src/parallel/executor.cpp +39 -3
  182. package/src/duckdb/src/parallel/executor_task.cpp +11 -0
  183. package/src/duckdb/src/parallel/interrupt.cpp +57 -0
  184. package/src/duckdb/src/parallel/pipeline.cpp +49 -6
  185. package/src/duckdb/src/parallel/pipeline_executor.cpp +248 -69
  186. package/src/duckdb/src/parallel/pipeline_initialize_event.cpp +1 -1
  187. package/src/duckdb/src/parallel/task_scheduler.cpp +57 -22
  188. package/src/duckdb/src/parser/base_expression.cpp +6 -0
  189. package/src/duckdb/src/planner/expression/bound_columnref_expression.cpp +17 -3
  190. package/src/duckdb/src/planner/expression/bound_reference_expression.cpp +8 -2
  191. package/src/duckdb/src/planner/operator/logical_aggregate.cpp +13 -1
  192. package/src/duckdb/src/planner/operator/logical_column_data_get.cpp +11 -0
  193. package/src/duckdb/src/planner/operator/logical_cteref.cpp +11 -0
  194. package/src/duckdb/src/planner/operator/logical_delete.cpp +10 -0
  195. package/src/duckdb/src/planner/operator/logical_delim_get.cpp +12 -1
  196. package/src/duckdb/src/planner/operator/logical_dummy_scan.cpp +12 -1
  197. package/src/duckdb/src/planner/operator/logical_expression_get.cpp +12 -1
  198. package/src/duckdb/src/planner/operator/logical_get.cpp +10 -4
  199. package/src/duckdb/src/planner/operator/logical_insert.cpp +12 -1
  200. package/src/duckdb/src/planner/operator/logical_pivot.cpp +11 -0
  201. package/src/duckdb/src/planner/operator/logical_projection.cpp +11 -0
  202. package/src/duckdb/src/planner/operator/logical_recursive_cte.cpp +11 -0
  203. package/src/duckdb/src/planner/operator/logical_set_operation.cpp +11 -0
  204. package/src/duckdb/src/planner/operator/logical_unnest.cpp +12 -1
  205. package/src/duckdb/src/planner/operator/logical_update.cpp +10 -0
  206. package/src/duckdb/src/planner/operator/logical_window.cpp +11 -0
  207. package/src/duckdb/src/storage/checkpoint_manager.cpp +1 -1
  208. package/src/duckdb/src/storage/data_table.cpp +5 -0
  209. package/src/duckdb/src/storage/local_storage.cpp +40 -110
  210. package/src/duckdb/src/storage/optimistic_data_writer.cpp +96 -0
  211. package/src/duckdb/src/storage/partial_block_manager.cpp +73 -9
  212. package/src/duckdb/src/storage/single_file_block_manager.cpp +3 -1
  213. package/src/duckdb/src/storage/standard_buffer_manager.cpp +17 -12
  214. package/src/duckdb/src/storage/statistics/base_statistics.cpp +3 -0
  215. package/src/duckdb/src/storage/table/column_checkpoint_state.cpp +90 -82
  216. package/src/duckdb/src/storage/table/column_data.cpp +19 -45
  217. package/src/duckdb/src/storage/table/column_data_checkpointer.cpp +7 -7
  218. package/src/duckdb/src/storage/table/column_segment.cpp +1 -1
  219. package/src/duckdb/src/storage/table/list_column_data.cpp +6 -11
  220. package/src/duckdb/src/storage/table/row_group.cpp +13 -14
  221. package/src/duckdb/src/storage/table/row_group_collection.cpp +10 -4
  222. package/src/duckdb/src/storage/table/standard_column_data.cpp +6 -10
  223. package/src/duckdb/src/storage/table/struct_column_data.cpp +7 -13
  224. package/src/duckdb/src/storage/table/update_segment.cpp +0 -25
  225. package/src/duckdb/src/storage/table/validity_column_data.cpp +2 -6
  226. package/src/duckdb/src/transaction/commit_state.cpp +4 -4
  227. package/src/duckdb/src/verification/no_operator_caching_verifier.cpp +13 -0
  228. package/src/duckdb/src/verification/statement_verifier.cpp +4 -0
  229. package/src/duckdb/ub_src_core_functions_scalar_string.cpp +2 -0
  230. package/src/duckdb/ub_src_parallel.cpp +2 -0
  231. package/src/duckdb/ub_src_storage.cpp +2 -0
@@ -43,16 +43,16 @@ ColumnCheckpointState &ColumnDataCheckpointer::GetCheckpointState() {
43
43
  void ColumnDataCheckpointer::ScanSegments(const std::function<void(Vector &, idx_t)> &callback) {
44
44
  Vector scan_vector(intermediate.GetType(), nullptr);
45
45
  for (idx_t segment_idx = 0; segment_idx < nodes.size(); segment_idx++) {
46
- auto segment = nodes[segment_idx].node.get();
46
+ auto &segment = *nodes[segment_idx].node;
47
47
  ColumnScanState scan_state;
48
- scan_state.current = segment;
49
- segment->InitializeScan(scan_state);
48
+ scan_state.current = &segment;
49
+ segment.InitializeScan(scan_state);
50
50
 
51
- for (idx_t base_row_index = 0; base_row_index < segment->count; base_row_index += STANDARD_VECTOR_SIZE) {
51
+ for (idx_t base_row_index = 0; base_row_index < segment.count; base_row_index += STANDARD_VECTOR_SIZE) {
52
52
  scan_vector.Reference(intermediate);
53
53
 
54
- idx_t count = MinValue<idx_t>(segment->count - base_row_index, STANDARD_VECTOR_SIZE);
55
- scan_state.row_index = segment->start + base_row_index;
54
+ idx_t count = MinValue<idx_t>(segment.count - base_row_index, STANDARD_VECTOR_SIZE);
55
+ scan_state.row_index = segment.start + base_row_index;
56
56
 
57
57
  col_data.CheckpointScan(segment, scan_state, row_group.start, count, scan_vector);
58
58
 
@@ -250,7 +250,7 @@ void ColumnDataCheckpointer::Checkpoint(vector<SegmentNode<ColumnSegment>> nodes
250
250
  // no changes: only need to write the metadata for this column
251
251
  WritePersistentSegments();
252
252
  } else {
253
- // there are changes: rewrite the set of columns
253
+ // there are changes: rewrite the set of columns);
254
254
  WriteToDisk();
255
255
  }
256
256
  }
@@ -172,7 +172,7 @@ void ColumnSegment::RevertAppend(idx_t start_row) {
172
172
  //===--------------------------------------------------------------------===//
173
173
  // Convert To Persistent
174
174
  //===--------------------------------------------------------------------===//
175
- void ColumnSegment::ConvertToPersistent(BlockManager *block_manager, block_id_t block_id_p) {
175
+ void ColumnSegment::ConvertToPersistent(optional_ptr<BlockManager> block_manager, block_id_t block_id_p) {
176
176
  D_ASSERT(segment_type == ColumnSegmentType::TRANSIENT);
177
177
  segment_type = ColumnSegmentType::PERSISTENT;
178
178
 
@@ -8,19 +8,19 @@
8
8
  namespace duckdb {
9
9
 
10
10
  ListColumnData::ListColumnData(BlockManager &block_manager, DataTableInfo &info, idx_t column_index, idx_t start_row,
11
- LogicalType type_p, ColumnData *parent)
11
+ LogicalType type_p, optional_ptr<ColumnData> parent)
12
12
  : ColumnData(block_manager, info, column_index, start_row, std::move(type_p), parent),
13
- validity(block_manager, info, 0, start_row, this) {
13
+ validity(block_manager, info, 0, start_row, *this) {
14
14
  D_ASSERT(type.InternalType() == PhysicalType::LIST);
15
15
  auto &child_type = ListType::GetChildType(type);
16
16
  // the child column, with column index 1 (0 is the validity mask)
17
17
  child_column = ColumnData::CreateColumnUnique(block_manager, info, 1, start_row, child_type, this);
18
18
  }
19
19
 
20
- ListColumnData::ListColumnData(ColumnData &original, idx_t start_row, ColumnData *parent)
21
- : ColumnData(original, start_row, parent), validity(((ListColumnData &)original).validity, start_row, this) {
22
- auto &list_data = (ListColumnData &)original;
23
- child_column = ColumnData::CreateColumnUnique(*list_data.child_column, start_row, this);
20
+ void ListColumnData::SetStart(idx_t new_start) {
21
+ ColumnData::SetStart(new_start);
22
+ child_column->SetStart(new_start);
23
+ validity.SetStart(new_start);
24
24
  }
25
25
 
26
26
  bool ListColumnData::CheckZonemap(ColumnScanState &state, TableFilter &filter) {
@@ -322,11 +322,6 @@ public:
322
322
  validity_state->WriteDataPointers(writer);
323
323
  child_state->WriteDataPointers(writer);
324
324
  }
325
- void GetBlockIds(unordered_set<block_id_t> &result) override {
326
- ColumnCheckpointState::GetBlockIds(result);
327
- validity_state->GetBlockIds(result);
328
- child_state->GetBlockIds(result);
329
- }
330
325
  };
331
326
 
332
327
  unique_ptr<ColumnCheckpointState> ListColumnData::CreateCheckpointState(RowGroup &row_group,
@@ -45,16 +45,15 @@ RowGroup::RowGroup(RowGroupCollection &collection, RowGroupPointer &&pointer)
45
45
  Verify();
46
46
  }
47
47
 
48
- RowGroup::RowGroup(RowGroup &row_group, RowGroupCollection &collection, idx_t start)
49
- : SegmentBase<RowGroup>(start, row_group.count.load()), collection(collection),
50
- version_info(std::move(row_group.version_info)) {
51
- for (auto &column : row_group.GetColumns()) {
52
- this->columns.push_back(ColumnData::CreateColumn(*column, start));
48
+ void RowGroup::MoveToCollection(RowGroupCollection &collection, idx_t new_start) {
49
+ this->collection = collection;
50
+ this->start = new_start;
51
+ for (auto &column : GetColumns()) {
52
+ column->SetStart(new_start);
53
53
  }
54
54
  if (version_info) {
55
- version_info->SetStart(start);
55
+ version_info->SetStart(new_start);
56
56
  }
57
- Verify();
58
57
  }
59
58
 
60
59
  void VersionNode::SetStart(idx_t start) {
@@ -101,8 +100,8 @@ ColumnData &RowGroup::GetColumn(idx_t c) {
101
100
  if (column_pointers.size() != columns.size()) {
102
101
  throw InternalException("Lazy loading a column but the pointer was not set");
103
102
  }
104
- auto &block_manager = collection.GetBlockManager();
105
- auto &types = collection.GetTypes();
103
+ auto &block_manager = GetCollection().GetBlockManager();
104
+ auto &types = GetCollection().GetTypes();
106
105
  auto &block_pointer = column_pointers[c];
107
106
  MetaBlockReader column_data_reader(block_manager, block_pointer.block_id);
108
107
  column_data_reader.offset = block_pointer.offset;
@@ -113,14 +112,14 @@ ColumnData &RowGroup::GetColumn(idx_t c) {
113
112
  }
114
113
 
115
114
  DatabaseInstance &RowGroup::GetDatabase() {
116
- return collection.GetDatabase();
115
+ return GetCollection().GetDatabase();
117
116
  }
118
117
 
119
118
  BlockManager &RowGroup::GetBlockManager() {
120
- return collection.GetBlockManager();
119
+ return GetCollection().GetBlockManager();
121
120
  }
122
121
  DataTableInfo &RowGroup::GetTableInfo() {
123
- return collection.GetTableInfo();
122
+ return GetCollection().GetTableInfo();
124
123
  }
125
124
 
126
125
  void RowGroup::InitializeEmpty(const vector<LogicalType> &types) {
@@ -231,7 +230,7 @@ unique_ptr<RowGroup> RowGroup::AlterType(RowGroupCollection &new_collection, con
231
230
  column_data->InitializeAppend(append_state);
232
231
 
233
232
  // scan the original table, and fill the new column with the transformed value
234
- scan_state.Initialize(collection.GetTypes());
233
+ scan_state.Initialize(GetCollection().GetTypes());
235
234
  InitializeScan(scan_state);
236
235
 
237
236
  DataChunk append_chunk;
@@ -537,7 +536,7 @@ void RowGroup::Scan(TransactionData transaction, CollectionScanState &state, Dat
537
536
  }
538
537
 
539
538
  void RowGroup::ScanCommitted(CollectionScanState &state, DataChunk &result, TableScanType type) {
540
- auto &transaction_manager = DuckTransactionManager::Get(collection.GetAttached());
539
+ auto &transaction_manager = DuckTransactionManager::Get(GetCollection().GetAttached());
541
540
 
542
541
  auto lowest_active_start = transaction_manager.LowestActiveStart();
543
542
  auto lowest_active_id = transaction_manager.LowestActiveId();
@@ -96,6 +96,10 @@ RowGroup *RowGroupCollection::GetRowGroup(int64_t index) {
96
96
  return (RowGroup *)row_groups->GetSegmentByIndex(index);
97
97
  }
98
98
 
99
+ idx_t RowGroupCollection::RowGroupCount() {
100
+ return row_groups->GetSegmentCount();
101
+ }
102
+
99
103
  void RowGroupCollection::Verify() {
100
104
  #ifdef DEBUG
101
105
  idx_t current_total_rows = 0;
@@ -444,10 +448,12 @@ void RowGroupCollection::RevertAppendInternal(idx_t start_row, idx_t count) {
444
448
  void RowGroupCollection::MergeStorage(RowGroupCollection &data) {
445
449
  D_ASSERT(data.types == types);
446
450
  auto index = row_start + total_rows.load();
447
- for (auto &row_group : data.row_groups->Segments()) {
448
- auto new_group = make_uniq<RowGroup>(row_group, *this, index);
449
- index += new_group->count;
450
- row_groups->AppendSegment(std::move(new_group));
451
+ auto segments = data.row_groups->MoveSegments();
452
+ for (auto &entry : segments) {
453
+ auto &row_group = entry.node;
454
+ row_group->MoveToCollection(*this, index);
455
+ index += row_group->count;
456
+ row_groups->AppendSegment(std::move(row_group));
451
457
  }
452
458
  stats.MergeStats(data.stats);
453
459
  total_rows += data.total_rows.load();
@@ -10,13 +10,14 @@
10
10
  namespace duckdb {
11
11
 
12
12
  StandardColumnData::StandardColumnData(BlockManager &block_manager, DataTableInfo &info, idx_t column_index,
13
- idx_t start_row, LogicalType type, ColumnData *parent)
13
+ idx_t start_row, LogicalType type, optional_ptr<ColumnData> parent)
14
14
  : ColumnData(block_manager, info, column_index, start_row, std::move(type), parent),
15
- validity(block_manager, info, 0, start_row, this) {
15
+ validity(block_manager, info, 0, start_row, *this) {
16
16
  }
17
17
 
18
- StandardColumnData::StandardColumnData(ColumnData &original, idx_t start_row, ColumnData *parent)
19
- : ColumnData(original, start_row, parent), validity(((StandardColumnData &)original).validity, start_row, this) {
18
+ void StandardColumnData::SetStart(idx_t new_start) {
19
+ ColumnData::SetStart(new_start);
20
+ validity.SetStart(new_start);
20
21
  }
21
22
 
22
23
  bool StandardColumnData::CheckZonemap(ColumnScanState &state, TableFilter &filter) {
@@ -176,11 +177,6 @@ public:
176
177
  ColumnCheckpointState::WriteDataPointers(writer);
177
178
  validity_state->WriteDataPointers(writer);
178
179
  }
179
-
180
- void GetBlockIds(unordered_set<block_id_t> &result) override {
181
- ColumnCheckpointState::GetBlockIds(result);
182
- validity_state->GetBlockIds(result);
183
- }
184
180
  };
185
181
 
186
182
  unique_ptr<ColumnCheckpointState>
@@ -198,7 +194,7 @@ unique_ptr<ColumnCheckpointState> StandardColumnData::Checkpoint(RowGroup &row_g
198
194
  return base_state;
199
195
  }
200
196
 
201
- void StandardColumnData::CheckpointScan(ColumnSegment *segment, ColumnScanState &state, idx_t row_group_start,
197
+ void StandardColumnData::CheckpointScan(ColumnSegment &segment, ColumnScanState &state, idx_t row_group_start,
202
198
  idx_t count, Vector &scan_vector) {
203
199
  ColumnData::CheckpointScan(segment, state, row_group_start, count, scan_vector);
204
200
 
@@ -8,9 +8,9 @@
8
8
  namespace duckdb {
9
9
 
10
10
  StructColumnData::StructColumnData(BlockManager &block_manager, DataTableInfo &info, idx_t column_index,
11
- idx_t start_row, LogicalType type_p, ColumnData *parent)
11
+ idx_t start_row, LogicalType type_p, optional_ptr<ColumnData> parent)
12
12
  : ColumnData(block_manager, info, column_index, start_row, std::move(type_p), parent),
13
- validity(block_manager, info, 0, start_row, this) {
13
+ validity(block_manager, info, 0, start_row, *this) {
14
14
  D_ASSERT(type.InternalType() == PhysicalType::STRUCT);
15
15
  auto &child_types = StructType::GetChildTypes(type);
16
16
  D_ASSERT(child_types.size() > 0);
@@ -23,12 +23,12 @@ StructColumnData::StructColumnData(BlockManager &block_manager, DataTableInfo &i
23
23
  }
24
24
  }
25
25
 
26
- StructColumnData::StructColumnData(ColumnData &original, idx_t start_row, ColumnData *parent)
27
- : ColumnData(original, start_row, parent), validity(((StructColumnData &)original).validity, start_row, this) {
28
- auto &struct_data = (StructColumnData &)original;
29
- for (auto &child_col : struct_data.sub_columns) {
30
- sub_columns.push_back(ColumnData::CreateColumnUnique(*child_col, start_row, this));
26
+ void StructColumnData::SetStart(idx_t new_start) {
27
+ this->start = new_start;
28
+ for (auto &sub_column : sub_columns) {
29
+ sub_column->SetStart(new_start);
31
30
  }
31
+ validity.SetStart(new_start);
32
32
  }
33
33
 
34
34
  bool StructColumnData::CheckZonemap(ColumnScanState &state, TableFilter &filter) {
@@ -246,12 +246,6 @@ public:
246
246
  state->WriteDataPointers(writer);
247
247
  }
248
248
  }
249
- void GetBlockIds(unordered_set<block_id_t> &result) override {
250
- validity_state->GetBlockIds(result);
251
- for (auto &state : child_states) {
252
- state->GetBlockIds(result);
253
- }
254
- }
255
249
  };
256
250
 
257
251
  unique_ptr<ColumnCheckpointState> StructColumnData::CreateCheckpointState(RowGroup &row_group,
@@ -37,31 +37,6 @@ UpdateSegment::UpdateSegment(ColumnData &column_data)
37
37
  this->statistics_update_function = GetStatisticsUpdateFunction(physical_type);
38
38
  }
39
39
 
40
- UpdateSegment::UpdateSegment(UpdateSegment &other, ColumnData &owner)
41
- : column_data(owner), root(std::move(other.root)), stats(std::move(other.stats)), type_size(other.type_size) {
42
-
43
- this->heap.Move(other.heap);
44
- // update the segment links
45
- if (root) {
46
- for (idx_t i = 0; i < RowGroup::ROW_GROUP_VECTOR_COUNT; i++) {
47
- if (!root->info[i]) {
48
- continue;
49
- }
50
- for (auto info = root->info[i]->info.get(); info; info = info->next) {
51
- info->segment = this;
52
- }
53
- }
54
- }
55
- initialize_update_function = other.initialize_update_function;
56
- merge_update_function = other.merge_update_function;
57
- fetch_update_function = other.fetch_update_function;
58
- fetch_committed_function = other.fetch_committed_function;
59
- fetch_committed_range = other.fetch_committed_range;
60
- fetch_row_function = other.fetch_row_function;
61
- rollback_update_function = other.rollback_update_function;
62
- statistics_update_function = other.statistics_update_function;
63
- }
64
-
65
40
  UpdateSegment::~UpdateSegment() {
66
41
  }
67
42
 
@@ -5,12 +5,8 @@
5
5
  namespace duckdb {
6
6
 
7
7
  ValidityColumnData::ValidityColumnData(BlockManager &block_manager, DataTableInfo &info, idx_t column_index,
8
- idx_t start_row, ColumnData *parent)
9
- : ColumnData(block_manager, info, column_index, start_row, LogicalType(LogicalTypeId::VALIDITY), parent) {
10
- }
11
-
12
- ValidityColumnData::ValidityColumnData(ColumnData &original, idx_t start_row, ColumnData *parent)
13
- : ColumnData(original, start_row, parent) {
8
+ idx_t start_row, ColumnData &parent)
9
+ : ColumnData(block_manager, info, column_index, start_row, LogicalType(LogicalTypeId::VALIDITY), &parent) {
14
10
  }
15
11
 
16
12
  bool ValidityColumnData::CheckZonemap(ColumnScanState &state, TableFilter &filter) {
@@ -210,10 +210,10 @@ void CommitState::WriteUpdate(UpdateInfo &info) {
210
210
 
211
211
  // construct the column index path
212
212
  vector<column_t> column_indexes;
213
- auto column_data_ptr = &column_data;
214
- while (column_data_ptr->parent) {
215
- column_indexes.push_back(column_data_ptr->column_index);
216
- column_data_ptr = column_data_ptr->parent;
213
+ reference<ColumnData> current_column_data = column_data;
214
+ while (current_column_data.get().parent) {
215
+ column_indexes.push_back(current_column_data.get().column_index);
216
+ current_column_data = *current_column_data.get().parent;
217
217
  }
218
218
  column_indexes.push_back(info.column_index);
219
219
  std::reverse(column_indexes.begin(), column_indexes.end());
@@ -0,0 +1,13 @@
1
+ #include "duckdb/verification/no_operator_caching_verifier.hpp"
2
+
3
+ namespace duckdb {
4
+
5
+ NoOperatorCachingVerifier::NoOperatorCachingVerifier(unique_ptr<SQLStatement> statement_p)
6
+ : StatementVerifier(VerificationType::NO_OPERATOR_CACHING, "No operator caching", std::move(statement_p)) {
7
+ }
8
+
9
+ unique_ptr<StatementVerifier> NoOperatorCachingVerifier::Create(const SQLStatement &statement_p) {
10
+ return make_uniq<NoOperatorCachingVerifier>(statement_p.Copy());
11
+ }
12
+
13
+ } // namespace duckdb
@@ -9,6 +9,7 @@
9
9
  #include "duckdb/verification/parsed_statement_verifier.hpp"
10
10
  #include "duckdb/verification/prepared_statement_verifier.hpp"
11
11
  #include "duckdb/verification/unoptimized_statement_verifier.hpp"
12
+ #include "duckdb/verification/no_operator_caching_verifier.hpp"
12
13
 
13
14
  namespace duckdb {
14
15
 
@@ -35,6 +36,8 @@ unique_ptr<StatementVerifier> StatementVerifier::Create(VerificationType type, c
35
36
  return ParsedStatementVerifier::Create(statement_p);
36
37
  case VerificationType::UNOPTIMIZED:
37
38
  return UnoptimizedStatementVerifier::Create(statement_p);
39
+ case VerificationType::NO_OPERATOR_CACHING:
40
+ return NoOperatorCachingVerifier::Create(statement_p);
38
41
  case VerificationType::PREPARED:
39
42
  return PreparedStatementVerifier::Create(statement_p);
40
43
  case VerificationType::EXTERNAL:
@@ -104,6 +107,7 @@ bool StatementVerifier::Run(
104
107
 
105
108
  context.interrupted = false;
106
109
  context.config.enable_optimizer = !DisableOptimizer();
110
+ context.config.enable_caching_operators = !DisableOperatorCaching();
107
111
  context.config.force_external = ForceExternal();
108
112
  try {
109
113
  auto result = run(query, std::move(statement));
@@ -6,6 +6,8 @@
6
6
 
7
7
  #include "src/core_functions/scalar/string/damerau_levenshtein.cpp"
8
8
 
9
+ #include "src/core_functions/scalar/string/format_bytes.cpp"
10
+
9
11
  #include "src/core_functions/scalar/string/hamming.cpp"
10
12
 
11
13
  #include "src/core_functions/scalar/string/hex.cpp"
@@ -8,6 +8,8 @@
8
8
 
9
9
  #include "src/parallel/event.cpp"
10
10
 
11
+ #include "src/parallel/interrupt.cpp"
12
+
11
13
  #include "src/parallel/pipeline.cpp"
12
14
 
13
15
  #include "src/parallel/pipeline_complete_event.cpp"
@@ -26,6 +26,8 @@
26
26
 
27
27
  #include "src/storage/write_ahead_log.cpp"
28
28
 
29
+ #include "src/storage/optimistic_data_writer.cpp"
30
+
29
31
  #include "src/storage/partial_block_manager.cpp"
30
32
 
31
33
  #include "src/storage/single_file_block_manager.cpp"