duckdb 0.7.2-dev2233.0 → 0.7.2-dev2320.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 (176) hide show
  1. package/binding.gyp +1 -0
  2. package/package.json +1 -1
  3. package/src/duckdb/src/catalog/catalog.cpp +18 -17
  4. package/src/duckdb/src/catalog/catalog_entry/duck_table_entry.cpp +0 -4
  5. package/src/duckdb/src/catalog/catalog_entry/table_catalog_entry.cpp +0 -4
  6. package/src/duckdb/src/catalog/catalog_set.cpp +3 -3
  7. package/src/duckdb/src/common/adbc/adbc.cpp +441 -0
  8. package/src/duckdb/src/common/adbc/driver_manager.cpp +749 -0
  9. package/src/duckdb/src/common/arrow/arrow_wrapper.cpp +1 -1
  10. package/src/duckdb/src/common/tree_renderer.cpp +3 -3
  11. package/src/duckdb/src/common/types/conflict_manager.cpp +2 -1
  12. package/src/duckdb/src/execution/column_binding_resolver.cpp +1 -1
  13. package/src/duckdb/src/execution/operator/aggregate/physical_ungrouped_aggregate.cpp +1 -1
  14. package/src/duckdb/src/execution/operator/filter/physical_filter.cpp +2 -2
  15. package/src/duckdb/src/execution/operator/helper/physical_execute.cpp +2 -2
  16. package/src/duckdb/src/execution/operator/helper/physical_result_collector.cpp +5 -5
  17. package/src/duckdb/src/execution/operator/join/physical_cross_product.cpp +1 -1
  18. package/src/duckdb/src/execution/operator/join/physical_delim_join.cpp +11 -10
  19. package/src/duckdb/src/execution/operator/join/physical_hash_join.cpp +3 -3
  20. package/src/duckdb/src/execution/operator/join/physical_iejoin.cpp +9 -9
  21. package/src/duckdb/src/execution/operator/join/physical_index_join.cpp +4 -4
  22. package/src/duckdb/src/execution/operator/join/physical_join.cpp +7 -7
  23. package/src/duckdb/src/execution/operator/join/physical_nested_loop_join.cpp +3 -3
  24. package/src/duckdb/src/execution/operator/join/physical_piecewise_merge_join.cpp +3 -3
  25. package/src/duckdb/src/execution/operator/join/physical_positional_join.cpp +2 -2
  26. package/src/duckdb/src/execution/operator/persistent/csv_reader_options.cpp +8 -9
  27. package/src/duckdb/src/execution/operator/persistent/physical_batch_insert.cpp +20 -19
  28. package/src/duckdb/src/execution/operator/persistent/physical_export.cpp +3 -3
  29. package/src/duckdb/src/execution/operator/persistent/physical_insert.cpp +25 -24
  30. package/src/duckdb/src/execution/operator/persistent/physical_update.cpp +1 -1
  31. package/src/duckdb/src/execution/operator/projection/physical_projection.cpp +2 -2
  32. package/src/duckdb/src/execution/operator/scan/physical_column_data_scan.cpp +12 -6
  33. package/src/duckdb/src/execution/operator/set/physical_recursive_cte.cpp +10 -11
  34. package/src/duckdb/src/execution/operator/set/physical_union.cpp +2 -2
  35. package/src/duckdb/src/execution/physical_operator.cpp +13 -13
  36. package/src/duckdb/src/execution/physical_plan/plan_column_data_get.cpp +2 -4
  37. package/src/duckdb/src/execution/physical_plan/plan_comparison_join.cpp +1 -1
  38. package/src/duckdb/src/execution/physical_plan/plan_create_table.cpp +5 -5
  39. package/src/duckdb/src/execution/physical_plan/plan_delete.cpp +3 -3
  40. package/src/duckdb/src/execution/physical_plan/plan_delim_join.cpp +6 -7
  41. package/src/duckdb/src/execution/physical_plan/plan_explain.cpp +2 -4
  42. package/src/duckdb/src/execution/physical_plan/plan_insert.cpp +2 -2
  43. package/src/duckdb/src/execution/physical_plan/plan_show_select.cpp +2 -4
  44. package/src/duckdb/src/execution/physical_plan/plan_update.cpp +3 -3
  45. package/src/duckdb/src/function/compression_config.cpp +9 -9
  46. package/src/duckdb/src/function/scalar/date/strftime.cpp +1 -1
  47. package/src/duckdb/src/function/table/copy_csv.cpp +5 -0
  48. package/src/duckdb/src/function/table/pragma_detailed_profiling_output.cpp +6 -5
  49. package/src/duckdb/src/function/table/pragma_last_profiling_output.cpp +7 -5
  50. package/src/duckdb/src/function/table/system/duckdb_databases.cpp +1 -1
  51. package/src/duckdb/src/function/table/system/duckdb_dependencies.cpp +1 -1
  52. package/src/duckdb/src/function/table/system/duckdb_extensions.cpp +1 -1
  53. package/src/duckdb/src/function/table/system/duckdb_indexes.cpp +1 -1
  54. package/src/duckdb/src/function/table/system/duckdb_keywords.cpp +1 -1
  55. package/src/duckdb/src/function/table/system/duckdb_schemas.cpp +1 -1
  56. package/src/duckdb/src/function/table/system/duckdb_sequences.cpp +1 -1
  57. package/src/duckdb/src/function/table/system/duckdb_settings.cpp +1 -1
  58. package/src/duckdb/src/function/table/system/duckdb_tables.cpp +1 -1
  59. package/src/duckdb/src/function/table/system/duckdb_temporary_files.cpp +1 -1
  60. package/src/duckdb/src/function/table/system/duckdb_types.cpp +1 -1
  61. package/src/duckdb/src/function/table/system/pragma_collations.cpp +1 -1
  62. package/src/duckdb/src/function/table/system/pragma_database_size.cpp +1 -1
  63. package/src/duckdb/src/function/table/system/pragma_storage_info.cpp +5 -5
  64. package/src/duckdb/src/function/table/system/pragma_table_info.cpp +1 -1
  65. package/src/duckdb/src/function/table/system/test_all_types.cpp +1 -1
  66. package/src/duckdb/src/function/table/table_scan.cpp +3 -4
  67. package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
  68. package/src/duckdb/src/include/duckdb/catalog/catalog.hpp +3 -3
  69. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_table_entry.hpp +1 -2
  70. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_catalog_entry.hpp +1 -2
  71. package/src/duckdb/src/include/duckdb/common/adbc/adbc-init.hpp +37 -0
  72. package/src/duckdb/src/include/duckdb/common/adbc/adbc.h +1088 -0
  73. package/src/duckdb/src/include/duckdb/common/adbc/adbc.hpp +85 -0
  74. package/src/duckdb/src/include/duckdb/common/adbc/driver_manager.h +84 -0
  75. package/src/duckdb/src/include/duckdb/common/helper.hpp +3 -0
  76. package/src/duckdb/src/include/duckdb/common/types/conflict_manager.hpp +3 -2
  77. package/src/duckdb/src/include/duckdb/common/types.hpp +0 -1
  78. package/src/duckdb/src/include/duckdb/execution/executor.hpp +7 -7
  79. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_execute.hpp +1 -1
  80. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_result_collector.hpp +1 -1
  81. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_cross_product.hpp +1 -1
  82. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_delim_join.hpp +3 -3
  83. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_index_join.hpp +1 -1
  84. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_join.hpp +1 -1
  85. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_positional_join.hpp +1 -1
  86. package/src/duckdb/src/include/duckdb/execution/operator/persistent/csv_reader_options.hpp +2 -1
  87. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_batch_insert.hpp +2 -2
  88. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_export.hpp +1 -1
  89. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_insert.hpp +2 -2
  90. package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_column_data_scan.hpp +3 -4
  91. package/src/duckdb/src/include/duckdb/execution/operator/set/physical_recursive_cte.hpp +1 -1
  92. package/src/duckdb/src/include/duckdb/execution/operator/set/physical_union.hpp +1 -1
  93. package/src/duckdb/src/include/duckdb/execution/physical_operator.hpp +3 -3
  94. package/src/duckdb/src/include/duckdb/execution/physical_operator_states.hpp +1 -1
  95. package/src/duckdb/src/include/duckdb/function/cast/cast_function_set.hpp +1 -1
  96. package/src/duckdb/src/include/duckdb/main/config.hpp +2 -2
  97. package/src/duckdb/src/include/duckdb/main/query_profiler.hpp +10 -9
  98. package/src/duckdb/src/include/duckdb/parallel/meta_pipeline.hpp +4 -4
  99. package/src/duckdb/src/include/duckdb/parallel/pipeline.hpp +18 -17
  100. package/src/duckdb/src/include/duckdb/parallel/pipeline_executor.hpp +2 -2
  101. package/src/duckdb/src/include/duckdb/planner/bind_context.hpp +14 -17
  102. package/src/duckdb/src/include/duckdb/planner/binder.hpp +6 -6
  103. package/src/duckdb/src/include/duckdb/planner/expression_binder/index_binder.hpp +4 -4
  104. package/src/duckdb/src/include/duckdb/planner/expression_binder/where_binder.hpp +2 -2
  105. package/src/duckdb/src/include/duckdb/planner/operator/logical_create.hpp +3 -2
  106. package/src/duckdb/src/include/duckdb/planner/operator/logical_create_table.hpp +2 -2
  107. package/src/duckdb/src/include/duckdb/planner/operator/logical_delete.hpp +2 -2
  108. package/src/duckdb/src/include/duckdb/planner/operator/logical_insert.hpp +2 -2
  109. package/src/duckdb/src/include/duckdb/planner/operator/logical_update.hpp +2 -2
  110. package/src/duckdb/src/include/duckdb/planner/parsed_data/bound_create_function_info.hpp +3 -2
  111. package/src/duckdb/src/include/duckdb/planner/parsed_data/bound_create_table_info.hpp +3 -2
  112. package/src/duckdb/src/include/duckdb/planner/table_binding.hpp +6 -5
  113. package/src/duckdb/src/include/duckdb/planner/tableref/bound_basetableref.hpp +2 -2
  114. package/src/duckdb/src/include/duckdb/storage/compression/chimp/chimp_compress.hpp +3 -7
  115. package/src/duckdb/src/include/duckdb/storage/compression/patas/patas_compress.hpp +3 -7
  116. package/src/duckdb/src/include/duckdb/storage/data_table.hpp +1 -1
  117. package/src/duckdb/src/include/duckdb/storage/storage_manager.hpp +1 -1
  118. package/src/duckdb/src/include/duckdb/storage/table/column_data_checkpointer.hpp +2 -1
  119. package/src/duckdb/src/include/duckdb/storage/table/column_segment.hpp +2 -2
  120. package/src/duckdb/src/include/duckdb/storage/table/row_group.hpp +1 -1
  121. package/src/duckdb/src/include/duckdb/storage/table/row_group_collection.hpp +1 -1
  122. package/src/duckdb/src/include/duckdb/storage/table/update_segment.hpp +4 -4
  123. package/src/duckdb/src/include/duckdb/storage/write_ahead_log.hpp +3 -3
  124. package/src/duckdb/src/include/duckdb/transaction/cleanup_state.hpp +3 -3
  125. package/src/duckdb/src/include/duckdb/transaction/commit_state.hpp +5 -5
  126. package/src/duckdb/src/include/duckdb/transaction/duck_transaction.hpp +3 -3
  127. package/src/duckdb/src/include/duckdb/transaction/local_storage.hpp +31 -30
  128. package/src/duckdb/src/include/duckdb/transaction/transaction_data.hpp +2 -1
  129. package/src/duckdb/src/include/duckdb/transaction/undo_buffer.hpp +1 -1
  130. package/src/duckdb/src/main/client_context.cpp +1 -1
  131. package/src/duckdb/src/main/query_profiler.cpp +24 -22
  132. package/src/duckdb/src/parallel/executor.cpp +55 -49
  133. package/src/duckdb/src/parallel/meta_pipeline.cpp +5 -5
  134. package/src/duckdb/src/parallel/pipeline.cpp +43 -26
  135. package/src/duckdb/src/parallel/pipeline_executor.cpp +22 -22
  136. package/src/duckdb/src/planner/bind_context.cpp +67 -71
  137. package/src/duckdb/src/planner/binder/statement/bind_create.cpp +6 -7
  138. package/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +6 -8
  139. package/src/duckdb/src/planner/binder/statement/bind_delete.cpp +3 -4
  140. package/src/duckdb/src/planner/binder/statement/bind_insert.cpp +17 -18
  141. package/src/duckdb/src/planner/binder/statement/bind_update.cpp +16 -17
  142. package/src/duckdb/src/planner/binder/statement/bind_vacuum.cpp +6 -5
  143. package/src/duckdb/src/planner/binder/tableref/bind_basetableref.cpp +9 -9
  144. package/src/duckdb/src/planner/binder/tableref/bind_joinref.cpp +20 -18
  145. package/src/duckdb/src/planner/binder/tableref/plan_joinref.cpp +1 -1
  146. package/src/duckdb/src/planner/binder.cpp +4 -4
  147. package/src/duckdb/src/planner/expression_binder/index_binder.cpp +2 -1
  148. package/src/duckdb/src/planner/expression_binder/where_binder.cpp +3 -2
  149. package/src/duckdb/src/planner/operator/logical_create_table.cpp +1 -1
  150. package/src/duckdb/src/planner/operator/logical_delete.cpp +5 -5
  151. package/src/duckdb/src/planner/operator/logical_insert.cpp +6 -7
  152. package/src/duckdb/src/planner/operator/logical_update.cpp +6 -7
  153. package/src/duckdb/src/planner/parsed_data/bound_create_table_info.cpp +4 -5
  154. package/src/duckdb/src/planner/table_binding.cpp +6 -5
  155. package/src/duckdb/src/storage/compression/bitpacking.cpp +5 -6
  156. package/src/duckdb/src/storage/compression/dictionary_compression.cpp +5 -6
  157. package/src/duckdb/src/storage/compression/fsst.cpp +3 -5
  158. package/src/duckdb/src/storage/compression/rle.cpp +4 -6
  159. package/src/duckdb/src/storage/data_table.cpp +27 -28
  160. package/src/duckdb/src/storage/local_storage.cpp +70 -68
  161. package/src/duckdb/src/storage/storage_manager.cpp +12 -13
  162. package/src/duckdb/src/storage/table/column_checkpoint_state.cpp +2 -2
  163. package/src/duckdb/src/storage/table/column_data.cpp +2 -2
  164. package/src/duckdb/src/storage/table/column_data_checkpointer.cpp +18 -6
  165. package/src/duckdb/src/storage/table/column_segment.cpp +23 -24
  166. package/src/duckdb/src/storage/table/row_group.cpp +3 -3
  167. package/src/duckdb/src/storage/table/row_group_collection.cpp +1 -1
  168. package/src/duckdb/src/storage/table/update_segment.cpp +15 -15
  169. package/src/duckdb/src/storage/wal_replay.cpp +1 -1
  170. package/src/duckdb/src/transaction/cleanup_state.cpp +10 -10
  171. package/src/duckdb/src/transaction/commit_state.cpp +19 -19
  172. package/src/duckdb/src/transaction/duck_transaction.cpp +7 -7
  173. package/src/duckdb/src/transaction/rollback_state.cpp +1 -1
  174. package/src/duckdb/src/transaction/undo_buffer.cpp +2 -1
  175. package/src/duckdb/ub_src_common_adbc.cpp +4 -0
  176. package/src/duckdb/src/include/duckdb/common/single_thread_ptr.hpp +0 -185
@@ -0,0 +1,85 @@
1
+ //===----------------------------------------------------------------------===//
2
+ // DuckDB
3
+ //
4
+ // duckdb/common/adbc/adbc.hpp
5
+ //
6
+ //
7
+ //===----------------------------------------------------------------------===//
8
+
9
+ #pragma once
10
+
11
+ #include "duckdb/common/adbc/adbc.h"
12
+
13
+ namespace duckdb_adbc {
14
+
15
+ AdbcStatusCode DatabaseNew(struct AdbcDatabase *database, struct AdbcError *error);
16
+
17
+ AdbcStatusCode DatabaseSetOption(struct AdbcDatabase *database, const char *key, const char *value,
18
+ struct AdbcError *error);
19
+
20
+ AdbcStatusCode DatabaseInit(struct AdbcDatabase *database, struct AdbcError *error);
21
+
22
+ AdbcStatusCode DatabaseRelease(struct AdbcDatabase *database, struct AdbcError *error);
23
+
24
+ AdbcStatusCode ConnectionNew(struct AdbcConnection *connection, struct AdbcError *error);
25
+
26
+ AdbcStatusCode ConnectionSetOption(struct AdbcConnection *connection, const char *key, const char *value,
27
+ struct AdbcError *error);
28
+
29
+ AdbcStatusCode ConnectionInit(struct AdbcConnection *connection, struct AdbcDatabase *database,
30
+ struct AdbcError *error);
31
+
32
+ AdbcStatusCode ConnectionRelease(struct AdbcConnection *connection, struct AdbcError *error);
33
+
34
+ AdbcStatusCode ConnectionGetInfo(struct AdbcConnection *connection, uint32_t *info_codes, size_t info_codes_length,
35
+ struct ArrowArrayStream *out, struct AdbcError *error);
36
+
37
+ AdbcStatusCode ConnectionGetObjects(struct AdbcConnection *connection, int depth, const char *catalog,
38
+ const char *db_schema, const char *table_name, const char **table_type,
39
+ const char *column_name, struct ArrowArrayStream *out, struct AdbcError *error);
40
+
41
+ AdbcStatusCode ConnectionGetTableSchema(struct AdbcConnection *connection, const char *catalog, const char *db_schema,
42
+ const char *table_name, struct ArrowSchema *schema, struct AdbcError *error);
43
+
44
+ AdbcStatusCode ConnectionGetTableTypes(struct AdbcConnection *connection, struct ArrowArrayStream *out,
45
+ struct AdbcError *error);
46
+
47
+ AdbcStatusCode ConnectionReadPartition(struct AdbcConnection *connection, const uint8_t *serialized_partition,
48
+ size_t serialized_length, struct ArrowArrayStream *out, struct AdbcError *error);
49
+
50
+ AdbcStatusCode ConnectionCommit(struct AdbcConnection *connection, struct AdbcError *error);
51
+
52
+ AdbcStatusCode ConnectionRollback(struct AdbcConnection *connection, struct AdbcError *error);
53
+
54
+ AdbcStatusCode StatementNew(struct AdbcConnection *connection, struct AdbcStatement *statement,
55
+ struct AdbcError *error);
56
+
57
+ AdbcStatusCode StatementRelease(struct AdbcStatement *statement, struct AdbcError *error);
58
+
59
+ AdbcStatusCode StatementExecuteQuery(struct AdbcStatement *statement, struct ArrowArrayStream *out,
60
+ int64_t *rows_affected, struct AdbcError *error);
61
+
62
+ AdbcStatusCode StatementPrepare(struct AdbcStatement *statement, struct AdbcError *error);
63
+
64
+ AdbcStatusCode StatementSetSqlQuery(struct AdbcStatement *statement, const char *query, struct AdbcError *error);
65
+
66
+ AdbcStatusCode StatementSetSubstraitPlan(struct AdbcStatement *statement, const uint8_t *plan, size_t length,
67
+ struct AdbcError *error);
68
+
69
+ AdbcStatusCode StatementBind(struct AdbcStatement *statement, struct ArrowArray *values, struct ArrowSchema *schema,
70
+ struct AdbcError *error);
71
+
72
+ AdbcStatusCode StatementBindStream(struct AdbcStatement *statement, struct ArrowArrayStream *stream,
73
+ struct AdbcError *error);
74
+
75
+ AdbcStatusCode StatementGetParameterSchema(struct AdbcStatement *statement, struct ArrowSchema *schema,
76
+ struct AdbcError *error);
77
+
78
+ AdbcStatusCode StatementSetOption(struct AdbcStatement *statement, const char *key, const char *value,
79
+ struct AdbcError *error);
80
+
81
+ AdbcStatusCode StatementExecutePartitions(struct AdbcStatement *statement, struct ArrowSchema *schema,
82
+ struct AdbcPartitions *partitions, int64_t *rows_affected,
83
+ struct AdbcError *error);
84
+
85
+ } // namespace duckdb_adbc
@@ -0,0 +1,84 @@
1
+ // Licensed to the Apache Software Foundation (ASF) under one
2
+ // or more contributor license agreements. See the NOTICE file
3
+ // distributed with this work for additional information
4
+ // regarding copyright ownership. The ASF licenses this file
5
+ // to you under the Apache License, Version 2.0 (the
6
+ // "License"); you may not use this file except in compliance
7
+ // with the License. You may obtain a copy of the License at
8
+ //
9
+ // http://www.apache.org/licenses/LICENSE-2.0
10
+ //
11
+ // Unless required by applicable law or agreed to in writing,
12
+ // software distributed under the License is distributed on an
13
+ // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ // KIND, either express or implied. See the License for the
15
+ // specific language governing permissions and limitations
16
+ // under the License.
17
+
18
+ #pragma once
19
+
20
+ #include "duckdb/common/adbc/adbc.h"
21
+
22
+ #ifdef __cplusplus
23
+ extern "C" {
24
+ #endif
25
+
26
+ #ifndef ADBC_DRIVER_MANAGER_H
27
+ #define ADBC_DRIVER_MANAGER_H
28
+ namespace duckdb_adbc {
29
+ /// \brief Common entry point for drivers via the driver manager.
30
+ ///
31
+ /// The driver manager can fill in default implementations of some
32
+ /// ADBC functions for drivers. Drivers must implement a minimum level
33
+ /// of functionality for this to be possible, however, and some
34
+ /// functions must be implemented by the driver.
35
+ ///
36
+ /// \param[in] driver_name An identifier for the driver (e.g. a path to a
37
+ /// shared library on Linux).
38
+ /// \param[in] entrypoint An identifier for the entrypoint (e.g. the
39
+ /// symbol to call for AdbcDriverInitFunc on Linux).
40
+ /// \param[in] version The ADBC revision to attempt to initialize.
41
+ /// \param[out] driver The table of function pointers to initialize.
42
+ /// \param[out] error An optional location to return an error message
43
+ /// if necessary.
44
+ ADBC_EXPORT
45
+ AdbcStatusCode AdbcLoadDriver(const char *driver_name, const char *entrypoint, int version, void *driver,
46
+ struct AdbcError *error);
47
+
48
+ /// \brief Common entry point for drivers via the driver manager.
49
+ ///
50
+ /// The driver manager can fill in default implementations of some
51
+ /// ADBC functions for drivers. Drivers must implement a minimum level
52
+ /// of functionality for this to be possible, however, and some
53
+ /// functions must be implemented by the driver.
54
+ ///
55
+ /// \param[in] init_func The entrypoint to call.
56
+ /// \param[in] version The ADBC revision to attempt to initialize.
57
+ /// \param[out] driver The table of function pointers to initialize.
58
+ /// \param[out] error An optional location to return an error message
59
+ /// if necessary.
60
+ ADBC_EXPORT
61
+ AdbcStatusCode AdbcLoadDriverFromInitFunc(AdbcDriverInitFunc init_func, int version, void *driver,
62
+ struct AdbcError *error);
63
+
64
+ /// \brief Set the AdbcDriverInitFunc to use.
65
+ ///
66
+ /// This is an extension to the ADBC API. The driver manager shims
67
+ /// the AdbcDatabase* functions to allow you to specify the
68
+ /// driver/entrypoint dynamically. This function lets you set the
69
+ /// entrypoint explicitly, for applications that can dynamically
70
+ /// load drivers on their own.
71
+ ADBC_EXPORT
72
+ AdbcStatusCode AdbcDriverManagerDatabaseSetInitFunc(struct AdbcDatabase *database, AdbcDriverInitFunc init_func,
73
+ struct AdbcError *error);
74
+
75
+ /// \brief Get a human-friendly description of a status code.
76
+ ADBC_EXPORT
77
+ const char *AdbcStatusCodeMessage(AdbcStatusCode code);
78
+
79
+ #endif // ADBC_DRIVER_MANAGER_H
80
+
81
+ #ifdef __cplusplus
82
+ }
83
+ #endif
84
+ } // namespace duckdb_adbc
@@ -183,6 +183,9 @@ void AssignSharedPointer(shared_ptr<T> &target, const shared_ptr<T> &source) {
183
183
  template<typename T>
184
184
  using reference = std::reference_wrapper<T>;
185
185
 
186
+ template<typename T>
187
+ using const_reference = std::reference_wrapper<const T>;
188
+
186
189
  //! Returns whether or not two reference wrappers refer to the same object
187
190
  template<class T>
188
191
  bool RefersToSameObject(const reference<T> &A, const reference<T> &B) {
@@ -19,7 +19,8 @@ enum class LookupResultType : uint8_t { LOOKUP_MISS, LOOKUP_HIT, LOOKUP_NULL };
19
19
 
20
20
  class ConflictManager {
21
21
  public:
22
- ConflictManager(VerifyExistenceType lookup_type, idx_t input_size, ConflictInfo *conflict_info = nullptr);
22
+ ConflictManager(VerifyExistenceType lookup_type, idx_t input_size,
23
+ optional_ptr<ConflictInfo> conflict_info = nullptr);
23
24
 
24
25
  public:
25
26
  void SetIndexCount(idx_t count);
@@ -52,7 +53,7 @@ private:
52
53
  private:
53
54
  VerifyExistenceType lookup_type;
54
55
  idx_t input_size;
55
- ConflictInfo *conflict_info;
56
+ optional_ptr<ConflictInfo> conflict_info;
56
57
  idx_t index_count;
57
58
  bool finalized = false;
58
59
  ManagedSelection conflicts;
@@ -10,7 +10,6 @@
10
10
 
11
11
  #include "duckdb/common/assert.hpp"
12
12
  #include "duckdb/common/constants.hpp"
13
- #include "duckdb/common/single_thread_ptr.hpp"
14
13
  #include "duckdb/common/vector.hpp"
15
14
 
16
15
  #include <limits>
@@ -12,7 +12,7 @@
12
12
  #include "duckdb/common/enums/pending_execution_result.hpp"
13
13
  #include "duckdb/common/mutex.hpp"
14
14
  #include "duckdb/common/pair.hpp"
15
- #include "duckdb/common/unordered_map.hpp"
15
+ #include "duckdb/common/reference_map.hpp"
16
16
  #include "duckdb/parallel/pipeline.hpp"
17
17
 
18
18
  namespace duckdb {
@@ -43,7 +43,7 @@ public:
43
43
  public:
44
44
  static Executor &Get(ClientContext &context);
45
45
 
46
- void Initialize(PhysicalOperator *physical_plan);
46
+ void Initialize(PhysicalOperator &physical_plan);
47
47
  void Initialize(unique_ptr<PhysicalOperator> physical_plan);
48
48
 
49
49
  void CancelTasks();
@@ -81,7 +81,7 @@ public:
81
81
  }
82
82
  void AddEvent(shared_ptr<Event> event);
83
83
 
84
- void AddRecursiveCTE(PhysicalOperator *rec_cte);
84
+ void AddRecursiveCTE(PhysicalOperator &rec_cte);
85
85
  void ReschedulePipelines(const vector<shared_ptr<MetaPipeline>> &pipelines, vector<shared_ptr<Event>> &events);
86
86
 
87
87
  //! Whether or not the root of the pipeline is a result collector object
@@ -93,7 +93,7 @@ public:
93
93
  bool ExecutionIsFinished();
94
94
 
95
95
  private:
96
- void InitializeInternal(PhysicalOperator *physical_plan);
96
+ void InitializeInternal(PhysicalOperator &physical_plan);
97
97
 
98
98
  void ScheduleEvents(const vector<shared_ptr<MetaPipeline>> &meta_pipelines);
99
99
  static void ScheduleEventsInternal(ScheduleEventData &event_data);
@@ -106,13 +106,13 @@ private:
106
106
 
107
107
  bool NextExecutor();
108
108
 
109
- shared_ptr<Pipeline> CreateChildPipeline(Pipeline *current, PhysicalOperator *op);
109
+ shared_ptr<Pipeline> CreateChildPipeline(Pipeline &current, PhysicalOperator &op);
110
110
 
111
111
  void VerifyPipeline(Pipeline &pipeline);
112
112
  void VerifyPipelines();
113
113
 
114
114
  private:
115
- PhysicalOperator *physical_plan;
115
+ optional_ptr<PhysicalOperator> physical_plan;
116
116
  unique_ptr<PhysicalOperator> owned_plan;
117
117
 
118
118
  mutex executor_lock;
@@ -122,7 +122,7 @@ private:
122
122
  //! The root pipelines of the query
123
123
  vector<shared_ptr<Pipeline>> root_pipelines;
124
124
  //! The recursive CTE's in this query plan
125
- vector<PhysicalOperator *> recursive_ctes;
125
+ vector<reference<PhysicalOperator>> recursive_ctes;
126
126
  //! The pipeline executor for the root pipeline
127
127
  unique_ptr<PipelineExecutor> root_executor;
128
128
  //! The current root pipeline index
@@ -25,7 +25,7 @@ public:
25
25
  shared_ptr<PreparedStatementData> prepared;
26
26
 
27
27
  public:
28
- vector<PhysicalOperator *> GetChildren() const override;
28
+ vector<const_reference<PhysicalOperator>> GetChildren() const override;
29
29
 
30
30
  public:
31
31
  void BuildPipelines(Pipeline &current, MetaPipeline &meta_pipeline) override;
@@ -36,7 +36,7 @@ public:
36
36
  }
37
37
 
38
38
  public:
39
- vector<PhysicalOperator *> GetChildren() const override;
39
+ vector<const_reference<PhysicalOperator>> GetChildren() const override;
40
40
  void BuildPipelines(Pipeline &current, MetaPipeline &meta_pipeline) override;
41
41
 
42
42
  bool IsSource() const override {
@@ -55,7 +55,7 @@ public:
55
55
 
56
56
  public:
57
57
  void BuildPipelines(Pipeline &current, MetaPipeline &meta_pipeline) override;
58
- vector<const PhysicalOperator *> GetSources() const override;
58
+ vector<const_reference<PhysicalOperator>> GetSources() const override;
59
59
  };
60
60
 
61
61
  class CrossProductExecutor {
@@ -22,14 +22,14 @@ public:
22
22
 
23
23
  public:
24
24
  PhysicalDelimJoin(vector<LogicalType> types, unique_ptr<PhysicalOperator> original_join,
25
- vector<PhysicalOperator *> delim_scans, idx_t estimated_cardinality);
25
+ vector<const_reference<PhysicalOperator>> delim_scans, idx_t estimated_cardinality);
26
26
 
27
27
  unique_ptr<PhysicalOperator> join;
28
28
  unique_ptr<PhysicalHashAggregate> distinct;
29
- vector<PhysicalOperator *> delim_scans;
29
+ vector<const_reference<PhysicalOperator>> delim_scans;
30
30
 
31
31
  public:
32
- vector<PhysicalOperator *> GetChildren() const override;
32
+ vector<const_reference<PhysicalOperator>> GetChildren() const override;
33
33
 
34
34
  public:
35
35
  unique_ptr<GlobalSinkState> GetGlobalSinkState(ClientContext &context) const override;
@@ -68,7 +68,7 @@ protected:
68
68
 
69
69
  public:
70
70
  void BuildPipelines(Pipeline &current, MetaPipeline &meta_pipeline) override;
71
- vector<const PhysicalOperator *> GetSources() const override;
71
+ vector<const_reference<PhysicalOperator>> GetSources() const override;
72
72
 
73
73
  private:
74
74
  void GetRHSMatches(ExecutionContext &context, DataChunk &input, OperatorState &state_p) const;
@@ -35,7 +35,7 @@ public:
35
35
  public:
36
36
  static void BuildJoinPipelines(Pipeline &current, MetaPipeline &confluent_pipelines, PhysicalOperator &op);
37
37
  void BuildPipelines(Pipeline &current, MetaPipeline &meta_pipeline) override;
38
- vector<const PhysicalOperator *> GetSources() const override;
38
+ vector<const_reference<PhysicalOperator>> GetSources() const override;
39
39
 
40
40
  OrderPreservationType SourceOrder() const override {
41
41
  return OrderPreservationType::NO_ORDER;
@@ -48,6 +48,6 @@ public:
48
48
 
49
49
  public:
50
50
  void BuildPipelines(Pipeline &current, MetaPipeline &meta_pipeline) override;
51
- vector<const PhysicalOperator *> GetSources() const override;
51
+ vector<const_reference<PhysicalOperator>> GetSources() const override;
52
52
  };
53
53
  } // namespace duckdb
@@ -128,7 +128,8 @@ struct BufferedCSVReaderOptions {
128
128
  std::map<LogicalTypeId, StrfTimeFormat> write_date_format = {{LogicalTypeId::DATE, {}},
129
129
  {LogicalTypeId::TIMESTAMP, {}}};
130
130
  //! Whether or not a type format is specified
131
- std::map<LogicalTypeId, bool> has_format = {{LogicalTypeId::DATE, false}, {LogicalTypeId::TIMESTAMP, false}};
131
+ std::map<LogicalTypeId, bool> has_format = {
132
+ {LogicalTypeId::DATE, false}, {LogicalTypeId::TIMESTAMP, false}, {LogicalTypeId::TIMESTAMP_TZ, false}};
132
133
 
133
134
  void Serialize(FieldWriter &writer) const;
134
135
  void Deserialize(FieldReader &reader);
@@ -18,7 +18,7 @@ public:
18
18
 
19
19
  public:
20
20
  //! INSERT INTO
21
- PhysicalBatchInsert(vector<LogicalType> types, TableCatalogEntry *table,
21
+ PhysicalBatchInsert(vector<LogicalType> types, TableCatalogEntry &table,
22
22
  physical_index_vector_t<idx_t> column_index_map, vector<unique_ptr<Expression>> bound_defaults,
23
23
  idx_t estimated_cardinality);
24
24
  //! CREATE TABLE AS
@@ -28,7 +28,7 @@ public:
28
28
  //! The map from insert column index to table column index
29
29
  physical_index_vector_t<idx_t> column_index_map;
30
30
  //! The table to insert into
31
- TableCatalogEntry *insert_table;
31
+ optional_ptr<TableCatalogEntry> insert_table;
32
32
  //! The insert types
33
33
  vector<LogicalType> insert_types;
34
34
  //! The default expressions of the columns for which no value is provided
@@ -59,7 +59,7 @@ public:
59
59
 
60
60
  public:
61
61
  void BuildPipelines(Pipeline &current, MetaPipeline &meta_pipeline) override;
62
- vector<const PhysicalOperator *> GetSources() const override;
62
+ vector<const_reference<PhysicalOperator>> GetSources() const override;
63
63
  };
64
64
 
65
65
  } // namespace duckdb
@@ -25,7 +25,7 @@ public:
25
25
 
26
26
  public:
27
27
  //! INSERT INTO
28
- PhysicalInsert(vector<LogicalType> types, TableCatalogEntry *table, physical_index_vector_t<idx_t> column_index_map,
28
+ PhysicalInsert(vector<LogicalType> types, TableCatalogEntry &table, physical_index_vector_t<idx_t> column_index_map,
29
29
  vector<unique_ptr<Expression>> bound_defaults, vector<unique_ptr<Expression>> set_expressions,
30
30
  vector<PhysicalIndex> set_columns, vector<LogicalType> set_types, idx_t estimated_cardinality,
31
31
  bool return_chunk, bool parallel, OnConflictAction action_type,
@@ -38,7 +38,7 @@ public:
38
38
  //! The map from insert column index to table column index
39
39
  physical_index_vector_t<idx_t> column_index_map;
40
40
  //! The table to insert into
41
- TableCatalogEntry *insert_table;
41
+ optional_ptr<TableCatalogEntry> insert_table;
42
42
  //! The insert types
43
43
  vector<LogicalType> insert_types;
44
44
  //! The default expressions of the columns for which no value is provided
@@ -19,12 +19,11 @@ public:
19
19
  static constexpr const PhysicalOperatorType TYPE = PhysicalOperatorType::COLUMN_DATA_SCAN;
20
20
 
21
21
  public:
22
- PhysicalColumnDataScan(vector<LogicalType> types, PhysicalOperatorType op_type, idx_t estimated_cardinality)
23
- : PhysicalOperator(op_type, std::move(types), estimated_cardinality), collection(nullptr) {
24
- }
22
+ PhysicalColumnDataScan(vector<LogicalType> types, PhysicalOperatorType op_type, idx_t estimated_cardinality,
23
+ unique_ptr<ColumnDataCollection> owned_collection = nullptr);
25
24
 
26
25
  // the column data collection to scan
27
- ColumnDataCollection *collection;
26
+ optional_ptr<ColumnDataCollection> collection;
28
27
  //! Owned column data collection, if any
29
28
  unique_ptr<ColumnDataCollection> owned_collection;
30
29
 
@@ -51,7 +51,7 @@ public:
51
51
  public:
52
52
  void BuildPipelines(Pipeline &current, MetaPipeline &meta_pipeline) override;
53
53
 
54
- vector<const PhysicalOperator *> GetSources() const override;
54
+ vector<const_reference<PhysicalOperator>> GetSources() const override;
55
55
 
56
56
  private:
57
57
  //! Probe Hash Table and eliminate duplicate rows
@@ -22,7 +22,7 @@ public:
22
22
 
23
23
  public:
24
24
  void BuildPipelines(Pipeline &current, MetaPipeline &meta_pipeline) override;
25
- vector<const PhysicalOperator *> GetSources() const override;
25
+ vector<const_reference<PhysicalOperator>> GetSources() const override;
26
26
  };
27
27
 
28
28
  } // namespace duckdb
@@ -62,7 +62,7 @@ public:
62
62
  }
63
63
  virtual string ToString() const;
64
64
  void Print() const;
65
- virtual vector<PhysicalOperator *> GetChildren() const;
65
+ virtual vector<const_reference<PhysicalOperator>> GetChildren() const;
66
66
 
67
67
  //! Return a vector of the types that will be returned by this operator
68
68
  const vector<LogicalType> &GetTypes() const {
@@ -170,7 +170,7 @@ public:
170
170
 
171
171
  public:
172
172
  // Pipeline construction
173
- virtual vector<const PhysicalOperator *> GetSources() const;
173
+ virtual vector<const_reference<PhysicalOperator>> GetSources() const;
174
174
  bool AllSourcesSupportBatchIndex() const;
175
175
 
176
176
  virtual void BuildPipelines(Pipeline &current, MetaPipeline &meta_pipeline);
@@ -199,7 +199,7 @@ public:
199
199
  ~CachingOperatorState() override {
200
200
  }
201
201
 
202
- virtual void Finalize(PhysicalOperator *op, ExecutionContext &context) override {
202
+ virtual void Finalize(const PhysicalOperator &op, ExecutionContext &context) override {
203
203
  }
204
204
 
205
205
  unique_ptr<DataChunk> cached_chunk;
@@ -30,7 +30,7 @@ public:
30
30
  virtual ~OperatorState() {
31
31
  }
32
32
 
33
- virtual void Finalize(PhysicalOperator *op, ExecutionContext &context) {
33
+ virtual void Finalize(const PhysicalOperator &op, ExecutionContext &context) {
34
34
  }
35
35
 
36
36
  template <class TARGET>
@@ -59,7 +59,7 @@ public:
59
59
  private:
60
60
  vector<BindCastFunction> bind_functions;
61
61
  //! If any custom cast functions have been defined using RegisterCastFunction, this holds the map
62
- MapCastInfo *map_info;
62
+ optional_ptr<MapCastInfo> map_info;
63
63
 
64
64
  private:
65
65
  void RegisterCastFunction(const LogicalType &source, const LogicalType &target, MapCastNode node);
@@ -215,9 +215,9 @@ public:
215
215
  DUCKDB_API static idx_t ParseMemoryLimit(const string &arg);
216
216
 
217
217
  //! Return the list of possible compression functions for the specific physical type
218
- DUCKDB_API vector<CompressionFunction *> GetCompressionFunctions(PhysicalType data_type);
218
+ DUCKDB_API vector<reference<CompressionFunction>> GetCompressionFunctions(PhysicalType data_type);
219
219
  //! Return the compression function for the specified compression type/physical type combo
220
- DUCKDB_API CompressionFunction *GetCompressionFunction(CompressionType type, PhysicalType data_type);
220
+ DUCKDB_API optional_ptr<CompressionFunction> GetCompressionFunction(CompressionType type, PhysicalType data_type);
221
221
 
222
222
  bool operator==(const DBConfig &other);
223
223
  bool operator!=(const DBConfig &other);
@@ -17,6 +17,7 @@
17
17
  #include "duckdb/common/winapi.hpp"
18
18
  #include "duckdb/execution/physical_operator.hpp"
19
19
  #include "duckdb/execution/expression_executor_state.hpp"
20
+ #include "duckdb/common/reference_map.hpp"
20
21
  #include <stack>
21
22
  #include "duckdb/common/pair.hpp"
22
23
  #include "duckdb/common/deque.hpp"
@@ -100,25 +101,25 @@ class OperatorProfiler {
100
101
  public:
101
102
  DUCKDB_API explicit OperatorProfiler(bool enabled);
102
103
 
103
- DUCKDB_API void StartOperator(const PhysicalOperator *phys_op);
104
- DUCKDB_API void EndOperator(DataChunk *chunk);
105
- DUCKDB_API void Flush(const PhysicalOperator *phys_op, ExpressionExecutor *expression_executor, const string &name,
104
+ DUCKDB_API void StartOperator(optional_ptr<const PhysicalOperator> phys_op);
105
+ DUCKDB_API void EndOperator(optional_ptr<DataChunk> chunk);
106
+ DUCKDB_API void Flush(const PhysicalOperator &phys_op, ExpressionExecutor &expression_executor, const string &name,
106
107
  int id);
107
108
 
108
109
  ~OperatorProfiler() {
109
110
  }
110
111
 
111
112
  private:
112
- void AddTiming(const PhysicalOperator *op, double time, idx_t elements);
113
+ void AddTiming(const PhysicalOperator &op, double time, idx_t elements);
113
114
 
114
115
  //! Whether or not the profiler is enabled
115
116
  bool enabled;
116
117
  //! The timer used to time the execution time of the individual Physical Operators
117
118
  Profiler op;
118
119
  //! The stack of Physical Operators that are currently active
119
- const PhysicalOperator *active_operator;
120
+ optional_ptr<const PhysicalOperator> active_operator;
120
121
  //! A mapping of physical operators to recorded timings
121
- unordered_map<const PhysicalOperator *, OperatorInformation> timings;
122
+ reference_map_t<const PhysicalOperator, OperatorInformation> timings;
122
123
  };
123
124
 
124
125
  //! The QueryProfiler can be used to measure timings of queries
@@ -139,10 +140,10 @@ public:
139
140
  // Propagate save_location, enabled, detailed_enabled and automatic_print_format.
140
141
  void Propagate(QueryProfiler &qp);
141
142
 
142
- using TreeMap = unordered_map<const PhysicalOperator *, TreeNode *>;
143
+ using TreeMap = reference_map_t<const PhysicalOperator, reference<TreeNode>>;
143
144
 
144
145
  private:
145
- unique_ptr<TreeNode> CreateTree(PhysicalOperator *root, idx_t depth = 0);
146
+ unique_ptr<TreeNode> CreateTree(const PhysicalOperator &root, idx_t depth = 0);
146
147
  void Render(const TreeNode &node, std::ostream &str) const;
147
148
 
148
149
  public:
@@ -165,7 +166,7 @@ public:
165
166
  DUCKDB_API void StartPhase(string phase);
166
167
  DUCKDB_API void EndPhase();
167
168
 
168
- DUCKDB_API void Initialize(PhysicalOperator *root);
169
+ DUCKDB_API void Initialize(const PhysicalOperator &root);
169
170
 
170
171
  DUCKDB_API string QueryTreeToString() const;
171
172
  DUCKDB_API void QueryTreeToStream(std::ostream &str) const;
@@ -35,7 +35,7 @@ public:
35
35
  //! Get the PipelineBuildState for this MetaPipeline
36
36
  PipelineBuildState &GetState() const;
37
37
  //! Get the sink operator for this MetaPipeline
38
- PhysicalOperator *GetSink() const;
38
+ optional_ptr<PhysicalOperator> GetSink() const;
39
39
 
40
40
  //! Get the initial pipeline of this MetaPipeline
41
41
  shared_ptr<Pipeline> &GetBasePipeline();
@@ -71,9 +71,9 @@ public:
71
71
  Pipeline *CreateUnionPipeline(Pipeline &current, bool order_matters);
72
72
  //! Create a child pipeline op 'current' starting at 'op',
73
73
  //! where 'last_pipeline' is the last pipeline added before building out 'current'
74
- void CreateChildPipeline(Pipeline &current, PhysicalOperator *op, Pipeline *last_pipeline);
74
+ void CreateChildPipeline(Pipeline &current, PhysicalOperator &op, Pipeline *last_pipeline);
75
75
  //! Create a MetaPipeline child that 'current' depends on
76
- MetaPipeline *CreateChildMetaPipeline(Pipeline &current, PhysicalOperator *op);
76
+ MetaPipeline &CreateChildMetaPipeline(Pipeline &current, PhysicalOperator &op);
77
77
 
78
78
  private:
79
79
  //! The executor for all MetaPipelines in the query plan
@@ -81,7 +81,7 @@ private:
81
81
  //! The PipelineBuildState for all MetaPipelines in the query plan
82
82
  PipelineBuildState &state;
83
83
  //! The sink of all pipelines within this MetaPipeline
84
- PhysicalOperator *sink;
84
+ optional_ptr<PhysicalOperator> sink;
85
85
  //! Whether this MetaPipeline is a the recursive pipeline of a recursive CTE
86
86
  bool recursive_cte;
87
87
  //! All pipelines with a different source, but the same sink