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
@@ -29,6 +29,7 @@ public:
29
29
  static unique_ptr<LogicalOperator> Deserialize(LogicalDeserializationState &state, FieldReader &reader);
30
30
  idx_t EstimateCardinality(ClientContext &context) override;
31
31
  vector<idx_t> GetTableIndex() const override;
32
+ string GetName() const override;
32
33
 
33
34
  protected:
34
35
  vector<ColumnBinding> GetColumnBindings() override;
@@ -36,6 +36,7 @@ public:
36
36
  void Serialize(FieldWriter &writer) const override;
37
37
  static unique_ptr<LogicalOperator> Deserialize(LogicalDeserializationState &state, FieldReader &reader);
38
38
  vector<idx_t> GetTableIndex() const override;
39
+ string GetName() const override;
39
40
 
40
41
  protected:
41
42
  void ResolveTypes() override {
@@ -35,6 +35,7 @@ public:
35
35
  void Serialize(FieldWriter &writer) const override;
36
36
  static unique_ptr<LogicalOperator> Deserialize(LogicalDeserializationState &state, FieldReader &reader);
37
37
  vector<idx_t> GetTableIndex() const override;
38
+ string GetName() const override;
38
39
 
39
40
  protected:
40
41
  void ResolveTypes() override {
@@ -41,6 +41,7 @@ public:
41
41
  return expressions.size();
42
42
  }
43
43
  vector<idx_t> GetTableIndex() const override;
44
+ string GetName() const override;
44
45
 
45
46
  protected:
46
47
  void ResolveTypes() override {
@@ -69,5 +69,6 @@ protected:
69
69
 
70
70
  idx_t EstimateCardinality(ClientContext &context) override;
71
71
  vector<idx_t> GetTableIndex() const override;
72
+ string GetName() const override;
72
73
  };
73
74
  } // namespace duckdb
@@ -29,6 +29,7 @@ public:
29
29
  void Serialize(FieldWriter &writer) const override;
30
30
  static unique_ptr<LogicalOperator> Deserialize(LogicalDeserializationState &state, FieldReader &reader);
31
31
  vector<idx_t> GetTableIndex() const override;
32
+ string GetName() const override;
32
33
 
33
34
  protected:
34
35
  void ResolveTypes() override;
@@ -27,6 +27,7 @@ public:
27
27
  void Serialize(FieldWriter &writer) const override;
28
28
  static unique_ptr<LogicalOperator> Deserialize(LogicalDeserializationState &state, FieldReader &reader);
29
29
  vector<idx_t> GetTableIndex() const override;
30
+ string GetName() const override;
30
31
 
31
32
  protected:
32
33
  void ResolveTypes() override;
@@ -41,6 +41,7 @@ public:
41
41
  void Serialize(FieldWriter &writer) const override;
42
42
  static unique_ptr<LogicalOperator> Deserialize(LogicalDeserializationState &state, FieldReader &reader);
43
43
  vector<idx_t> GetTableIndex() const override;
44
+ string GetName() const override;
44
45
 
45
46
  protected:
46
47
  void ResolveTypes() override {
@@ -41,6 +41,7 @@ public:
41
41
  void Serialize(FieldWriter &writer) const override;
42
42
  static unique_ptr<LogicalOperator> Deserialize(LogicalDeserializationState &state, FieldReader &reader);
43
43
  vector<idx_t> GetTableIndex() const override;
44
+ string GetName() const override;
44
45
 
45
46
  protected:
46
47
  void ResolveTypes() override {
@@ -29,6 +29,7 @@ public:
29
29
  void Serialize(FieldWriter &writer) const override;
30
30
  static unique_ptr<LogicalOperator> Deserialize(LogicalDeserializationState &state, FieldReader &reader);
31
31
  vector<idx_t> GetTableIndex() const override;
32
+ string GetName() const override;
32
33
 
33
34
  protected:
34
35
  void ResolveTypes() override;
@@ -34,6 +34,7 @@ public:
34
34
  void Serialize(FieldWriter &writer) const override;
35
35
  static unique_ptr<LogicalOperator> Deserialize(LogicalDeserializationState &state, FieldReader &reader);
36
36
  idx_t EstimateCardinality(ClientContext &context) override;
37
+ string GetName() const override;
37
38
 
38
39
  protected:
39
40
  vector<ColumnBinding> GetColumnBindings() override;
@@ -30,6 +30,7 @@ public:
30
30
  void Serialize(FieldWriter &writer) const override;
31
31
  static unique_ptr<LogicalOperator> Deserialize(LogicalDeserializationState &state, FieldReader &reader);
32
32
  vector<idx_t> GetTableIndex() const override;
33
+ string GetName() const override;
33
34
 
34
35
  protected:
35
36
  void ResolveTypes() override;
@@ -106,6 +106,7 @@ public:
106
106
  void LocalMerge(ClientContext &context, RowGroupCollection &collection);
107
107
  //! Creates an optimistic writer for this table - used for optimistically writing parallel appends
108
108
  OptimisticDataWriter &CreateOptimisticWriter(ClientContext &context);
109
+ void FinalizeOptimisticWriter(ClientContext &context, OptimisticDataWriter &writer);
109
110
 
110
111
  //! Delete the entries with the specified row identifier from the table
111
112
  idx_t Delete(TableCatalogEntry &table, ClientContext &context, Vector &row_ids, idx_t count);
@@ -0,0 +1,46 @@
1
+ //===----------------------------------------------------------------------===//
2
+ // DuckDB
3
+ //
4
+ // duckdb/storage/optimistic_data_writer.hpp
5
+ //
6
+ //
7
+ //===----------------------------------------------------------------------===//
8
+
9
+ #pragma once
10
+
11
+ #include "duckdb/storage/table/row_group_collection.hpp"
12
+
13
+ namespace duckdb {
14
+ class PartialBlockManager;
15
+
16
+ class OptimisticDataWriter {
17
+ public:
18
+ OptimisticDataWriter(DataTable &table);
19
+ OptimisticDataWriter(DataTable &table, OptimisticDataWriter &parent);
20
+ ~OptimisticDataWriter();
21
+
22
+ //! Write a new row group to disk (if possible)
23
+ void WriteNewRowGroup(RowGroupCollection &row_groups);
24
+ //! Write the last row group of a collection to disk
25
+ void WriteLastRowGroup(RowGroupCollection &row_groups);
26
+ //! Final flush of the optimistic writer - fully flushes the partial block manager
27
+ void FinalFlush();
28
+ //! Flushes a specific row group to disk
29
+ void FlushToDisk(RowGroup *row_group);
30
+ //! Merge the partially written blocks from one optimistic writer into another
31
+ void Merge(OptimisticDataWriter &other);
32
+ //! Rollback
33
+ void Rollback();
34
+
35
+ private:
36
+ //! Prepare a write to disk
37
+ bool PrepareWrite();
38
+
39
+ private:
40
+ //! The table
41
+ DataTable &table;
42
+ //! The partial block manager (if we created one yet)
43
+ unique_ptr<PartialBlockManager> partial_manager;
44
+ };
45
+
46
+ } // namespace duckdb
@@ -48,6 +48,14 @@ public:
48
48
  virtual void Flush(idx_t free_space_left) = 0;
49
49
  virtual void Clear() {
50
50
  }
51
+ virtual void Merge(PartialBlock &other, idx_t offset, idx_t other_size);
52
+
53
+ public:
54
+ template <class TARGET>
55
+ TARGET &Cast() {
56
+ D_ASSERT(dynamic_cast<TARGET *>(this));
57
+ return (TARGET &)*this;
58
+ }
51
59
  };
52
60
 
53
61
  struct PartialBlockAllocation {
@@ -61,6 +69,8 @@ struct PartialBlockAllocation {
61
69
  unique_ptr<PartialBlock> partial_block;
62
70
  };
63
71
 
72
+ enum class CheckpointType { FULL_CHECKPOINT, APPEND_TO_TABLE };
73
+
64
74
  //! Enables sharing blocks across some scope. Scope is whatever we want to share
65
75
  //! blocks across. It may be an entire checkpoint or just a single row group.
66
76
  //! In any case, they must share a block manager.
@@ -75,7 +85,8 @@ public:
75
85
  static constexpr const idx_t MAX_BLOCK_MAP_SIZE = 1u << 31;
76
86
 
77
87
  public:
78
- PartialBlockManager(BlockManager &block_manager, uint32_t max_partial_block_size = DEFAULT_MAX_PARTIAL_BLOCK_SIZE,
88
+ PartialBlockManager(BlockManager &block_manager, CheckpointType checkpoint_type,
89
+ uint32_t max_partial_block_size = DEFAULT_MAX_PARTIAL_BLOCK_SIZE,
79
90
  uint32_t max_use_count = DEFAULT_MAX_USE_COUNT);
80
91
  virtual ~PartialBlockManager();
81
92
 
@@ -87,18 +98,25 @@ public:
87
98
 
88
99
  virtual void AllocateBlock(PartialBlockState &state, uint32_t segment_size);
89
100
 
101
+ void Merge(PartialBlockManager &other);
90
102
  //! Register a partially filled block that is filled with "segment_size" entries
91
103
  void RegisterPartialBlock(PartialBlockAllocation &&allocation);
92
104
 
93
- //! Clears all blocks
94
- void Clear();
105
+ //! Clear remaining blocks without writing them to disk
106
+ void ClearBlocks();
107
+
108
+ //! Rollback all data written by this partial block manager
109
+ void Rollback();
95
110
 
96
111
  protected:
97
112
  BlockManager &block_manager;
113
+ CheckpointType checkpoint_type;
98
114
  //! A map of (available space -> PartialBlock) for partially filled blocks
99
115
  //! This is a multimap because there might be outstanding partial blocks with
100
116
  //! the same amount of left-over space
101
117
  multimap<idx_t, unique_ptr<PartialBlock>> partially_filled_blocks;
118
+ //! The set of written blocks
119
+ unordered_set<block_id_t> written_blocks;
102
120
 
103
121
  //! The maximum size (in bytes) at which a partial block will be considered a partial block
104
122
  uint32_t max_partial_block_size;
@@ -109,6 +127,9 @@ protected:
109
127
  //! If successful, returns true and returns the block_id and offset_in_block to write to
110
128
  //! Otherwise, returns false
111
129
  bool GetPartialBlock(idx_t segment_size, unique_ptr<PartialBlock> &state);
130
+
131
+ bool HasBlockAllocation(uint32_t segment_size);
132
+ void AddWrittenBlock(block_id_t block);
112
133
  };
113
134
 
114
135
  } // namespace duckdb
@@ -15,6 +15,7 @@
15
15
  #include "duckdb/storage/table/column_segment.hpp"
16
16
  #include "duckdb/storage/table/column_data.hpp"
17
17
  #include "duckdb/common/unordered_set.hpp"
18
+ #include "duckdb/storage/partial_block_manager.hpp"
18
19
 
19
20
  namespace duckdb {
20
21
  class ColumnData;
@@ -41,7 +42,51 @@ public:
41
42
 
42
43
  virtual void FlushSegment(unique_ptr<ColumnSegment> segment, idx_t segment_size);
43
44
  virtual void WriteDataPointers(RowGroupWriter &writer);
44
- virtual void GetBlockIds(unordered_set<block_id_t> &result);
45
+ };
46
+
47
+ struct PartialBlockForCheckpoint : public PartialBlock {
48
+ struct PartialColumnSegment {
49
+ PartialColumnSegment(ColumnData &data, ColumnSegment &segment, uint32_t offset_in_block)
50
+ : data(data), segment(segment), offset_in_block(offset_in_block) {
51
+ }
52
+
53
+ ColumnData &data;
54
+ ColumnSegment &segment;
55
+ uint32_t offset_in_block;
56
+ };
57
+
58
+ public:
59
+ PartialBlockForCheckpoint(ColumnData &data, ColumnSegment &segment, BlockManager &block_manager,
60
+ PartialBlockState state);
61
+ ~PartialBlockForCheckpoint() override;
62
+
63
+ // We will copy all segment data into the memory of the shared block.
64
+ // Once the block is full (or checkpoint is complete) we'll invoke Flush().
65
+ // This will cause the block to get written to storage (via BlockManger::ConvertToPersistent),
66
+ // and all segments to have their references updated (via ColumnSegment::ConvertToPersistent)
67
+ BlockManager &block_manager;
68
+ shared_ptr<BlockHandle> block;
69
+ vector<PartialColumnSegment> segments;
70
+
71
+ private:
72
+ struct UninitializedRegion {
73
+ idx_t start;
74
+ idx_t end;
75
+ };
76
+ vector<UninitializedRegion> uninitialized_regions;
77
+
78
+ public:
79
+ bool IsFlushed();
80
+
81
+ void AddUninitializedRegion(idx_t start, idx_t end) override;
82
+
83
+ void Flush(idx_t free_space_left) override;
84
+
85
+ void Clear() override;
86
+
87
+ void Merge(PartialBlock &other, idx_t offset, idx_t other_size) override;
88
+
89
+ void AddSegmentToTail(ColumnData &data, ColumnSegment &segment, uint32_t offset_in_block);
45
90
  };
46
91
 
47
92
  } // namespace duckdb
@@ -39,12 +39,11 @@ class ColumnData {
39
39
 
40
40
  public:
41
41
  ColumnData(BlockManager &block_manager, DataTableInfo &info, idx_t column_index, idx_t start_row, LogicalType type,
42
- ColumnData *parent);
43
- ColumnData(ColumnData &other, idx_t start, ColumnData *parent);
42
+ optional_ptr<ColumnData> parent);
44
43
  virtual ~ColumnData();
45
44
 
46
45
  //! The start row
47
- const idx_t start;
46
+ idx_t start;
48
47
  //! The count of the column data
49
48
  idx_t count;
50
49
  //! The block manager
@@ -56,7 +55,7 @@ public:
56
55
  //! The type of the column
57
56
  LogicalType type;
58
57
  //! The parent column (if any)
59
- ColumnData *parent;
58
+ optional_ptr<ColumnData> parent;
60
59
 
61
60
  public:
62
61
  virtual bool CheckZonemap(ColumnScanState &state, TableFilter &filter) = 0;
@@ -70,6 +69,7 @@ public:
70
69
 
71
70
  void IncrementVersion();
72
71
 
72
+ virtual void SetStart(idx_t new_start);
73
73
  //! The root type of the column
74
74
  const LogicalType &RootType() const;
75
75
 
@@ -122,13 +122,13 @@ public:
122
122
  virtual unique_ptr<ColumnCheckpointState>
123
123
  Checkpoint(RowGroup &row_group, PartialBlockManager &partial_block_manager, ColumnCheckpointInfo &checkpoint_info);
124
124
 
125
- virtual void CheckpointScan(ColumnSegment *segment, ColumnScanState &state, idx_t row_group_start, idx_t count,
125
+ virtual void CheckpointScan(ColumnSegment &segment, ColumnScanState &state, idx_t row_group_start, idx_t count,
126
126
  Vector &scan_vector);
127
127
 
128
128
  virtual void DeserializeColumn(Deserializer &source);
129
129
  static shared_ptr<ColumnData> Deserialize(BlockManager &block_manager, DataTableInfo &info, idx_t column_index,
130
130
  idx_t start_row, Deserializer &source, const LogicalType &type,
131
- ColumnData *parent);
131
+ optional_ptr<ColumnData> parent);
132
132
 
133
133
  virtual void GetStorageInfo(idx_t row_group_index, vector<idx_t> col_path, TableStorageInfo &result);
134
134
  virtual void Verify(RowGroup &parent);
@@ -136,12 +136,11 @@ public:
136
136
  bool CheckZonemap(TableFilter &filter);
137
137
 
138
138
  static shared_ptr<ColumnData> CreateColumn(BlockManager &block_manager, DataTableInfo &info, idx_t column_index,
139
- idx_t start_row, const LogicalType &type, ColumnData *parent = nullptr);
140
- static shared_ptr<ColumnData> CreateColumn(ColumnData &other, idx_t start_row, ColumnData *parent = nullptr);
139
+ idx_t start_row, const LogicalType &type,
140
+ optional_ptr<ColumnData> parent = nullptr);
141
141
  static unique_ptr<ColumnData> CreateColumnUnique(BlockManager &block_manager, DataTableInfo &info,
142
142
  idx_t column_index, idx_t start_row, const LogicalType &type,
143
- ColumnData *parent = nullptr);
144
- static unique_ptr<ColumnData> CreateColumnUnique(ColumnData &other, idx_t start_row, ColumnData *parent = nullptr);
143
+ optional_ptr<ColumnData> parent = nullptr);
145
144
 
146
145
  void MergeStatistics(const BaseStatistics &other);
147
146
  void MergeIntoStatistics(BaseStatistics &other);
@@ -93,7 +93,7 @@ public:
93
93
 
94
94
  //! Convert a transient in-memory segment into a persistent segment blocked by an on-disk block.
95
95
  //! Only used during checkpointing.
96
- void ConvertToPersistent(BlockManager *block_manager, block_id_t block_id);
96
+ void ConvertToPersistent(optional_ptr<BlockManager> block_manager, block_id_t block_id);
97
97
  //! Updates pointers to refer to the given block and offset. This is only used
98
98
  //! when sharing a block among segments. This is invoked only AFTER the block is written.
99
99
  void MarkAsPersistent(shared_ptr<BlockHandle> block, uint32_t offset_in_block);
@@ -17,8 +17,7 @@ namespace duckdb {
17
17
  class ListColumnData : public ColumnData {
18
18
  public:
19
19
  ListColumnData(BlockManager &block_manager, DataTableInfo &info, idx_t column_index, idx_t start_row,
20
- LogicalType type, ColumnData *parent = nullptr);
21
- ListColumnData(ColumnData &original, idx_t start_row, ColumnData *parent = nullptr);
20
+ LogicalType type, optional_ptr<ColumnData> parent = nullptr);
22
21
 
23
22
  //! The child-column of the list
24
23
  unique_ptr<ColumnData> child_column;
@@ -26,6 +25,7 @@ public:
26
25
  ValidityColumnData validity;
27
26
 
28
27
  public:
28
+ void SetStart(idx_t new_start) override;
29
29
  bool CheckZonemap(ColumnScanState &state, TableFilter &filter) override;
30
30
 
31
31
  void InitializeScan(ColumnScanState &state) override;
@@ -59,20 +59,20 @@ public:
59
59
  public:
60
60
  RowGroup(RowGroupCollection &collection, idx_t start, idx_t count);
61
61
  RowGroup(RowGroupCollection &collection, RowGroupPointer &&pointer);
62
- RowGroup(RowGroup &row_group, RowGroupCollection &collection, idx_t start);
63
62
  ~RowGroup();
64
63
 
65
64
  private:
66
65
  //! The RowGroupCollection this row-group is a part of
67
- RowGroupCollection &collection;
66
+ reference<RowGroupCollection> collection;
68
67
  //! The version info of the row_group (inserted and deleted tuple info)
69
68
  shared_ptr<VersionNode> version_info;
70
69
  //! The column data of the row_group
71
70
  vector<shared_ptr<ColumnData>> columns;
72
71
 
73
72
  public:
73
+ void MoveToCollection(RowGroupCollection &collection, idx_t new_start);
74
74
  RowGroupCollection &GetCollection() {
75
- return collection;
75
+ return collection.get();
76
76
  }
77
77
  DatabaseInstance &GetDatabase();
78
78
  BlockManager &GetBlockManager();
@@ -44,6 +44,7 @@ public:
44
44
  void AppendRowGroup(SegmentLock &l, idx_t start_row);
45
45
  //! Get the nth row-group, negative numbers start from the back (so -1 is the last row group, etc)
46
46
  RowGroup *GetRowGroup(int64_t index);
47
+ idx_t RowGroupCount();
47
48
  void Verify();
48
49
 
49
50
  void InitializeScan(CollectionScanState &state, const vector<column_t> &column_ids, TableFilterSet *table_filters);
@@ -27,7 +27,7 @@ public:
27
27
  }
28
28
 
29
29
  //! The start row id of this chunk
30
- const idx_t start;
30
+ idx_t start;
31
31
  //! The amount of entries in this storage chunk
32
32
  atomic<idx_t> count;
33
33
  //! The next segment after this one
@@ -63,6 +63,14 @@ public:
63
63
  LoadAllSegments(l);
64
64
  return std::move(nodes);
65
65
  }
66
+ vector<SegmentNode<T>> MoveSegments() {
67
+ auto l = Lock();
68
+ return MoveSegments(l);
69
+ }
70
+ idx_t GetSegmentCount() {
71
+ auto l = Lock();
72
+ return nodes.size();
73
+ }
66
74
  //! Gets a pointer to the nth segment. Negative numbers start from the back.
67
75
  T *GetSegmentByIndex(int64_t index) {
68
76
  auto l = Lock();
@@ -243,6 +251,20 @@ public:
243
251
  return SegmentIterationHelper(*this);
244
252
  }
245
253
 
254
+ void Reinitialize() {
255
+ if (nodes.empty()) {
256
+ return;
257
+ }
258
+ idx_t offset = nodes[0].node->start;
259
+ for (auto &entry : nodes) {
260
+ if (entry.node->start != offset) {
261
+ throw InternalException("In SegmentTree::Reinitialize - gap found between nodes!");
262
+ }
263
+ entry.row_start = offset;
264
+ offset += entry.node->count;
265
+ }
266
+ }
267
+
246
268
  protected:
247
269
  atomic<bool> finished_loading;
248
270
 
@@ -17,13 +17,13 @@ namespace duckdb {
17
17
  class StandardColumnData : public ColumnData {
18
18
  public:
19
19
  StandardColumnData(BlockManager &block_manager, DataTableInfo &info, idx_t column_index, idx_t start_row,
20
- LogicalType type, ColumnData *parent = nullptr);
21
- StandardColumnData(ColumnData &original, idx_t start_row, ColumnData *parent = nullptr);
20
+ LogicalType type, optional_ptr<ColumnData> parent = nullptr);
22
21
 
23
22
  //! The validity column data
24
23
  ValidityColumnData validity;
25
24
 
26
25
  public:
26
+ void SetStart(idx_t new_start) override;
27
27
  bool CheckZonemap(ColumnScanState &state, TableFilter &filter) override;
28
28
 
29
29
  void InitializeScan(ColumnScanState &state) override;
@@ -51,7 +51,7 @@ public:
51
51
  PartialBlockManager &partial_block_manager) override;
52
52
  unique_ptr<ColumnCheckpointState> Checkpoint(RowGroup &row_group, PartialBlockManager &partial_block_manager,
53
53
  ColumnCheckpointInfo &checkpoint_info) override;
54
- void CheckpointScan(ColumnSegment *segment, ColumnScanState &state, idx_t row_group_start, idx_t count,
54
+ void CheckpointScan(ColumnSegment &segment, ColumnScanState &state, idx_t row_group_start, idx_t count,
55
55
  Vector &scan_vector) override;
56
56
 
57
57
  void DeserializeColumn(Deserializer &source) override;
@@ -17,8 +17,7 @@ namespace duckdb {
17
17
  class StructColumnData : public ColumnData {
18
18
  public:
19
19
  StructColumnData(BlockManager &block_manager, DataTableInfo &info, idx_t column_index, idx_t start_row,
20
- LogicalType type, ColumnData *parent = nullptr);
21
- StructColumnData(ColumnData &original, idx_t start_row, ColumnData *parent = nullptr);
20
+ LogicalType type, optional_ptr<ColumnData> parent = nullptr);
22
21
 
23
22
  //! The sub-columns of the struct
24
23
  vector<unique_ptr<ColumnData>> sub_columns;
@@ -26,6 +25,7 @@ public:
26
25
  ValidityColumnData validity;
27
26
 
28
27
  public:
28
+ void SetStart(idx_t new_start) override;
29
29
  bool CheckZonemap(ColumnScanState &state, TableFilter &filter) override;
30
30
  idx_t GetMaxEntry() override;
31
31
 
@@ -23,8 +23,6 @@ struct UpdateNode;
23
23
  class UpdateSegment {
24
24
  public:
25
25
  UpdateSegment(ColumnData &column_data);
26
- // Construct a duplicate of 'other' with 'new_owner' as it's column data
27
- UpdateSegment(UpdateSegment &other, ColumnData &new_owner);
28
26
  ~UpdateSegment();
29
27
 
30
28
  ColumnData &column_data;
@@ -16,8 +16,7 @@ namespace duckdb {
16
16
  class ValidityColumnData : public ColumnData {
17
17
  public:
18
18
  ValidityColumnData(BlockManager &block_manager, DataTableInfo &info, idx_t column_index, idx_t start_row,
19
- ColumnData *parent);
20
- ValidityColumnData(ColumnData &original, idx_t start_row, ColumnData *parent = nullptr);
19
+ ColumnData &parent);
21
20
 
22
21
  public:
23
22
  bool CheckZonemap(ColumnScanState &state, TableFilter &filter) override;
@@ -11,6 +11,7 @@
11
11
  #include "duckdb/storage/table/row_group_collection.hpp"
12
12
  #include "duckdb/storage/table/table_index_list.hpp"
13
13
  #include "duckdb/storage/table/table_statistics.hpp"
14
+ #include "duckdb/storage/optimistic_data_writer.hpp"
14
15
 
15
16
  namespace duckdb {
16
17
  class AttachedDatabase;
@@ -20,35 +21,6 @@ class WriteAheadLog;
20
21
  struct LocalAppendState;
21
22
  struct TableAppendState;
22
23
 
23
- class OptimisticDataWriter {
24
- public:
25
- OptimisticDataWriter(DataTable &table);
26
- OptimisticDataWriter(DataTable &table, OptimisticDataWriter &parent);
27
- ~OptimisticDataWriter();
28
-
29
- void CheckFlushToDisk(RowGroupCollection &row_groups);
30
- //! Flushes a specific row group to disk
31
- void FlushToDisk(RowGroup *row_group);
32
- //! Flushes the final row group to disk (if any)
33
- void FlushToDisk(RowGroupCollection &row_groups, bool force = false);
34
- //! Final flush: flush the partial block manager to disk
35
- void FinalFlush();
36
-
37
- void Rollback();
38
-
39
- private:
40
- //! Prepare a write to disk
41
- bool PrepareWrite();
42
-
43
- private:
44
- //! The table
45
- DataTable &table;
46
- //! The partial block manager (if we created one yet)
47
- unique_ptr<PartialBlockManager> partial_manager;
48
- //! The set of blocks that have been pre-emptively written to disk
49
- unordered_set<block_id_t> written_blocks;
50
- };
51
-
52
24
  class LocalTableStorage : public std::enable_shared_from_this<LocalTableStorage> {
53
25
  public:
54
26
  // Create a new LocalTableStorage
@@ -76,13 +48,14 @@ public:
76
48
  OptimisticDataWriter optimistic_writer;
77
49
  //! The set of all optimistic data writers associated with this table
78
50
  vector<unique_ptr<OptimisticDataWriter>> optimistic_writers;
51
+ //! Whether or not storage was merged
52
+ bool merged_storage = false;
79
53
 
80
54
  public:
81
55
  void InitializeScan(CollectionScanState &state, optional_ptr<TableFilterSet> table_filters = nullptr);
82
- //! Check if we should flush the previously written row-group to disk
83
- void CheckFlushToDisk();
84
- //! Flushes the final row group to disk (if any)
85
- void FlushToDisk();
56
+ //! Write a new row group to disk (if possible)
57
+ void WriteNewRowGroup();
58
+ void FlushBlocks();
86
59
  void Rollback();
87
60
  idx_t EstimatedSize();
88
61
 
@@ -93,6 +66,7 @@ public:
93
66
 
94
67
  //! Creates an optimistic writer for this table
95
68
  OptimisticDataWriter &CreateOptimisticWriter();
69
+ void FinalizeOptimisticWriter(OptimisticDataWriter &writer);
96
70
  };
97
71
 
98
72
  class LocalTableManager {
@@ -114,7 +88,7 @@ private:
114
88
  class LocalStorage {
115
89
  public:
116
90
  // Threshold to merge row groups instead of appending
117
- static constexpr const idx_t MERGE_THRESHOLD = RowGroup::ROW_GROUP_SIZE / 2;
91
+ static constexpr const idx_t MERGE_THRESHOLD = RowGroup::ROW_GROUP_SIZE;
118
92
 
119
93
  public:
120
94
  struct CommitState {
@@ -150,6 +124,7 @@ public:
150
124
  void LocalMerge(DataTable &table, RowGroupCollection &collection);
151
125
  //! Create an optimistic writer for the specified table
152
126
  OptimisticDataWriter &CreateOptimisticWriter(DataTable &table);
127
+ void FinalizeOptimisticWriter(DataTable &table, OptimisticDataWriter &writer);
153
128
 
154
129
  //! Delete a set of rows from the local storage
155
130
  idx_t Delete(DataTable &table, Vector &row_ids, idx_t count);
@@ -0,0 +1,25 @@
1
+ //===----------------------------------------------------------------------===//
2
+ // DuckDB
3
+ //
4
+ // duckdb/verification/unoptimized_statement_verifier.hpp
5
+ //
6
+ //
7
+ //===----------------------------------------------------------------------===//
8
+
9
+ #pragma once
10
+
11
+ #include "duckdb/verification/statement_verifier.hpp"
12
+
13
+ namespace duckdb {
14
+
15
+ class NoOperatorCachingVerifier : public StatementVerifier {
16
+ public:
17
+ explicit NoOperatorCachingVerifier(unique_ptr<SQLStatement> statement_p);
18
+ static unique_ptr<StatementVerifier> Create(const SQLStatement &statement_p);
19
+
20
+ bool DisableOperatorCaching() const override {
21
+ return true;
22
+ }
23
+ };
24
+
25
+ } // namespace duckdb