duckdb 0.7.2-dev2507.0 → 0.7.2-dev2675.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 (254) hide show
  1. package/binding.gyp +7 -7
  2. package/package.json +2 -2
  3. package/src/connection.cpp +1 -1
  4. package/src/duckdb/extension/icu/icu-dateadd.cpp +3 -3
  5. package/src/duckdb/extension/icu/icu-datepart.cpp +3 -3
  6. package/src/duckdb/extension/icu/icu-datesub.cpp +2 -2
  7. package/src/duckdb/extension/icu/icu-datetrunc.cpp +1 -1
  8. package/src/duckdb/extension/icu/icu-extension.cpp +3 -3
  9. package/src/duckdb/extension/icu/icu-list-range.cpp +2 -2
  10. package/src/duckdb/extension/icu/icu-makedate.cpp +1 -1
  11. package/src/duckdb/extension/icu/icu-strptime.cpp +4 -4
  12. package/src/duckdb/extension/icu/icu-table-range.cpp +2 -2
  13. package/src/duckdb/extension/icu/icu-timebucket.cpp +1 -1
  14. package/src/duckdb/extension/icu/icu-timezone.cpp +4 -4
  15. package/src/duckdb/extension/json/json-extension.cpp +6 -6
  16. package/src/duckdb/extension/parquet/parquet-extension.cpp +9 -8
  17. package/src/duckdb/extension/parquet/parquet_statistics.cpp +3 -0
  18. package/src/duckdb/src/catalog/catalog.cpp +166 -127
  19. package/src/duckdb/src/catalog/catalog_entry/copy_function_catalog_entry.cpp +3 -3
  20. package/src/duckdb/src/catalog/catalog_entry/duck_index_entry.cpp +1 -1
  21. package/src/duckdb/src/catalog/catalog_entry/duck_schema_entry.cpp +90 -82
  22. package/src/duckdb/src/catalog/catalog_entry/duck_table_entry.cpp +65 -67
  23. package/src/duckdb/src/catalog/catalog_entry/index_catalog_entry.cpp +3 -3
  24. package/src/duckdb/src/catalog/catalog_entry/pragma_function_catalog_entry.cpp +4 -4
  25. package/src/duckdb/src/catalog/catalog_entry/scalar_function_catalog_entry.cpp +8 -8
  26. package/src/duckdb/src/catalog/catalog_entry/scalar_macro_catalog_entry.cpp +10 -10
  27. package/src/duckdb/src/catalog/catalog_entry/schema_catalog_entry.cpp +6 -6
  28. package/src/duckdb/src/catalog/catalog_entry/sequence_catalog_entry.cpp +6 -6
  29. package/src/duckdb/src/catalog/catalog_entry/table_catalog_entry.cpp +4 -4
  30. package/src/duckdb/src/catalog/catalog_entry/table_function_catalog_entry.cpp +9 -9
  31. package/src/duckdb/src/catalog/catalog_entry/type_catalog_entry.cpp +5 -5
  32. package/src/duckdb/src/catalog/catalog_entry/view_catalog_entry.cpp +23 -23
  33. package/src/duckdb/src/catalog/catalog_entry.cpp +27 -6
  34. package/src/duckdb/src/catalog/catalog_search_path.cpp +2 -2
  35. package/src/duckdb/src/catalog/catalog_set.cpp +84 -87
  36. package/src/duckdb/src/catalog/catalog_transaction.cpp +1 -1
  37. package/src/duckdb/src/catalog/default/default_functions.cpp +1 -1
  38. package/src/duckdb/src/catalog/default/default_schemas.cpp +1 -1
  39. package/src/duckdb/src/catalog/default/default_types.cpp +1 -1
  40. package/src/duckdb/src/catalog/default/default_views.cpp +1 -1
  41. package/src/duckdb/src/catalog/dependency_list.cpp +2 -2
  42. package/src/duckdb/src/catalog/dependency_manager.cpp +9 -10
  43. package/src/duckdb/src/catalog/duck_catalog.cpp +30 -26
  44. package/src/duckdb/src/catalog/similar_catalog_entry.cpp +1 -1
  45. package/src/duckdb/src/common/radix_partitioning.cpp +1 -1
  46. package/src/duckdb/src/common/types.cpp +15 -27
  47. package/src/duckdb/src/execution/index/art/art.cpp +286 -269
  48. package/src/duckdb/src/execution/index/art/art_key.cpp +22 -32
  49. package/src/duckdb/src/execution/index/art/fixed_size_allocator.cpp +224 -0
  50. package/src/duckdb/src/execution/index/art/iterator.cpp +142 -123
  51. package/src/duckdb/src/execution/index/art/leaf.cpp +319 -170
  52. package/src/duckdb/src/execution/index/art/leaf_segment.cpp +42 -0
  53. package/src/duckdb/src/execution/index/art/node.cpp +444 -379
  54. package/src/duckdb/src/execution/index/art/node16.cpp +178 -114
  55. package/src/duckdb/src/execution/index/art/node256.cpp +117 -79
  56. package/src/duckdb/src/execution/index/art/node4.cpp +169 -114
  57. package/src/duckdb/src/execution/index/art/node48.cpp +175 -105
  58. package/src/duckdb/src/execution/index/art/prefix.cpp +405 -127
  59. package/src/duckdb/src/execution/index/art/prefix_segment.cpp +42 -0
  60. package/src/duckdb/src/execution/index/art/swizzleable_pointer.cpp +10 -85
  61. package/src/duckdb/src/execution/operator/join/physical_index_join.cpp +4 -3
  62. package/src/duckdb/src/execution/operator/persistent/base_csv_reader.cpp +2 -2
  63. package/src/duckdb/src/execution/operator/persistent/csv_reader_options.cpp +2 -0
  64. package/src/duckdb/src/execution/operator/persistent/physical_batch_insert.cpp +4 -3
  65. package/src/duckdb/src/execution/operator/persistent/physical_export.cpp +19 -18
  66. package/src/duckdb/src/execution/operator/persistent/physical_insert.cpp +5 -5
  67. package/src/duckdb/src/execution/operator/schema/physical_alter.cpp +1 -1
  68. package/src/duckdb/src/execution/operator/schema/physical_create_function.cpp +1 -1
  69. package/src/duckdb/src/execution/operator/schema/physical_create_index.cpp +17 -17
  70. package/src/duckdb/src/execution/operator/schema/physical_create_schema.cpp +1 -1
  71. package/src/duckdb/src/execution/operator/schema/physical_create_sequence.cpp +1 -1
  72. package/src/duckdb/src/execution/operator/schema/physical_create_table.cpp +2 -2
  73. package/src/duckdb/src/execution/operator/schema/physical_create_type.cpp +4 -3
  74. package/src/duckdb/src/execution/operator/schema/physical_create_view.cpp +1 -1
  75. package/src/duckdb/src/execution/operator/schema/physical_detach.cpp +1 -1
  76. package/src/duckdb/src/execution/operator/schema/physical_drop.cpp +2 -2
  77. package/src/duckdb/src/execution/physical_plan/plan_aggregate.cpp +1 -1
  78. package/src/duckdb/src/execution/physical_plan/plan_comparison_join.cpp +4 -4
  79. package/src/duckdb/src/execution/physical_plan/plan_create_table.cpp +4 -3
  80. package/src/duckdb/src/execution/physical_plan/plan_delete.cpp +1 -1
  81. package/src/duckdb/src/execution/physical_plan/plan_insert.cpp +1 -1
  82. package/src/duckdb/src/execution/physical_plan/plan_update.cpp +1 -1
  83. package/src/duckdb/src/function/built_in_functions.cpp +10 -10
  84. package/src/duckdb/src/function/function_binder.cpp +3 -3
  85. package/src/duckdb/src/function/scalar/list/list_aggregates.cpp +5 -6
  86. package/src/duckdb/src/function/scalar/operators/arithmetic.cpp +2 -2
  87. package/src/duckdb/src/function/scalar/sequence/nextval.cpp +9 -8
  88. package/src/duckdb/src/function/scalar/system/aggregate_export.cpp +6 -6
  89. package/src/duckdb/src/function/table/arrow.cpp +5 -5
  90. package/src/duckdb/src/function/table/read_csv.cpp +5 -1
  91. package/src/duckdb/src/function/table/system/duckdb_columns.cpp +8 -7
  92. package/src/duckdb/src/function/table/system/duckdb_constraints.cpp +14 -14
  93. package/src/duckdb/src/function/table/system/duckdb_databases.cpp +2 -2
  94. package/src/duckdb/src/function/table/system/duckdb_functions.cpp +26 -25
  95. package/src/duckdb/src/function/table/system/duckdb_indexes.cpp +13 -12
  96. package/src/duckdb/src/function/table/system/duckdb_schemas.cpp +7 -7
  97. package/src/duckdb/src/function/table/system/duckdb_sequences.cpp +8 -9
  98. package/src/duckdb/src/function/table/system/duckdb_tables.cpp +10 -9
  99. package/src/duckdb/src/function/table/system/duckdb_types.cpp +13 -13
  100. package/src/duckdb/src/function/table/system/duckdb_views.cpp +11 -10
  101. package/src/duckdb/src/function/table/system/pragma_collations.cpp +2 -2
  102. package/src/duckdb/src/function/table/system/pragma_database_size.cpp +5 -5
  103. package/src/duckdb/src/function/table/system/pragma_storage_info.cpp +3 -3
  104. package/src/duckdb/src/function/table/system/pragma_table_info.cpp +2 -2
  105. package/src/duckdb/src/function/table/table_scan.cpp +39 -37
  106. package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
  107. package/src/duckdb/src/function/udf_function.cpp +2 -2
  108. package/src/duckdb/src/include/duckdb/catalog/catalog.hpp +122 -81
  109. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/aggregate_function_catalog_entry.hpp +2 -3
  110. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/collate_catalog_entry.hpp +3 -3
  111. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/copy_function_catalog_entry.hpp +1 -1
  112. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_index_entry.hpp +1 -1
  113. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_schema_entry.hpp +24 -20
  114. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_table_entry.hpp +3 -3
  115. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/index_catalog_entry.hpp +1 -1
  116. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/macro_catalog_entry.hpp +2 -2
  117. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/pragma_function_catalog_entry.hpp +1 -1
  118. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/scalar_function_catalog_entry.hpp +2 -2
  119. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/scalar_macro_catalog_entry.hpp +1 -1
  120. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/schema_catalog_entry.hpp +22 -17
  121. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/sequence_catalog_entry.hpp +1 -1
  122. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_catalog_entry.hpp +1 -1
  123. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_function_catalog_entry.hpp +2 -2
  124. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_macro_catalog_entry.hpp +1 -1
  125. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/type_catalog_entry.hpp +1 -1
  126. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/view_catalog_entry.hpp +3 -3
  127. package/src/duckdb/src/include/duckdb/catalog/catalog_entry.hpp +28 -7
  128. package/src/duckdb/src/include/duckdb/catalog/catalog_set.hpp +20 -19
  129. package/src/duckdb/src/include/duckdb/catalog/duck_catalog.hpp +9 -9
  130. package/src/duckdb/src/include/duckdb/catalog/similar_catalog_entry.hpp +2 -1
  131. package/src/duckdb/src/include/duckdb/catalog/standard_entry.hpp +10 -4
  132. package/src/duckdb/src/include/duckdb/common/enums/on_entry_not_found.hpp +17 -0
  133. package/src/duckdb/src/include/duckdb/common/queue.hpp +1 -1
  134. package/src/duckdb/src/include/duckdb/common/types.hpp +3 -4
  135. package/src/duckdb/src/include/duckdb/execution/index/art/art.hpp +53 -45
  136. package/src/duckdb/src/include/duckdb/execution/index/art/art_key.hpp +29 -24
  137. package/src/duckdb/src/include/duckdb/execution/index/art/fixed_size_allocator.hpp +114 -0
  138. package/src/duckdb/src/include/duckdb/execution/index/art/iterator.hpp +26 -20
  139. package/src/duckdb/src/include/duckdb/execution/index/art/leaf.hpp +63 -39
  140. package/src/duckdb/src/include/duckdb/execution/index/art/leaf_segment.hpp +36 -0
  141. package/src/duckdb/src/include/duckdb/execution/index/art/node.hpp +98 -116
  142. package/src/duckdb/src/include/duckdb/execution/index/art/node16.hpp +48 -36
  143. package/src/duckdb/src/include/duckdb/execution/index/art/node256.hpp +52 -35
  144. package/src/duckdb/src/include/duckdb/execution/index/art/node4.hpp +46 -36
  145. package/src/duckdb/src/include/duckdb/execution/index/art/node48.hpp +57 -35
  146. package/src/duckdb/src/include/duckdb/execution/index/art/prefix.hpp +57 -50
  147. package/src/duckdb/src/include/duckdb/execution/index/art/prefix_segment.hpp +40 -0
  148. package/src/duckdb/src/include/duckdb/execution/index/art/swizzleable_pointer.hpp +38 -31
  149. package/src/duckdb/src/include/duckdb/execution/operator/persistent/csv_file_handle.hpp +2 -1
  150. package/src/duckdb/src/include/duckdb/execution/operator/persistent/csv_reader_options.hpp +2 -0
  151. package/src/duckdb/src/include/duckdb/function/function_serialization.hpp +4 -4
  152. package/src/duckdb/src/include/duckdb/function/scalar_function.hpp +3 -2
  153. package/src/duckdb/src/include/duckdb/function/table/table_scan.hpp +5 -4
  154. package/src/duckdb/src/include/duckdb/function/table_function.hpp +28 -15
  155. package/src/duckdb/src/include/duckdb/main/attached_database.hpp +2 -0
  156. package/src/duckdb/src/include/duckdb/main/client_context.hpp +1 -1
  157. package/src/duckdb/src/include/duckdb/main/database_manager.hpp +3 -2
  158. package/src/duckdb/src/include/duckdb/parser/expression/bound_expression.hpp +2 -0
  159. package/src/duckdb/src/include/duckdb/parser/keyword_helper.hpp +2 -2
  160. package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_info.hpp +7 -5
  161. package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_table_info.hpp +1 -1
  162. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_table_info.hpp +1 -1
  163. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_view_info.hpp +1 -1
  164. package/src/duckdb/src/include/duckdb/parser/parsed_data/detach_info.hpp +3 -2
  165. package/src/duckdb/src/include/duckdb/parser/parsed_data/drop_info.hpp +5 -5
  166. package/src/duckdb/src/include/duckdb/parser/parsed_data/parse_info.hpp +13 -0
  167. package/src/duckdb/src/include/duckdb/parser/statement/insert_statement.hpp +4 -1
  168. package/src/duckdb/src/include/duckdb/parser/tableref.hpp +5 -2
  169. package/src/duckdb/src/include/duckdb/parser/transformer.hpp +4 -1
  170. package/src/duckdb/src/include/duckdb/planner/binder.hpp +2 -2
  171. package/src/duckdb/src/include/duckdb/planner/expression_binder/base_select_binder.hpp +1 -2
  172. package/src/duckdb/src/include/duckdb/planner/expression_binder.hpp +4 -7
  173. package/src/duckdb/src/include/duckdb/planner/operator/logical_get.hpp +1 -1
  174. package/src/duckdb/src/include/duckdb/storage/buffer_manager.hpp +0 -5
  175. package/src/duckdb/src/include/duckdb/storage/index.hpp +13 -28
  176. package/src/duckdb/src/include/duckdb/storage/standard_buffer_manager.hpp +0 -2
  177. package/src/duckdb/src/include/duckdb/transaction/cleanup_state.hpp +5 -0
  178. package/src/duckdb/src/include/duckdb/transaction/transaction.hpp +12 -0
  179. package/src/duckdb/src/include/duckdb.h +26 -0
  180. package/src/duckdb/src/main/attached_database.cpp +12 -6
  181. package/src/duckdb/src/main/capi/helper-c.cpp +7 -0
  182. package/src/duckdb/src/main/capi/table_function-c.cpp +17 -16
  183. package/src/duckdb/src/main/client_context.cpp +12 -11
  184. package/src/duckdb/src/main/database_manager.cpp +13 -12
  185. package/src/duckdb/src/optimizer/join_order/cardinality_estimator.cpp +1 -2
  186. package/src/duckdb/src/parser/parsed_data/alter_info.cpp +3 -3
  187. package/src/duckdb/src/parser/parsed_data/alter_scalar_function_info.cpp +2 -2
  188. package/src/duckdb/src/parser/parsed_data/alter_table_function_info.cpp +2 -2
  189. package/src/duckdb/src/parser/parsed_data/alter_table_info.cpp +9 -9
  190. package/src/duckdb/src/parser/parsed_data/create_scalar_function_info.cpp +2 -2
  191. package/src/duckdb/src/parser/parsed_data/create_table_function_info.cpp +2 -2
  192. package/src/duckdb/src/parser/parsed_data/create_table_info.cpp +2 -2
  193. package/src/duckdb/src/parser/parsed_data/create_view_info.cpp +2 -2
  194. package/src/duckdb/src/parser/statement/insert_statement.cpp +15 -6
  195. package/src/duckdb/src/parser/transform/constraint/transform_constraint.cpp +1 -1
  196. package/src/duckdb/src/parser/transform/expression/transform_function.cpp +18 -5
  197. package/src/duckdb/src/parser/transform/statement/transform_alter_sequence.cpp +3 -2
  198. package/src/duckdb/src/parser/transform/statement/transform_alter_table.cpp +5 -1
  199. package/src/duckdb/src/parser/transform/statement/transform_detach.cpp +1 -1
  200. package/src/duckdb/src/parser/transform/statement/transform_drop.cpp +1 -1
  201. package/src/duckdb/src/parser/transform/statement/transform_insert.cpp +5 -7
  202. package/src/duckdb/src/parser/transform/statement/transform_rename.cpp +1 -1
  203. package/src/duckdb/src/planner/binder/expression/bind_aggregate_expression.cpp +26 -27
  204. package/src/duckdb/src/planner/binder/expression/bind_between_expression.cpp +17 -17
  205. package/src/duckdb/src/planner/binder/expression/bind_case_expression.cpp +9 -9
  206. package/src/duckdb/src/planner/binder/expression/bind_cast_expression.cpp +6 -6
  207. package/src/duckdb/src/planner/binder/expression/bind_collate_expression.cpp +6 -6
  208. package/src/duckdb/src/planner/binder/expression/bind_columnref_expression.cpp +2 -2
  209. package/src/duckdb/src/planner/binder/expression/bind_comparison_expression.cpp +21 -21
  210. package/src/duckdb/src/planner/binder/expression/bind_conjunction_expression.cpp +2 -3
  211. package/src/duckdb/src/planner/binder/expression/bind_function_expression.cpp +33 -36
  212. package/src/duckdb/src/planner/binder/expression/bind_macro_expression.cpp +5 -5
  213. package/src/duckdb/src/planner/binder/expression/bind_operator_expression.cpp +23 -23
  214. package/src/duckdb/src/planner/binder/expression/bind_subquery_expression.cpp +4 -4
  215. package/src/duckdb/src/planner/binder/expression/bind_unnest_expression.cpp +7 -7
  216. package/src/duckdb/src/planner/binder/expression/bind_window_expression.cpp +23 -23
  217. package/src/duckdb/src/planner/binder/query_node/bind_table_macro_node.cpp +4 -4
  218. package/src/duckdb/src/planner/binder/statement/bind_copy.cpp +14 -13
  219. package/src/duckdb/src/planner/binder/statement/bind_create.cpp +56 -42
  220. package/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +3 -3
  221. package/src/duckdb/src/planner/binder/statement/bind_delete.cpp +1 -1
  222. package/src/duckdb/src/planner/binder/statement/bind_drop.cpp +4 -4
  223. package/src/duckdb/src/planner/binder/statement/bind_export.cpp +10 -10
  224. package/src/duckdb/src/planner/binder/statement/bind_insert.cpp +16 -11
  225. package/src/duckdb/src/planner/binder/statement/bind_pragma.cpp +4 -4
  226. package/src/duckdb/src/planner/binder/statement/bind_simple.cpp +5 -4
  227. package/src/duckdb/src/planner/binder/statement/bind_update.cpp +1 -1
  228. package/src/duckdb/src/planner/binder/tableref/bind_basetableref.cpp +3 -3
  229. package/src/duckdb/src/planner/binder/tableref/bind_table_function.cpp +10 -12
  230. package/src/duckdb/src/planner/binder.cpp +2 -2
  231. package/src/duckdb/src/planner/expression/bound_expression.cpp +11 -2
  232. package/src/duckdb/src/planner/operator/logical_copy_to_file.cpp +2 -5
  233. package/src/duckdb/src/planner/operator/logical_create.cpp +2 -1
  234. package/src/duckdb/src/planner/operator/logical_create_index.cpp +2 -2
  235. package/src/duckdb/src/planner/operator/logical_delete.cpp +2 -2
  236. package/src/duckdb/src/planner/operator/logical_get.cpp +1 -1
  237. package/src/duckdb/src/planner/operator/logical_insert.cpp +2 -7
  238. package/src/duckdb/src/planner/operator/logical_update.cpp +2 -6
  239. package/src/duckdb/src/planner/parsed_data/bound_create_table_info.cpp +2 -2
  240. package/src/duckdb/src/planner/pragma_handler.cpp +3 -4
  241. package/src/duckdb/src/storage/checkpoint_manager.cpp +57 -55
  242. package/src/duckdb/src/storage/data_table.cpp +9 -9
  243. package/src/duckdb/src/storage/index.cpp +18 -6
  244. package/src/duckdb/src/storage/local_storage.cpp +8 -2
  245. package/src/duckdb/src/storage/standard_buffer_manager.cpp +0 -9
  246. package/src/duckdb/src/storage/table/update_segment.cpp +1 -1
  247. package/src/duckdb/src/storage/wal_replay.cpp +29 -31
  248. package/src/duckdb/src/storage/write_ahead_log.cpp +8 -8
  249. package/src/duckdb/src/transaction/cleanup_state.cpp +7 -1
  250. package/src/duckdb/src/transaction/commit_state.cpp +3 -4
  251. package/src/duckdb/src/transaction/transaction_context.cpp +1 -1
  252. package/src/duckdb/src/transaction/undo_buffer.cpp +8 -0
  253. package/src/duckdb/ub_extension_icu_third_party_icu_i18n.cpp +4 -4
  254. package/src/duckdb/ub_src_execution_index_art.cpp +7 -1
@@ -24,7 +24,7 @@ public:
24
24
 
25
25
  public:
26
26
  //! Create a TypeCatalogEntry and initialize storage for it
27
- TypeCatalogEntry(Catalog *catalog, SchemaCatalogEntry *schema, CreateTypeInfo *info);
27
+ TypeCatalogEntry(Catalog &catalog, SchemaCatalogEntry &schema, CreateTypeInfo &info);
28
28
 
29
29
  LogicalType user_type;
30
30
 
@@ -26,7 +26,7 @@ public:
26
26
 
27
27
  public:
28
28
  //! Create a real TableCatalogEntry and initialize storage for it
29
- ViewCatalogEntry(Catalog *catalog, SchemaCatalogEntry *schema, CreateViewInfo *info);
29
+ ViewCatalogEntry(Catalog &catalog, SchemaCatalogEntry &schema, CreateViewInfo &info);
30
30
 
31
31
  //! The query of the view
32
32
  unique_ptr<SelectStatement> query;
@@ -38,7 +38,7 @@ public:
38
38
  vector<LogicalType> types;
39
39
 
40
40
  public:
41
- unique_ptr<CatalogEntry> AlterEntry(ClientContext &context, AlterInfo *info) override;
41
+ unique_ptr<CatalogEntry> AlterEntry(ClientContext &context, AlterInfo &info) override;
42
42
 
43
43
  //! Serialize the meta information of the ViewCatalogEntry a serializer
44
44
  virtual void Serialize(Serializer &serializer) const;
@@ -50,6 +50,6 @@ public:
50
50
  string ToSQL() const override;
51
51
 
52
52
  private:
53
- void Initialize(CreateViewInfo *info);
53
+ void Initialize(CreateViewInfo &info);
54
54
  };
55
55
  } // namespace duckdb
@@ -12,6 +12,7 @@
12
12
  #include "duckdb/common/enums/catalog_type.hpp"
13
13
  #include "duckdb/common/exception.hpp"
14
14
  #include "duckdb/common/atomic.hpp"
15
+ #include "duckdb/common/optional_ptr.hpp"
15
16
  #include <memory>
16
17
 
17
18
  namespace duckdb {
@@ -19,21 +20,21 @@ struct AlterInfo;
19
20
  class Catalog;
20
21
  class CatalogSet;
21
22
  class ClientContext;
23
+ class SchemaCatalogEntry;
22
24
 
23
25
  //! Abstract base class of an entry in the catalog
24
26
  class CatalogEntry {
25
27
  public:
26
- CatalogEntry(CatalogType type, Catalog *catalog, string name);
28
+ CatalogEntry(CatalogType type, Catalog &catalog, string name);
29
+ CatalogEntry(CatalogType type, string name, idx_t oid);
27
30
  virtual ~CatalogEntry();
28
31
 
29
32
  //! The oid of the entry
30
33
  idx_t oid;
31
34
  //! The type of this catalog entry
32
35
  CatalogType type;
33
- //! Reference to the catalog this entry belongs to
34
- Catalog *catalog;
35
36
  //! Reference to the catalog set this entry is stored in
36
- CatalogSet *set;
37
+ optional_ptr<CatalogSet> set;
37
38
  //! The name of the entry
38
39
  string name;
39
40
  //! Whether or not the object is deleted
@@ -47,11 +48,11 @@ public:
47
48
  //! Child entry
48
49
  unique_ptr<CatalogEntry> child;
49
50
  //! Parent entry (the node that dependents_map this node)
50
- CatalogEntry *parent;
51
+ optional_ptr<CatalogEntry> parent;
51
52
 
52
53
  public:
53
- virtual unique_ptr<CatalogEntry> AlterEntry(ClientContext &context, AlterInfo *info);
54
- virtual void UndoAlter(ClientContext &context, AlterInfo *info);
54
+ virtual unique_ptr<CatalogEntry> AlterEntry(ClientContext &context, AlterInfo &info);
55
+ virtual void UndoAlter(ClientContext &context, AlterInfo &info);
55
56
 
56
57
  virtual unique_ptr<CatalogEntry> Copy(ClientContext &context) const;
57
58
 
@@ -62,6 +63,9 @@ public:
62
63
  //! Convert the catalog entry to a SQL string that can be used to re-construct the catalog entry
63
64
  virtual string ToSQL() const;
64
65
 
66
+ virtual Catalog &ParentCatalog();
67
+ virtual SchemaCatalogEntry &ParentSchema();
68
+
65
69
  virtual void Verify(Catalog &catalog);
66
70
 
67
71
  public:
@@ -76,4 +80,21 @@ public:
76
80
  return (const TARGET &)*this;
77
81
  }
78
82
  };
83
+
84
+ class InCatalogEntry : public CatalogEntry {
85
+ public:
86
+ InCatalogEntry(CatalogType type, Catalog &catalog, string name);
87
+ ~InCatalogEntry() override;
88
+
89
+ //! The catalog the entry belongs to
90
+ Catalog &catalog;
91
+
92
+ public:
93
+ Catalog &ParentCatalog() override {
94
+ return catalog;
95
+ }
96
+
97
+ void Verify(Catalog &catalog) override;
98
+ };
99
+
79
100
  } // namespace duckdb
@@ -79,7 +79,7 @@ public:
79
79
  DUCKDB_API bool CreateEntry(ClientContext &context, const string &name, unique_ptr<CatalogEntry> value,
80
80
  DependencyList &dependencies);
81
81
 
82
- DUCKDB_API bool AlterEntry(CatalogTransaction transaction, const string &name, AlterInfo *alter_info);
82
+ DUCKDB_API bool AlterEntry(CatalogTransaction transaction, const string &name, AlterInfo &alter_info);
83
83
 
84
84
  DUCKDB_API bool DropEntry(CatalogTransaction transaction, const string &name, bool cascade,
85
85
  bool allow_drop_internal = false);
@@ -88,13 +88,13 @@ public:
88
88
 
89
89
  DUCKDB_API DuckCatalog &GetCatalog();
90
90
 
91
- bool AlterOwnership(CatalogTransaction transaction, ChangeOwnershipInfo *info);
91
+ bool AlterOwnership(CatalogTransaction transaction, ChangeOwnershipInfo &info);
92
92
 
93
- void CleanupEntry(CatalogEntry *catalog_entry);
93
+ void CleanupEntry(CatalogEntry &catalog_entry);
94
94
 
95
95
  //! Returns the entry with the specified name
96
- DUCKDB_API CatalogEntry *GetEntry(CatalogTransaction transaction, const string &name);
97
- DUCKDB_API CatalogEntry *GetEntry(ClientContext &context, const string &name);
96
+ DUCKDB_API optional_ptr<CatalogEntry> GetEntry(CatalogTransaction transaction, const string &name);
97
+ DUCKDB_API optional_ptr<CatalogEntry> GetEntry(ClientContext &context, const string &name);
98
98
 
99
99
  //! Gets the entry that is most similar to the given name (i.e. smallest levenshtein distance), or empty string if
100
100
  //! none is found. The returned pair consists of the entry name and the distance (smaller means closer).
@@ -105,15 +105,15 @@ public:
105
105
  void Undo(CatalogEntry &entry);
106
106
 
107
107
  //! Scan the catalog set, invoking the callback method for every committed entry
108
- DUCKDB_API void Scan(const std::function<void(CatalogEntry *)> &callback);
108
+ DUCKDB_API void Scan(const std::function<void(CatalogEntry &)> &callback);
109
109
  //! Scan the catalog set, invoking the callback method for every entry
110
- DUCKDB_API void Scan(CatalogTransaction transaction, const std::function<void(CatalogEntry *)> &callback);
111
- DUCKDB_API void Scan(ClientContext &context, const std::function<void(CatalogEntry *)> &callback);
110
+ DUCKDB_API void Scan(CatalogTransaction transaction, const std::function<void(CatalogEntry &)> &callback);
111
+ DUCKDB_API void Scan(ClientContext &context, const std::function<void(CatalogEntry &)> &callback);
112
112
 
113
113
  template <class T>
114
- vector<T *> GetEntries(CatalogTransaction transaction) {
115
- vector<T *> result;
116
- Scan(transaction, [&](CatalogEntry *entry) { result.push_back((T *)entry); });
114
+ vector<reference<T>> GetEntries(CatalogTransaction transaction) {
115
+ vector<reference<T>> result;
116
+ Scan(transaction, [&](CatalogEntry &entry) { result.push_back(entry.Cast<T>()); });
117
117
  return result;
118
118
  }
119
119
 
@@ -132,15 +132,15 @@ private:
132
132
  //! Adjust User dependency
133
133
  void AdjustUserDependency(CatalogEntry &entry, ColumnDefinition &column, bool remove);
134
134
  //! Given a root entry, gets the entry valid for this transaction
135
- CatalogEntry *GetEntryForTransaction(CatalogTransaction transaction, CatalogEntry *current);
136
- CatalogEntry *GetCommittedEntry(CatalogEntry *current);
137
- bool GetEntryInternal(CatalogTransaction transaction, const string &name, EntryIndex *entry_index,
138
- CatalogEntry *&entry);
139
- bool GetEntryInternal(CatalogTransaction transaction, EntryIndex &entry_index, CatalogEntry *&entry);
135
+ CatalogEntry &GetEntryForTransaction(CatalogTransaction transaction, CatalogEntry &current);
136
+ CatalogEntry &GetCommittedEntry(CatalogEntry &current);
137
+ optional_ptr<CatalogEntry> GetEntryInternal(CatalogTransaction transaction, const string &name,
138
+ EntryIndex *entry_index);
139
+ optional_ptr<CatalogEntry> GetEntryInternal(CatalogTransaction transaction, EntryIndex &entry_index);
140
140
  //! Drops an entry from the catalog set; must hold the catalog_lock to safely call this
141
141
  void DropEntryInternal(CatalogTransaction transaction, EntryIndex entry_index, CatalogEntry &entry, bool cascade);
142
- CatalogEntry *CreateEntryInternal(CatalogTransaction transaction, unique_ptr<CatalogEntry> entry);
143
- MappingValue *GetMapping(CatalogTransaction transaction, const string &name, bool get_latest = false);
142
+ optional_ptr<CatalogEntry> CreateEntryInternal(CatalogTransaction transaction, unique_ptr<CatalogEntry> entry);
143
+ optional_ptr<MappingValue> GetMapping(CatalogTransaction transaction, const string &name, bool get_latest = false);
144
144
  void PutMapping(CatalogTransaction transaction, const string &name, EntryIndex entry_index);
145
145
  void DeleteMapping(CatalogTransaction transaction, const string &name);
146
146
  void DropEntryDependencies(CatalogTransaction transaction, EntryIndex &entry_index, CatalogEntry &entry,
@@ -149,7 +149,8 @@ private:
149
149
  //! Create all default entries
150
150
  void CreateDefaultEntries(CatalogTransaction transaction, unique_lock<mutex> &lock);
151
151
  //! Attempt to create a default entry with the specified name. Returns the entry if successful, nullptr otherwise.
152
- CatalogEntry *CreateDefaultEntry(CatalogTransaction transaction, const string &name, unique_lock<mutex> &lock);
152
+ optional_ptr<CatalogEntry> CreateDefaultEntry(CatalogTransaction transaction, const string &name,
153
+ unique_lock<mutex> &lock);
153
154
 
154
155
  EntryIndex PutEntry(idx_t entry_index, unique_ptr<CatalogEntry> entry);
155
156
  void PutEntry(EntryIndex index, unique_ptr<CatalogEntry> entry);
@@ -33,13 +33,13 @@ public:
33
33
  }
34
34
 
35
35
  public:
36
- DUCKDB_API CatalogEntry *CreateSchema(CatalogTransaction transaction, CreateSchemaInfo *info) override;
37
- DUCKDB_API void ScanSchemas(ClientContext &context, std::function<void(CatalogEntry *)> callback) override;
38
- DUCKDB_API void ScanSchemas(std::function<void(CatalogEntry *)> callback);
36
+ DUCKDB_API optional_ptr<CatalogEntry> CreateSchema(CatalogTransaction transaction, CreateSchemaInfo &info) override;
37
+ DUCKDB_API void ScanSchemas(ClientContext &context, std::function<void(SchemaCatalogEntry &)> callback) override;
38
+ DUCKDB_API void ScanSchemas(std::function<void(SchemaCatalogEntry &)> callback);
39
39
 
40
- DUCKDB_API SchemaCatalogEntry *GetSchema(CatalogTransaction transaction, const string &schema_name,
41
- bool if_exists = false,
42
- QueryErrorContext error_context = QueryErrorContext()) override;
40
+ DUCKDB_API optional_ptr<SchemaCatalogEntry>
41
+ GetSchema(CatalogTransaction transaction, const string &schema_name, OnEntryNotFound if_not_found,
42
+ QueryErrorContext error_context = QueryErrorContext()) override;
43
43
 
44
44
  DUCKDB_API unique_ptr<PhysicalOperator> PlanCreateTableAs(ClientContext &context, LogicalCreateTable &op,
45
45
  unique_ptr<PhysicalOperator> plan) override;
@@ -59,9 +59,9 @@ public:
59
59
  DUCKDB_API string GetDBPath() override;
60
60
 
61
61
  private:
62
- DUCKDB_API void DropSchema(CatalogTransaction transaction, DropInfo *info);
63
- DUCKDB_API void DropSchema(ClientContext &context, DropInfo *info) override;
64
- CatalogEntry *CreateSchemaInternal(CatalogTransaction transaction, CreateSchemaInfo *info);
62
+ DUCKDB_API void DropSchema(CatalogTransaction transaction, DropInfo &info);
63
+ DUCKDB_API void DropSchema(ClientContext &context, DropInfo &info) override;
64
+ optional_ptr<CatalogEntry> CreateSchemaInternal(CatalogTransaction transaction, CreateSchemaInfo &info);
65
65
  void Verify() override;
66
66
 
67
67
  private:
@@ -9,6 +9,7 @@
9
9
  #pragma once
10
10
 
11
11
  #include "duckdb/common/common.hpp"
12
+ #include "duckdb/common/optional_ptr.hpp"
12
13
 
13
14
  namespace duckdb {
14
15
  class SchemaCatalogEntry;
@@ -20,7 +21,7 @@ struct SimilarCatalogEntry {
20
21
  //! The distance to the given name.
21
22
  idx_t distance = idx_t(-1);
22
23
  //! The schema of the entry.
23
- SchemaCatalogEntry *schema = nullptr;
24
+ optional_ptr<SchemaCatalogEntry> schema;
24
25
 
25
26
  DUCKDB_API bool Found() const {
26
27
  return !name.empty();
@@ -14,15 +14,21 @@ namespace duckdb {
14
14
  class SchemaCatalogEntry;
15
15
 
16
16
  //! A StandardEntry is a catalog entry that is a member of a schema
17
- class StandardEntry : public CatalogEntry {
17
+ class StandardEntry : public InCatalogEntry {
18
18
  public:
19
- StandardEntry(CatalogType type, SchemaCatalogEntry *schema, Catalog *catalog, string name)
20
- : CatalogEntry(type, catalog, name), schema(schema) {
19
+ StandardEntry(CatalogType type, SchemaCatalogEntry &schema, Catalog &catalog, string name)
20
+ : InCatalogEntry(type, catalog, name), schema(schema) {
21
21
  }
22
22
  ~StandardEntry() override {
23
23
  }
24
24
 
25
25
  //! The schema the entry belongs to
26
- SchemaCatalogEntry *schema;
26
+ SchemaCatalogEntry &schema;
27
+
28
+ public:
29
+ SchemaCatalogEntry &ParentSchema() override {
30
+ return schema;
31
+ }
27
32
  };
33
+
28
34
  } // namespace duckdb
@@ -0,0 +1,17 @@
1
+ //===----------------------------------------------------------------------===//
2
+ // DuckDB
3
+ //
4
+ // duckdb/common/enums/on_entry_not_found.hpp
5
+ //
6
+ //
7
+ //===----------------------------------------------------------------------===//
8
+
9
+ #pragma once
10
+
11
+ #include "duckdb/common/constants.hpp"
12
+
13
+ namespace duckdb {
14
+
15
+ enum class OnEntryNotFound : uint8_t { THROW_EXCEPTION = 0, RETURN_NULL = 1 };
16
+
17
+ } // namespace duckdb
@@ -12,4 +12,4 @@
12
12
 
13
13
  namespace duckdb {
14
14
  using std::queue;
15
- }
15
+ } // namespace duckdb
@@ -10,6 +10,7 @@
10
10
 
11
11
  #include "duckdb/common/assert.hpp"
12
12
  #include "duckdb/common/constants.hpp"
13
+ #include "duckdb/common/optional_ptr.hpp"
13
14
  #include "duckdb/common/vector.hpp"
14
15
 
15
16
  #include <limits>
@@ -326,8 +327,6 @@ struct LogicalType {
326
327
  DUCKDB_API string GetAlias() const;
327
328
 
328
329
  DUCKDB_API static LogicalType MaxLogicalType(const LogicalType &left, const LogicalType &right);
329
- DUCKDB_API static void SetCatalog(LogicalType &type, TypeCatalogEntry* catalog_entry);
330
- DUCKDB_API static TypeCatalogEntry* GetCatalog(const LogicalType &type);
331
330
 
332
331
  DUCKDB_API static ExtraTypeInfoType GetExtraTypeInfoType(const ExtraTypeInfo &type);
333
332
 
@@ -426,8 +425,8 @@ struct EnumType{
426
425
  DUCKDB_API static const Vector &GetValuesInsertOrder(const LogicalType &type);
427
426
  DUCKDB_API static idx_t GetSize(const LogicalType &type);
428
427
  DUCKDB_API static const string GetValue(const Value &val);
429
- DUCKDB_API static void SetCatalog(LogicalType &type, TypeCatalogEntry* catalog_entry);
430
- DUCKDB_API static TypeCatalogEntry* GetCatalog(const LogicalType &type);
428
+ DUCKDB_API static void SetCatalog(LogicalType &type, optional_ptr<TypeCatalogEntry> catalog_entry);
429
+ DUCKDB_API static optional_ptr<TypeCatalogEntry> GetCatalog(const LogicalType &type);
431
430
  DUCKDB_API static string GetSchemaName(const LogicalType &type);
432
431
  DUCKDB_API static PhysicalType GetPhysicalType(const LogicalType &type);
433
432
  DUCKDB_API static void Serialize(FieldWriter& writer, const ExtraTypeInfo& type_info, bool serialize_internals);
@@ -8,56 +8,54 @@
8
8
 
9
9
  #pragma once
10
10
 
11
- #include "duckdb/common/common.hpp"
12
- #include "duckdb/common/types/data_chunk.hpp"
13
- #include "duckdb/common/types/vector.hpp"
14
- #include "duckdb/execution/index/art/art_key.hpp"
15
- #include "duckdb/execution/index/art/iterator.hpp"
16
- #include "duckdb/execution/index/art/leaf.hpp"
17
- #include "duckdb/execution/index/art/node.hpp"
18
- #include "duckdb/execution/index/art/node16.hpp"
19
- #include "duckdb/execution/index/art/node256.hpp"
20
- #include "duckdb/execution/index/art/node4.hpp"
21
- #include "duckdb/execution/index/art/node48.hpp"
22
- #include "duckdb/parser/parsed_expression.hpp"
23
- #include "duckdb/storage/data_table.hpp"
24
11
  #include "duckdb/storage/index.hpp"
25
- #include "duckdb/storage/meta_block_writer.hpp"
26
12
 
27
13
  namespace duckdb {
28
14
 
29
- class ConflictManager;
30
- struct ARTIndexScanState;
31
-
15
+ // classes
32
16
  enum class VerifyExistenceType : uint8_t {
33
17
  APPEND = 0, // appends to a table
34
18
  APPEND_FK = 1, // appends to a table that has a foreign key
35
19
  DELETE_FK = 2 // delete from a table that has a foreign key
36
20
  };
21
+ class ConflictManager;
22
+ class Node;
23
+ class ARTKey;
24
+ class FixedSizeAllocator;
25
+
26
+ // structs
27
+ struct ARTIndexScanState;
28
+ struct ARTFlags {
29
+ vector<bool> vacuum_flags;
30
+ vector<idx_t> merge_buffer_counts;
31
+ };
37
32
 
38
33
  class ART : public Index {
39
34
  public:
40
- //! Constructs an ART containing the bound expressions, which are resolved during index construction
35
+ //! Constructs an ART
41
36
  ART(const vector<column_t> &column_ids, TableIOManager &table_io_manager,
42
- const vector<unique_ptr<Expression>> &unbound_expressions, IndexConstraintType constraint_type,
43
- AttachedDatabase &db, bool track_memory, idx_t block_id = DConstants::INVALID_INDEX,
44
- idx_t block_offset = DConstants::INVALID_INDEX);
37
+ const vector<unique_ptr<Expression>> &unbound_expressions, const IndexConstraintType constraint_type,
38
+ AttachedDatabase &db, const idx_t block_id = DConstants::INVALID_INDEX,
39
+ const idx_t block_offset = DConstants::INVALID_INDEX);
45
40
  ~ART() override;
46
41
 
47
42
  //! Root of the tree
48
- Node *tree;
43
+ unique_ptr<Node> tree;
44
+ //! Fixed-size allocators holding the ART nodes
45
+ vector<unique_ptr<FixedSizeAllocator>> allocators;
49
46
 
50
47
  public:
51
48
  //! Initialize a single predicate scan on the index with the given expression and column IDs
52
49
  unique_ptr<IndexScanState> InitializeScanSinglePredicate(const Transaction &transaction, const Value &value,
53
- ExpressionType expression_type) override;
50
+ const ExpressionType expression_type) override;
54
51
  //! Initialize a two predicate scan on the index with the given expression and column IDs
55
- unique_ptr<IndexScanState> InitializeScanTwoPredicates(Transaction &transaction, const Value &low_value,
56
- ExpressionType low_expression_type, const Value &high_value,
57
- ExpressionType high_expression_type) override;
52
+ unique_ptr<IndexScanState> InitializeScanTwoPredicates(const Transaction &transaction, const Value &low_value,
53
+ const ExpressionType low_expression_type,
54
+ const Value &high_value,
55
+ const ExpressionType high_expression_type) override;
58
56
  //! Performs a lookup on the index, fetching up to max_count result IDs. Returns true if all row IDs were fetched,
59
57
  //! and false otherwise
60
- bool Scan(Transaction &transaction, DataTable &table, IndexScanState &state, idx_t max_count,
58
+ bool Scan(const Transaction &transaction, const DataTable &table, IndexScanState &state, const idx_t max_count,
61
59
  vector<row_t> &result_ids) override;
62
60
 
63
61
  //! Called when data is appended to the index. The lock obtained from InitializeLock must be held
@@ -72,22 +70,25 @@ public:
72
70
  PreservedError Insert(IndexLock &lock, DataChunk &data, Vector &row_ids) override;
73
71
 
74
72
  //! Construct an ART from a vector of sorted keys
75
- bool ConstructFromSorted(idx_t count, vector<Key> &keys, Vector &row_identifiers);
73
+ bool ConstructFromSorted(idx_t count, vector<ARTKey> &keys, Vector &row_identifiers);
76
74
 
77
75
  //! Search equal values and fetches the row IDs
78
- bool SearchEqual(Key &key, idx_t max_count, vector<row_t> &result_ids);
76
+ bool SearchEqual(ARTKey &key, idx_t max_count, vector<row_t> &result_ids);
79
77
  //! Search equal values used for joins that do not need to fetch data
80
- void SearchEqualJoinNoFetch(Key &key, idx_t &result_size);
78
+ void SearchEqualJoinNoFetch(ARTKey &key, idx_t &result_size);
81
79
 
82
80
  //! Serializes the index and returns the pair of block_id offset positions
83
- BlockPointer Serialize(duckdb::MetaBlockWriter &writer) override;
81
+ BlockPointer Serialize(MetaBlockWriter &writer) override;
84
82
 
85
83
  //! Merge another index into this index. The lock obtained from InitializeLock must be held, and the other
86
84
  //! index must also be locked during the merge
87
85
  bool MergeIndexes(IndexLock &state, Index &other_index) override;
88
86
 
87
+ //! Traverses an ART and vacuums the qualifying nodes. The lock obtained from InitializeLock must be held
88
+ void Vacuum(IndexLock &state) override;
89
+
89
90
  //! Generate ART keys for an input chunk
90
- static void GenerateKeys(ArenaAllocator &allocator, DataChunk &input, vector<Key> &keys);
91
+ static void GenerateKeys(ArenaAllocator &allocator, DataChunk &input, vector<ARTKey> &keys);
91
92
 
92
93
  //! Generate a string containing all the expressions and their respective values that violate a constraint
93
94
  string GenerateErrorKeyName(DataChunk &input, idx_t row);
@@ -96,31 +97,38 @@ public:
96
97
  //! Performs constraint checking for a chunk of input data
97
98
  void CheckConstraintsForChunk(DataChunk &input, ConflictManager &conflict_manager) override;
98
99
 
99
- //! Returns the string representation of an ART
100
+ //! Returns the string representation of the ART
100
101
  string ToString() override;
101
- //! Verifies that the in-memory size value of the index matches its actual size
102
- void Verify() override;
103
- //! Increases the memory size by the difference between the old size and the current size
104
- //! and performs verifications
105
- void IncreaseAndVerifyMemorySize(idx_t old_memory_size) override;
106
102
 
107
103
  private:
108
104
  //! Insert a row ID into a leaf
109
- bool InsertToLeaf(Leaf &leaf, row_t row_id);
105
+ bool InsertToLeaf(Node &leaf_node, const row_t &row_id);
110
106
  //! Insert a key into the tree
111
- bool Insert(Node *&node, Key &key, idx_t depth, row_t row_id);
107
+ bool Insert(Node &node, const ARTKey &key, idx_t depth, const row_t &row_id);
112
108
  //! Erase a key from the tree (if a leaf has more than one value) or erase the leaf itself
113
- void Erase(Node *&node, Key &key, idx_t depth, row_t row_id);
109
+ void Erase(Node &node, const ARTKey &key, idx_t depth, const row_t &row_id);
114
110
  //! Find the node with a matching key, or return nullptr if not found
115
- Leaf *Lookup(Node *node, Key &key, idx_t depth);
111
+ Node Lookup(Node node, const ARTKey &key, idx_t depth);
116
112
  //! Returns all row IDs belonging to a key greater (or equal) than the search key
117
- bool SearchGreater(ARTIndexScanState *state, Key &key, bool inclusive, idx_t max_count, vector<row_t> &result_ids);
113
+ bool SearchGreater(ARTIndexScanState *state, ARTKey &key, bool inclusive, idx_t max_count,
114
+ vector<row_t> &result_ids);
118
115
  //! Returns all row IDs belonging to a key less (or equal) than the upper_bound
119
- bool SearchLess(ARTIndexScanState *state, Key &upper_bound, bool inclusive, idx_t max_count,
116
+ bool SearchLess(ARTIndexScanState *state, ARTKey &upper_bound, bool inclusive, idx_t max_count,
120
117
  vector<row_t> &result_ids);
121
118
  //! Returns all row IDs belonging to a key within the range of lower_bound and upper_bound
122
- bool SearchCloseRange(ARTIndexScanState *state, Key &lower_bound, Key &upper_bound, bool left_inclusive,
119
+ bool SearchCloseRange(ARTIndexScanState *state, ARTKey &lower_bound, ARTKey &upper_bound, bool left_inclusive,
123
120
  bool right_inclusive, idx_t max_count, vector<row_t> &result_ids);
121
+
122
+ //! Initializes a merge operation by returning a set containing the buffer count of each fixed-size allocator
123
+ void InitializeMerge(ARTFlags &flags);
124
+
125
+ //! Initializes a vacuum operation by calling the initialize operation of the respective
126
+ //! node allocator, and returns a vector containing either true, if the allocator at
127
+ //! the respective position qualifies, or false, if not
128
+ void InitializeVacuum(ARTFlags &flags);
129
+ //! Finalizes a vacuum operation by calling the finalize operation of all qualifying
130
+ //! fixed size allocators
131
+ void FinalizeVacuum(const ARTFlags &flags);
124
132
  };
125
133
 
126
134
  } // namespace duckdb
@@ -17,36 +17,37 @@
17
17
 
18
18
  namespace duckdb {
19
19
 
20
- class Key {
20
+ class ARTKey {
21
21
  public:
22
- Key();
23
- Key(data_ptr_t data, idx_t len);
24
- Key(ArenaAllocator &allocator, idx_t len);
22
+ ARTKey();
23
+ ARTKey(const data_ptr_t &data, const uint32_t &len);
24
+ ARTKey(ArenaAllocator &allocator, const uint32_t &len);
25
25
 
26
- idx_t len;
26
+ uint32_t len;
27
27
  data_ptr_t data;
28
28
 
29
29
  public:
30
30
  template <class T>
31
- static inline Key CreateKey(ArenaAllocator &allocator, const LogicalType &type, T element) {
32
- auto data = Key::CreateData<T>(allocator, element);
33
- return Key(data, sizeof(element));
31
+ static inline ARTKey CreateARTKey(ArenaAllocator &allocator, const LogicalType &type, T element) {
32
+ auto data = ARTKey::CreateData<T>(allocator, element);
33
+ return ARTKey(data, sizeof(element));
34
34
  }
35
35
 
36
36
  template <class T>
37
- static inline Key CreateKey(ArenaAllocator &allocator, const LogicalType &type, const Value &element) {
38
- return CreateKey(allocator, type, element.GetValueUnsafe<T>());
37
+ static inline ARTKey CreateARTKey(ArenaAllocator &allocator, const LogicalType &type, const Value &element) {
38
+ return CreateARTKey(allocator, type, element.GetValueUnsafe<T>());
39
39
  }
40
40
 
41
41
  template <class T>
42
- static inline void CreateKey(ArenaAllocator &allocator, const LogicalType &type, Key &key, T element) {
43
- key.data = Key::CreateData<T>(allocator, element);
42
+ static inline void CreateARTKey(ArenaAllocator &allocator, const LogicalType &type, ARTKey &key, T element) {
43
+ key.data = ARTKey::CreateData<T>(allocator, element);
44
44
  key.len = sizeof(element);
45
45
  }
46
46
 
47
47
  template <class T>
48
- static inline void CreateKey(ArenaAllocator &allocator, const LogicalType &type, Key &key, const Value element) {
49
- key.data = Key::CreateData<T>(allocator, element.GetValueUnsafe<T>());
48
+ static inline void CreateARTKey(ArenaAllocator &allocator, const LogicalType &type, ARTKey &key,
49
+ const Value element) {
50
+ key.data = ARTKey::CreateData<T>(allocator, element.GetValueUnsafe<T>());
50
51
  key.len = sizeof(element);
51
52
  }
52
53
 
@@ -57,14 +58,18 @@ public:
57
58
  const data_t &operator[](size_t i) const {
58
59
  return data[i];
59
60
  }
60
- bool operator>(const Key &k) const;
61
- bool operator<(const Key &k) const;
62
- bool operator>=(const Key &k) const;
63
- bool operator==(const Key &k) const;
61
+ bool operator>(const ARTKey &k) const;
62
+ bool operator<(const ARTKey &k) const;
63
+ bool operator>=(const ARTKey &k) const;
64
+ bool operator==(const ARTKey &k) const;
64
65
 
65
- bool ByteMatches(Key &other, idx_t &depth);
66
- bool Empty();
67
- void ConcatenateKey(ArenaAllocator &allocator, Key &concat_key);
66
+ inline bool ByteMatches(const ARTKey &other, const uint32_t &depth) const {
67
+ return data[depth] == other[depth];
68
+ }
69
+ inline bool Empty() const {
70
+ return len == 0;
71
+ }
72
+ void ConcatenateARTKey(ArenaAllocator &allocator, ARTKey &concat_key);
68
73
 
69
74
  private:
70
75
  template <class T>
@@ -76,9 +81,9 @@ private:
76
81
  };
77
82
 
78
83
  template <>
79
- Key Key::CreateKey(ArenaAllocator &allocator, const LogicalType &type, string_t value);
84
+ ARTKey ARTKey::CreateARTKey(ArenaAllocator &allocator, const LogicalType &type, string_t value);
80
85
  template <>
81
- Key Key::CreateKey(ArenaAllocator &allocator, const LogicalType &type, const char *value);
86
+ ARTKey ARTKey::CreateARTKey(ArenaAllocator &allocator, const LogicalType &type, const char *value);
82
87
  template <>
83
- void Key::CreateKey(ArenaAllocator &allocator, const LogicalType &type, Key &key, string_t value);
88
+ void ARTKey::CreateARTKey(ArenaAllocator &allocator, const LogicalType &type, ARTKey &key, string_t value);
84
89
  } // namespace duckdb