duckdb 1.3.1-dev6.0 → 1.3.1

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 (179) hide show
  1. package/package.json +1 -1
  2. package/src/duckdb/extension/core_functions/aggregate/distributive/arg_min_max.cpp +27 -39
  3. package/src/duckdb/extension/core_functions/aggregate/holistic/quantile.cpp +2 -3
  4. package/src/duckdb/extension/core_functions/include/core_functions/aggregate/quantile_sort_tree.hpp +1 -1
  5. package/src/duckdb/extension/core_functions/lambda_functions.cpp +16 -14
  6. package/src/duckdb/extension/core_functions/scalar/list/list_filter.cpp +3 -2
  7. package/src/duckdb/extension/core_functions/scalar/list/list_reduce.cpp +46 -10
  8. package/src/duckdb/extension/core_functions/scalar/list/list_transform.cpp +3 -2
  9. package/src/duckdb/extension/core_functions/scalar/random/random.cpp +3 -1
  10. package/src/duckdb/extension/icu/icu-datefunc.cpp +5 -3
  11. package/src/duckdb/extension/icu/icu-strptime.cpp +6 -1
  12. package/src/duckdb/extension/icu/icu-timezone.cpp +4 -0
  13. package/src/duckdb/extension/icu/icu_extension.cpp +7 -2
  14. package/src/duckdb/extension/icu/include/icu-datefunc.hpp +1 -1
  15. package/src/duckdb/extension/icu/include/icu-helpers.hpp +1 -1
  16. package/src/duckdb/extension/icu/third_party/icu/common/uloc.cpp +5 -5
  17. package/src/duckdb/extension/json/include/json_common.hpp +19 -0
  18. package/src/duckdb/extension/json/include/json_deserializer.hpp +1 -4
  19. package/src/duckdb/extension/json/include/json_functions.hpp +4 -4
  20. package/src/duckdb/extension/json/json_functions/json_serialize_sql.cpp +38 -17
  21. package/src/duckdb/extension/json/json_functions/json_table_in_out.cpp +11 -7
  22. package/src/duckdb/extension/json/json_functions.cpp +4 -4
  23. package/src/duckdb/extension/json/json_reader.cpp +1 -1
  24. package/src/duckdb/extension/parquet/column_reader.cpp +7 -1
  25. package/src/duckdb/extension/parquet/include/parquet_bss_decoder.hpp +2 -2
  26. package/src/duckdb/extension/parquet/include/parquet_dbp_encoder.hpp +2 -2
  27. package/src/duckdb/extension/parquet/include/parquet_reader.hpp +2 -1
  28. package/src/duckdb/extension/parquet/include/parquet_statistics.hpp +1 -1
  29. package/src/duckdb/extension/parquet/include/parquet_writer.hpp +3 -0
  30. package/src/duckdb/extension/parquet/include/writer/parquet_write_operators.hpp +3 -1
  31. package/src/duckdb/extension/parquet/include/writer/templated_column_writer.hpp +1 -1
  32. package/src/duckdb/extension/parquet/parquet_crypto.cpp +9 -5
  33. package/src/duckdb/extension/parquet/parquet_extension.cpp +26 -0
  34. package/src/duckdb/extension/parquet/parquet_float16.cpp +4 -2
  35. package/src/duckdb/extension/parquet/parquet_metadata.cpp +3 -3
  36. package/src/duckdb/extension/parquet/parquet_multi_file_info.cpp +12 -0
  37. package/src/duckdb/extension/parquet/parquet_reader.cpp +5 -4
  38. package/src/duckdb/extension/parquet/parquet_statistics.cpp +13 -3
  39. package/src/duckdb/extension/parquet/parquet_writer.cpp +1 -1
  40. package/src/duckdb/extension/parquet/reader/decimal_column_reader.cpp +1 -1
  41. package/src/duckdb/extension/parquet/reader/string_column_reader.cpp +1 -1
  42. package/src/duckdb/extension/parquet/reader/struct_column_reader.cpp +13 -4
  43. package/src/duckdb/extension/parquet/serialize_parquet.cpp +2 -0
  44. package/src/duckdb/src/catalog/catalog.cpp +10 -4
  45. package/src/duckdb/src/catalog/catalog_entry/duck_table_entry.cpp +4 -10
  46. package/src/duckdb/src/catalog/catalog_entry/schema_catalog_entry.cpp +1 -2
  47. package/src/duckdb/src/catalog/catalog_entry/sequence_catalog_entry.cpp +1 -1
  48. package/src/duckdb/src/catalog/catalog_entry/table_catalog_entry.cpp +2 -2
  49. package/src/duckdb/src/catalog/catalog_entry/type_catalog_entry.cpp +1 -1
  50. package/src/duckdb/src/catalog/catalog_search_path.cpp +7 -1
  51. package/src/duckdb/src/catalog/catalog_set.cpp +21 -1
  52. package/src/duckdb/src/common/adbc/adbc.cpp +1 -1
  53. package/src/duckdb/src/common/arrow/arrow_appender.cpp +17 -5
  54. package/src/duckdb/src/common/arrow/arrow_converter.cpp +23 -15
  55. package/src/duckdb/src/common/box_renderer.cpp +1 -2
  56. package/src/duckdb/src/common/enum_util.cpp +4 -3
  57. package/src/duckdb/src/common/local_file_system.cpp +13 -12
  58. package/src/duckdb/src/common/multi_file/multi_file_column_mapper.cpp +35 -12
  59. package/src/duckdb/src/common/multi_file/multi_file_reader.cpp +13 -3
  60. package/src/duckdb/src/common/string_util.cpp +7 -5
  61. package/src/duckdb/src/common/tree_renderer/graphviz_tree_renderer.cpp +4 -4
  62. package/src/duckdb/src/common/tree_renderer/html_tree_renderer.cpp +4 -4
  63. package/src/duckdb/src/common/tree_renderer/json_tree_renderer.cpp +4 -4
  64. package/src/duckdb/src/common/tree_renderer/text_tree_renderer.cpp +4 -4
  65. package/src/duckdb/src/common/types/row/tuple_data_segment.cpp +1 -1
  66. package/src/duckdb/src/common/types/uuid.cpp +5 -1
  67. package/src/duckdb/src/common/types.cpp +28 -0
  68. package/src/duckdb/src/common/virtual_file_system.cpp +5 -0
  69. package/src/duckdb/src/execution/column_binding_resolver.cpp +49 -30
  70. package/src/duckdb/src/execution/index/fixed_size_allocator.cpp +4 -0
  71. package/src/duckdb/src/execution/join_hashtable.cpp +10 -7
  72. package/src/duckdb/src/execution/operator/aggregate/physical_streaming_window.cpp +3 -3
  73. package/src/duckdb/src/execution/operator/csv_scanner/encode/csv_encoder.cpp +1 -1
  74. package/src/duckdb/src/execution/operator/csv_scanner/scanner/column_count_scanner.cpp +2 -1
  75. package/src/duckdb/src/execution/operator/csv_scanner/scanner/skip_scanner.cpp +1 -4
  76. package/src/duckdb/src/execution/operator/csv_scanner/scanner/string_value_scanner.cpp +53 -1
  77. package/src/duckdb/src/execution/operator/csv_scanner/sniffer/dialect_detection.cpp +58 -59
  78. package/src/duckdb/src/execution/operator/join/physical_hash_join.cpp +10 -5
  79. package/src/duckdb/src/execution/operator/persistent/physical_batch_copy_to_file.cpp +4 -0
  80. package/src/duckdb/src/execution/operator/persistent/physical_copy_to_file.cpp +18 -8
  81. package/src/duckdb/src/execution/operator/persistent/physical_export.cpp +1 -1
  82. package/src/duckdb/src/execution/operator/schema/physical_attach.cpp +1 -0
  83. package/src/duckdb/src/execution/physical_plan_generator.cpp +5 -5
  84. package/src/duckdb/src/function/cast/vector_cast_helpers.cpp +2 -1
  85. package/src/duckdb/src/function/function.cpp +4 -0
  86. package/src/duckdb/src/function/scalar/operator/arithmetic.cpp +6 -0
  87. package/src/duckdb/src/function/scalar/struct/remap_struct.cpp +10 -1
  88. package/src/duckdb/src/function/table/copy_csv.cpp +1 -0
  89. package/src/duckdb/src/function/table/version/pragma_version.cpp +3 -3
  90. package/src/duckdb/src/include/duckdb/catalog/catalog.hpp +1 -0
  91. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_table_entry.hpp +1 -1
  92. package/src/duckdb/src/include/duckdb/catalog/catalog_search_path.hpp +1 -1
  93. package/src/duckdb/src/include/duckdb/catalog/catalog_set.hpp +2 -0
  94. package/src/duckdb/src/include/duckdb/common/file_buffer.hpp +2 -2
  95. package/src/duckdb/src/include/duckdb/common/helper.hpp +9 -9
  96. package/src/duckdb/src/include/duckdb/common/hive_partitioning.hpp +1 -1
  97. package/src/duckdb/src/include/duckdb/common/multi_file/multi_file_column_mapper.hpp +3 -5
  98. package/src/duckdb/src/include/duckdb/common/multi_file/multi_file_reader.hpp +7 -0
  99. package/src/duckdb/src/include/duckdb/common/multi_file/multi_file_states.hpp +3 -0
  100. package/src/duckdb/src/include/duckdb/common/shadow_forbidden_functions.hpp +40 -0
  101. package/src/duckdb/src/include/duckdb/common/string.hpp +25 -2
  102. package/src/duckdb/src/include/duckdb/common/types/hugeint.hpp +20 -24
  103. package/src/duckdb/src/include/duckdb/common/types/uhugeint.hpp +20 -24
  104. package/src/duckdb/src/include/duckdb/common/types.hpp +3 -0
  105. package/src/duckdb/src/include/duckdb/common/unique_ptr.hpp +34 -8
  106. package/src/duckdb/src/include/duckdb/execution/column_binding_resolver.hpp +1 -0
  107. package/src/duckdb/src/include/duckdb/execution/join_hashtable.hpp +3 -2
  108. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/column_count_scanner.hpp +3 -0
  109. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/encode/csv_encoder.hpp +1 -1
  110. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/sniffer/csv_sniffer.hpp +15 -3
  111. package/src/duckdb/src/include/duckdb/function/cast/vector_cast_helpers.hpp +2 -2
  112. package/src/duckdb/src/include/duckdb/function/copy_function.hpp +7 -3
  113. package/src/duckdb/src/include/duckdb/function/function.hpp +1 -0
  114. package/src/duckdb/src/include/duckdb/function/function_binder.hpp +2 -1
  115. package/src/duckdb/src/include/duckdb/function/function_serialization.hpp +20 -12
  116. package/src/duckdb/src/include/duckdb/function/lambda_functions.hpp +4 -3
  117. package/src/duckdb/src/include/duckdb/function/scalar_function.hpp +3 -1
  118. package/src/duckdb/src/include/duckdb/logging/log_type.hpp +17 -0
  119. package/src/duckdb/src/include/duckdb/main/attached_database.hpp +1 -0
  120. package/src/duckdb/src/include/duckdb/main/client_properties.hpp +22 -6
  121. package/src/duckdb/src/include/duckdb/main/config.hpp +2 -0
  122. package/src/duckdb/src/include/duckdb/main/database_manager.hpp +4 -1
  123. package/src/duckdb/src/include/duckdb/main/extension_entries.hpp +27 -13
  124. package/src/duckdb/src/include/duckdb/main/secret/secret_manager.hpp +1 -0
  125. package/src/duckdb/src/include/duckdb/main/settings.hpp +11 -0
  126. package/src/duckdb/src/include/duckdb/optimizer/topn_optimizer.hpp +7 -1
  127. package/src/duckdb/src/include/duckdb/original/std/locale.hpp +10 -0
  128. package/src/duckdb/src/include/duckdb/original/std/memory.hpp +12 -0
  129. package/src/duckdb/src/include/duckdb/original/std/sstream.hpp +11 -0
  130. package/src/duckdb/src/include/duckdb/planner/expression_binder.hpp +5 -3
  131. package/src/duckdb/src/include/duckdb/storage/buffer/buffer_pool.hpp +4 -2
  132. package/src/duckdb/src/logging/log_manager.cpp +1 -0
  133. package/src/duckdb/src/logging/log_types.cpp +40 -0
  134. package/src/duckdb/src/main/attached_database.cpp +4 -0
  135. package/src/duckdb/src/main/client_context.cpp +1 -0
  136. package/src/duckdb/src/main/config.cpp +1 -0
  137. package/src/duckdb/src/main/database.cpp +1 -0
  138. package/src/duckdb/src/main/database_manager.cpp +19 -2
  139. package/src/duckdb/src/main/extension/extension_helper.cpp +4 -3
  140. package/src/duckdb/src/main/query_profiler.cpp +2 -2
  141. package/src/duckdb/src/main/query_result.cpp +1 -1
  142. package/src/duckdb/src/main/secret/secret_manager.cpp +2 -0
  143. package/src/duckdb/src/main/settings/autogenerated_settings.cpp +7 -0
  144. package/src/duckdb/src/main/settings/custom_settings.cpp +106 -34
  145. package/src/duckdb/src/optimizer/optimizer.cpp +1 -1
  146. package/src/duckdb/src/optimizer/topn_optimizer.cpp +18 -8
  147. package/src/duckdb/src/parallel/executor.cpp +5 -0
  148. package/src/duckdb/src/parser/parsed_data/create_sequence_info.cpp +1 -1
  149. package/src/duckdb/src/parser/transform/expression/transform_interval.cpp +5 -1
  150. package/src/duckdb/src/planner/binder/expression/bind_function_expression.cpp +21 -24
  151. package/src/duckdb/src/planner/binder/expression/bind_lambda.cpp +10 -8
  152. package/src/duckdb/src/planner/binder/expression/bind_operator_expression.cpp +3 -2
  153. package/src/duckdb/src/planner/binder/statement/bind_copy.cpp +0 -4
  154. package/src/duckdb/src/planner/binder/tableref/bind_basetableref.cpp +3 -0
  155. package/src/duckdb/src/planner/binder/tableref/bind_table_function.cpp +3 -0
  156. package/src/duckdb/src/planner/expression/bound_cast_expression.cpp +3 -0
  157. package/src/duckdb/src/planner/expression/bound_columnref_expression.cpp +1 -1
  158. package/src/duckdb/src/planner/expression/bound_function_expression.cpp +0 -1
  159. package/src/duckdb/src/planner/expression/bound_reference_expression.cpp +1 -1
  160. package/src/duckdb/src/planner/expression_binder.cpp +4 -2
  161. package/src/duckdb/src/planner/logical_operator.cpp +2 -1
  162. package/src/duckdb/src/planner/subquery/flatten_dependent_join.cpp +4 -1
  163. package/src/duckdb/src/storage/buffer/block_handle.cpp +8 -0
  164. package/src/duckdb/src/storage/buffer/buffer_pool.cpp +44 -18
  165. package/src/duckdb/src/storage/caching_file_system.cpp +7 -7
  166. package/src/duckdb/src/storage/standard_buffer_manager.cpp +4 -3
  167. package/src/duckdb/src/storage/storage_info.cpp +2 -0
  168. package/src/duckdb/src/storage/wal_replay.cpp +9 -4
  169. package/src/duckdb/third_party/fmt/include/fmt/format.h +8 -1
  170. package/src/duckdb/third_party/fsst/libfsst.cpp +4 -3
  171. package/src/duckdb/third_party/httplib/httplib.hpp +25 -22
  172. package/src/duckdb/third_party/hyperloglog/sds.cpp +7 -3
  173. package/src/duckdb/third_party/libpg_query/src_common_keywords.cpp +8 -1
  174. package/src/duckdb/third_party/re2/re2/filtered_re2.h +8 -2
  175. package/src/duckdb/third_party/re2/re2/pod_array.h +7 -1
  176. package/src/duckdb/third_party/re2/re2/re2.cc +6 -2
  177. package/src/duckdb/third_party/re2/re2/set.cc +1 -1
  178. package/src/duckdb/third_party/re2/re2/set.h +7 -1
  179. package/src/duckdb/ub_src_logging.cpp +4 -4
@@ -12,6 +12,7 @@
12
12
  #include "duckdb/catalog/catalog_entry/table_function_catalog_entry.hpp"
13
13
  #include "duckdb/common/serializer/serializer.hpp"
14
14
  #include "duckdb/common/serializer/deserializer.hpp"
15
+ #include "duckdb/function/function_binder.hpp"
15
16
 
16
17
  namespace duckdb {
17
18
 
@@ -39,8 +40,8 @@ public:
39
40
 
40
41
  template <class FUNC, class CATALOG_ENTRY>
41
42
  static FUNC DeserializeFunction(ClientContext &context, CatalogType catalog_type, const string &catalog_name,
42
- const string &schema_name, const string &name, vector<LogicalType> arguments,
43
- vector<LogicalType> original_arguments) {
43
+ const string &schema_name, const string &name, const vector<LogicalType> &arguments,
44
+ const vector<LogicalType> &original_arguments) {
44
45
  EntryLookupInfo lookup_info(catalog_type, name);
45
46
  auto &func_catalog =
46
47
  Catalog::GetEntry(context, catalog_type, catalog_name.empty() ? SYSTEM_CATALOG : catalog_name,
@@ -52,8 +53,6 @@ public:
52
53
  auto &functions = func_catalog.Cast<CATALOG_ENTRY>();
53
54
  auto function = functions.functions.GetFunctionByArguments(
54
55
  context, original_arguments.empty() ? arguments : original_arguments);
55
- function.arguments = std::move(arguments);
56
- function.original_arguments = std::move(original_arguments);
57
56
  return function;
58
57
  }
59
58
 
@@ -72,8 +71,12 @@ public:
72
71
  schema_name = DEFAULT_SCHEMA;
73
72
  }
74
73
  auto function = DeserializeFunction<FUNC, CATALOG_ENTRY>(context, catalog_type, catalog_name, schema_name, name,
75
- std::move(arguments), std::move(original_arguments));
74
+ arguments, original_arguments);
76
75
  auto has_serialize = deserializer.ReadProperty<bool>(503, "has_serialize");
76
+ if (has_serialize) {
77
+ function.arguments = std::move(arguments);
78
+ function.original_arguments = std::move(original_arguments);
79
+ }
77
80
  return make_pair(std::move(function), has_serialize);
78
81
  }
79
82
 
@@ -139,15 +142,20 @@ public:
139
142
  deserializer.Set<const LogicalType &>(return_type);
140
143
  bind_data = FunctionDeserialize<FUNC>(deserializer, function);
141
144
  deserializer.Unset<LogicalType>();
142
- } else if (function.bind) {
143
- try {
144
- bind_data = function.bind(context, function, children);
145
- } catch (std::exception &ex) {
146
- ErrorData error(ex);
147
- throw SerializationException("Error during bind of function in deserialization: %s",
148
- error.RawMessage());
145
+ } else {
146
+ if (function.bind) {
147
+ try {
148
+ bind_data = function.bind(context, function, children);
149
+ } catch (std::exception &ex) {
150
+ ErrorData error(ex);
151
+ throw SerializationException("Error during bind of function in deserialization: %s",
152
+ error.RawMessage());
153
+ }
149
154
  }
155
+ FunctionBinder binder(context);
156
+ binder.CastToFunctionArguments(function, children);
150
157
  }
158
+
151
159
  if (TypeRequiresAssignment(function.return_type)) {
152
160
  function.return_type = std::move(return_type);
153
161
  }
@@ -53,10 +53,11 @@ public:
53
53
 
54
54
  class LambdaFunctions {
55
55
  public:
56
+ //! Returns the list child type
57
+ static LogicalType DetermineListChildType(const LogicalType &child_type);
58
+
56
59
  //! Returns the parameter type for binary lambdas
57
- static LogicalType BindBinaryLambda(const idx_t parameter_idx, const LogicalType &list_child_type);
58
- //! Returns the parameter type for ternary lambdas
59
- static LogicalType BindTernaryLambda(const idx_t parameter_idx, const LogicalType &list_child_type);
60
+ static LogicalType BindBinaryChildren(const vector<LogicalType> &function_child_types, const idx_t parameter_idx);
60
61
 
61
62
  //! Checks for NULL list parameter and prepared statements and adds bound cast expression
62
63
  static unique_ptr<FunctionData> ListLambdaPrepareBind(vector<unique_ptr<Expression>> &arguments,
@@ -109,7 +109,9 @@ typedef unique_ptr<FunctionLocalState> (*init_local_state_t)(ExpressionState &st
109
109
  //! The type to propagate statistics for this scalar function
110
110
  typedef unique_ptr<BaseStatistics> (*function_statistics_t)(ClientContext &context, FunctionStatisticsInput &input);
111
111
  //! The type to bind lambda-specific parameter types
112
- typedef LogicalType (*bind_lambda_function_t)(const idx_t parameter_idx, const LogicalType &list_child_type);
112
+ typedef LogicalType (*bind_lambda_function_t)(ClientContext &context, const vector<LogicalType> &function_child_types,
113
+ idx_t parameter_idx);
114
+
113
115
  //! The type to bind lambda-specific parameter types
114
116
  typedef void (*get_modified_databases_t)(ClientContext &context, FunctionModifiedDatabasesInput &input);
115
117
 
@@ -9,11 +9,14 @@
9
9
  #pragma once
10
10
 
11
11
  #include "duckdb/logging/logging.hpp"
12
+ #include "duckdb/common/string_util.hpp"
12
13
 
13
14
  namespace duckdb {
15
+
14
16
  struct FileHandle;
15
17
  struct BaseRequest;
16
18
  struct HTTPResponse;
19
+ class PhysicalOperator;
17
20
 
18
21
  //! Log types provide some structure to the formats that the different log messages can have
19
22
  //! For now, this holds a type that the VARCHAR value will be auto-cast into.
@@ -88,4 +91,18 @@ public:
88
91
  }
89
92
  };
90
93
 
94
+ class PhysicalOperatorLogType : public LogType {
95
+ public:
96
+ static constexpr const char *NAME = "PhysicalOperator";
97
+ static constexpr LogLevel LEVEL = LogLevel::LOG_DEBUG;
98
+
99
+ //! Construct the log type
100
+ PhysicalOperatorLogType();
101
+
102
+ static LogicalType GetLogType();
103
+
104
+ static string ConstructLogMessage(const PhysicalOperator &op, const string &class_p, const string &event,
105
+ const vector<pair<string, string>> &info);
106
+ };
107
+
91
108
  } // namespace duckdb
@@ -64,6 +64,7 @@ public:
64
64
 
65
65
  //! Initializes the catalog and storage of the attached database.
66
66
  void Initialize(optional_ptr<ClientContext> context = nullptr, StorageOptions options = StorageOptions());
67
+ void FinalizeLoad(optional_ptr<ClientContext> context);
67
68
  void Close();
68
69
 
69
70
  Catalog &ParentCatalog() override;
@@ -8,8 +8,6 @@
8
8
 
9
9
  #pragma once
10
10
 
11
- #include <utility>
12
-
13
11
  #include "duckdb/common/string.hpp"
14
12
  #include "duckdb/common/types.hpp"
15
13
 
@@ -17,14 +15,31 @@ namespace duckdb {
17
15
 
18
16
  enum class ArrowOffsetSize : uint8_t { REGULAR, LARGE };
19
17
 
18
+ enum ArrowFormatVersion : uint8_t {
19
+ //! Base Version
20
+ V1_0 = 10,
21
+ //! Added 256-bit Decimal type.
22
+ V1_1 = 11,
23
+ //! Added MonthDayNano interval type.
24
+ V1_2 = 12,
25
+ //! Added Run-End Encoded Layout.
26
+ V1_3 = 13,
27
+ //! Added Variable-size Binary View Layout and the associated BinaryView and Utf8View types.
28
+ //! Added ListView Layout and the associated ListView and LargeListView types. Added Variadic buffers.
29
+ V1_4 = 14,
30
+ //! Expanded Decimal type bit widths to allow 32-bit and 64-bit types.
31
+ V1_5 = 15
32
+ };
33
+
20
34
  //! A set of properties from the client context that can be used to interpret the query result
21
35
  struct ClientProperties {
22
- ClientProperties(string time_zone_p, ArrowOffsetSize arrow_offset_size_p, bool arrow_use_list_view_p,
23
- bool produce_arrow_string_view_p, bool lossless_conversion,
24
- optional_ptr<ClientContext> client_context)
36
+ ClientProperties(string time_zone_p, const ArrowOffsetSize arrow_offset_size_p, const bool arrow_use_list_view_p,
37
+ const bool produce_arrow_string_view_p, const bool lossless_conversion,
38
+ const ArrowFormatVersion arrow_output_version, const optional_ptr<ClientContext> client_context)
25
39
  : time_zone(std::move(time_zone_p)), arrow_offset_size(arrow_offset_size_p),
26
40
  arrow_use_list_view(arrow_use_list_view_p), produce_arrow_string_view(produce_arrow_string_view_p),
27
- arrow_lossless_conversion(lossless_conversion), client_context(client_context) {
41
+ arrow_lossless_conversion(lossless_conversion), arrow_output_version(arrow_output_version),
42
+ client_context(client_context) {
28
43
  }
29
44
 
30
45
  string time_zone = "UTC";
@@ -32,6 +47,7 @@ struct ClientProperties {
32
47
  bool arrow_use_list_view = false;
33
48
  bool produce_arrow_string_view = false;
34
49
  bool arrow_lossless_conversion = false;
50
+ ArrowFormatVersion arrow_output_version = V1_0;
35
51
  optional_ptr<ClientContext> client_context;
36
52
  };
37
53
  } // namespace duckdb
@@ -296,6 +296,8 @@ struct DBConfigOptions {
296
296
  LogConfig log_config = LogConfig();
297
297
  //! Whether to enable external file caching using CachingFileSystem
298
298
  bool enable_external_file_cache = true;
299
+ //! Output version of arrow depending on the format version
300
+ ArrowFormatVersion arrow_output_version = V1_0;
299
301
  //! Partially process tasks before rescheduling - allows for more scheduler fairness between separate queries
300
302
  #ifdef DUCKDB_ALTERNATIVE_VERIFY
301
303
  bool scheduler_process_partial = true;
@@ -43,6 +43,8 @@ public:
43
43
 
44
44
  //! Initializes the system catalog of the attached SYSTEM_DATABASE.
45
45
  void InitializeSystemCatalog();
46
+ //! Finalize starting up the system
47
+ void FinalizeStartup();
46
48
  //! Get an attached database by its name
47
49
  optional_ptr<AttachedDatabase> GetDatabase(ClientContext &context, const string &name);
48
50
  //! Attach a new database
@@ -66,7 +68,8 @@ public:
66
68
  void GetDatabaseType(ClientContext &context, AttachInfo &info, const DBConfig &config, AttachOptions &options);
67
69
  //! Scans the catalog set and adds each committed database entry, and each database entry of the current
68
70
  //! transaction, to a vector holding AttachedDatabase references
69
- vector<reference<AttachedDatabase>> GetDatabases(ClientContext &context);
71
+ vector<reference<AttachedDatabase>> GetDatabases(ClientContext &context,
72
+ const optional_idx max_db_count = optional_idx());
70
73
  //! Scans the catalog set and returns each committed database entry
71
74
  vector<reference<AttachedDatabase>> GetDatabases();
72
75
  //! Removes all databases from the catalog set. This is necessary for the database instance's destructor,
@@ -150,6 +150,20 @@ static constexpr ExtensionFunctionEntry EXTENSION_FUNCTIONS[] = {
150
150
  {"delta_scan", "delta", CatalogType::TABLE_FUNCTION_ENTRY},
151
151
  {"drop_fts_index", "fts", CatalogType::PRAGMA_FUNCTION_ENTRY},
152
152
  {"dsdgen", "tpcds", CatalogType::TABLE_FUNCTION_ENTRY},
153
+ {"duckdb_proj_compiled_version", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
154
+ {"duckdb_proj_version", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
155
+ {"ducklake_add_data_files", "ducklake", CatalogType::TABLE_FUNCTION_ENTRY},
156
+ {"ducklake_cleanup_old_files", "ducklake", CatalogType::TABLE_FUNCTION_ENTRY},
157
+ {"ducklake_expire_snapshots", "ducklake", CatalogType::TABLE_FUNCTION_ENTRY},
158
+ {"ducklake_list_files", "ducklake", CatalogType::TABLE_FUNCTION_ENTRY},
159
+ {"ducklake_merge_adjacent_files", "ducklake", CatalogType::TABLE_FUNCTION_ENTRY},
160
+ {"ducklake_options", "ducklake", CatalogType::TABLE_FUNCTION_ENTRY},
161
+ {"ducklake_set_option", "ducklake", CatalogType::TABLE_FUNCTION_ENTRY},
162
+ {"ducklake_snapshots", "ducklake", CatalogType::TABLE_FUNCTION_ENTRY},
163
+ {"ducklake_table_changes", "ducklake", CatalogType::TABLE_MACRO_ENTRY},
164
+ {"ducklake_table_deletions", "ducklake", CatalogType::TABLE_FUNCTION_ENTRY},
165
+ {"ducklake_table_info", "ducklake", CatalogType::TABLE_FUNCTION_ENTRY},
166
+ {"ducklake_table_insertions", "ducklake", CatalogType::TABLE_FUNCTION_ENTRY},
153
167
  {"editdist3", "core_functions", CatalogType::SCALAR_FUNCTION_ENTRY},
154
168
  {"element_at", "core_functions", CatalogType::SCALAR_FUNCTION_ENTRY},
155
169
  {"encode", "core_functions", CatalogType::SCALAR_FUNCTION_ENTRY},
@@ -538,6 +552,7 @@ static constexpr ExtensionFunctionEntry EXTENSION_FUNCTIONS[] = {
538
552
  {"st_assvg", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
539
553
  {"st_astext", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
540
554
  {"st_aswkb", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
555
+ {"st_azimuth", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
541
556
  {"st_boundary", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
542
557
  {"st_buffer", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
543
558
  {"st_buildarea", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
@@ -561,11 +576,13 @@ static constexpr ExtensionFunctionEntry EXTENSION_FUNCTIONS[] = {
561
576
  {"st_dimension", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
562
577
  {"st_disjoint", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
563
578
  {"st_distance", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
579
+ {"st_distance_geos", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
564
580
  {"st_distance_sphere", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
565
581
  {"st_distance_spheroid", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
566
582
  {"st_drivers", "spatial", CatalogType::TABLE_FUNCTION_ENTRY},
567
583
  {"st_dump", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
568
584
  {"st_dwithin", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
585
+ {"st_dwithin_geos", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
569
586
  {"st_dwithin_spheroid", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
570
587
  {"st_endpoint", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
571
588
  {"st_envelope", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
@@ -612,6 +629,7 @@ static constexpr ExtensionFunctionEntry EXTENSION_FUNCTIONS[] = {
612
629
  {"st_makepolygon", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
613
630
  {"st_makevalid", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
614
631
  {"st_maximuminscribedcircle", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
632
+ {"st_memunion_agg", "spatial", CatalogType::AGGREGATE_FUNCTION_ENTRY},
615
633
  {"st_minimumrotatedrectangle", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
616
634
  {"st_mmax", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
617
635
  {"st_mmin", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
@@ -654,6 +672,7 @@ static constexpr ExtensionFunctionEntry EXTENSION_FUNCTIONS[] = {
654
672
  {"st_simplify", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
655
673
  {"st_simplifypreservetopology", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
656
674
  {"st_startpoint", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
675
+ {"st_tileenvelope", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
657
676
  {"st_touches", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
658
677
  {"st_transform", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
659
678
  {"st_translate", "spatial", CatalogType::MACRO_ENTRY},
@@ -1025,21 +1044,15 @@ static constexpr ExtensionEntry EXTENSION_SETTINGS[] = {
1025
1044
  }; // END_OF_EXTENSION_SETTINGS
1026
1045
 
1027
1046
  static constexpr ExtensionEntry EXTENSION_SECRET_TYPES[] = {
1028
- {"aws", "httpfs"},
1029
- {"azure", "azure"},
1030
- {"gcs", "httpfs"},
1031
- {"huggingface", "httpfs"},
1032
- {"iceberg", "iceberg"},
1033
- {"mysql", "mysql_scanner"},
1034
- {"postgres", "postgres_scanner"},
1035
- {"r2", "httpfs"},
1036
- {"s3", "httpfs"},
1047
+ {"aws", "httpfs"}, {"azure", "azure"}, {"ducklake", "ducklake"}, {"gcs", "httpfs"},
1048
+ {"huggingface", "httpfs"}, {"iceberg", "iceberg"}, {"mysql", "mysql_scanner"}, {"postgres", "postgres_scanner"},
1049
+ {"r2", "httpfs"}, {"s3", "httpfs"},
1037
1050
  }; // END_OF_EXTENSION_SECRET_TYPES
1038
1051
 
1039
1052
  // Note: these are currently hardcoded in scripts/generate_extensions_function.py
1040
1053
  // TODO: automate by passing though to script via duckdb
1041
- static constexpr ExtensionEntry EXTENSION_COPY_FUNCTIONS[] = {{"parquet", "parquet"},
1042
- {"json", "json"}}; // END_OF_EXTENSION_COPY_FUNCTIONS
1054
+ static constexpr ExtensionEntry EXTENSION_COPY_FUNCTIONS[] = {
1055
+ {"parquet", "parquet"}, {"json", "json"}, {"avro", "avro"}}; // END_OF_EXTENSION_COPY_FUNCTIONS
1043
1056
 
1044
1057
  // Note: these are currently hardcoded in scripts/generate_extensions_function.py
1045
1058
  // TODO: automate by passing though to script via duckdb
@@ -1082,8 +1095,8 @@ static constexpr ExtensionEntry EXTENSION_FILE_PREFIXES[] = {
1082
1095
  // Note: these are currently hardcoded in scripts/generate_extensions_function.py
1083
1096
  // TODO: automate by passing though to script via duckdb
1084
1097
  static constexpr ExtensionEntry EXTENSION_FILE_POSTFIXES[] = {
1085
- {".parquet", "parquet"}, {".json", "json"}, {".jsonl", "json"}, {".ndjson", "json"},
1086
- {".shp", "spatial"}, {".gpkg", "spatial"}, {".fgb", "spatial"}, {".xlsx", "excel"},
1098
+ {".parquet", "parquet"}, {".json", "json"}, {".jsonl", "json"}, {".ndjson", "json"}, {".shp", "spatial"},
1099
+ {".gpkg", "spatial"}, {".fgb", "spatial"}, {".xlsx", "excel"}, {".avro", "avro"},
1087
1100
  }; // END_OF_EXTENSION_FILE_POSTFIXES
1088
1101
 
1089
1102
  // Note: these are currently hardcoded in scripts/generate_extensions_function.py
@@ -1119,6 +1132,7 @@ static constexpr const char *AUTOLOADABLE_EXTENSIONS[] = {"avro",
1119
1132
  "autocomplete",
1120
1133
  "core_functions",
1121
1134
  "delta",
1135
+ "ducklake",
1122
1136
  "encodings",
1123
1137
  "excel",
1124
1138
  "fts",
@@ -222,6 +222,7 @@ protected:
222
222
  unique_ptr<CatalogEntry> CreateDefaultEntryInternal(const string &entry_name);
223
223
 
224
224
  SecretManager &secret_manager;
225
+ mutex lock;
225
226
  case_insensitive_set_t persistent_secrets;
226
227
  };
227
228
 
@@ -218,6 +218,17 @@ struct ArrowOutputListViewSetting {
218
218
  static Value GetSetting(const ClientContext &context);
219
219
  };
220
220
 
221
+ struct ArrowOutputVersionSetting {
222
+ using RETURN_TYPE = string;
223
+ static constexpr const char *Name = "arrow_output_version";
224
+ static constexpr const char *Description =
225
+ "Whether strings should be produced by DuckDB in Utf8View format instead of Utf8";
226
+ static constexpr const char *InputType = "VARCHAR";
227
+ static void SetGlobal(DatabaseInstance *db, DBConfig &config, const Value &parameter);
228
+ static void ResetGlobal(DatabaseInstance *db, DBConfig &config);
229
+ static Value GetSetting(const ClientContext &context);
230
+ };
231
+
221
232
  struct AsofLoopJoinThresholdSetting {
222
233
  using RETURN_TYPE = idx_t;
223
234
  static constexpr const char *Name = "asof_loop_join_threshold";
@@ -8,6 +8,7 @@
8
8
 
9
9
  #pragma once
10
10
 
11
+ #include "duckdb/main/client_context.hpp"
11
12
  #include "duckdb/common/constants.hpp"
12
13
 
13
14
  namespace duckdb {
@@ -17,13 +18,18 @@ class Optimizer;
17
18
 
18
19
  class TopN {
19
20
  public:
21
+ explicit TopN(ClientContext &context);
22
+
20
23
  //! Optimize ORDER BY + LIMIT to TopN
21
24
  unique_ptr<LogicalOperator> Optimize(unique_ptr<LogicalOperator> op);
22
25
  //! Whether we can perform the optimization on this operator
23
- static bool CanOptimize(LogicalOperator &op);
26
+ static bool CanOptimize(LogicalOperator &op, optional_ptr<ClientContext> context = nullptr);
24
27
 
25
28
  private:
26
29
  void PushdownDynamicFilters(LogicalTopN &op);
30
+
31
+ private:
32
+ ClientContext &context;
27
33
  };
28
34
 
29
35
  } // namespace duckdb
@@ -0,0 +1,10 @@
1
+ #pragma once
2
+
3
+ #include <cctype>
4
+ #include <locale>
5
+
6
+ #define DUCKDB_BASE_STD
7
+
8
+ namespace duckdb_base_std {
9
+ using ::std::isspace;
10
+ } // namespace duckdb_base_std
@@ -0,0 +1,12 @@
1
+ #pragma once
2
+
3
+ #include <memory>
4
+
5
+ #define DUCKDB_BASE_STD
6
+
7
+ namespace duckdb_base_std {
8
+ using ::std::make_shared;
9
+ using ::std::shared_ptr;
10
+ using ::std::unique_ptr;
11
+ // using ::std::make_unique;
12
+ } // namespace duckdb_base_std
@@ -0,0 +1,11 @@
1
+ #pragma once
2
+
3
+ #include <sstream>
4
+
5
+ #define DUCKDB_BASE_STD
6
+
7
+ namespace duckdb_base_std {
8
+ using ::std::basic_stringstream;
9
+ using ::std::stringstream;
10
+ using ::std::wstringstream;
11
+ } // namespace duckdb_base_std
@@ -175,7 +175,8 @@ protected:
175
175
  BindResult BindExpression(ConjunctionExpression &expr, idx_t depth);
176
176
  BindResult BindExpression(ConstantExpression &expr, idx_t depth);
177
177
  BindResult BindExpression(FunctionExpression &expr, idx_t depth, unique_ptr<ParsedExpression> &expr_ptr);
178
- BindResult BindExpression(LambdaExpression &expr, idx_t depth, const LogicalType &list_child_type,
178
+
179
+ BindResult BindExpression(LambdaExpression &expr, idx_t depth, const vector<LogicalType> &function_child_types,
179
180
  optional_ptr<bind_lambda_function_t> bind_lambda_function);
180
181
  BindResult BindExpression(OperatorExpression &expr, idx_t depth);
181
182
  BindResult BindExpression(ParameterExpression &expr, idx_t depth);
@@ -185,10 +186,11 @@ protected:
185
186
  void TransformCapturedLambdaColumn(unique_ptr<Expression> &original, unique_ptr<Expression> &replacement,
186
187
  BoundLambdaExpression &bound_lambda_expr,
187
188
  const optional_ptr<bind_lambda_function_t> bind_lambda_function,
188
- const LogicalType &list_child_type);
189
+ const vector<LogicalType> &function_child_types);
190
+
189
191
  void CaptureLambdaColumns(BoundLambdaExpression &bound_lambda_expr, unique_ptr<Expression> &expr,
190
192
  const optional_ptr<bind_lambda_function_t> bind_lambda_function,
191
- const LogicalType &list_child_type);
193
+ const vector<LogicalType> &function_child_types);
192
194
 
193
195
  virtual unique_ptr<ParsedExpression> GetSQLValueFunction(const string &column_name);
194
196
 
@@ -91,12 +91,14 @@ protected:
91
91
  //! Increments the dead nodes for the queue with specified type
92
92
  void IncrementDeadNodes(const BlockHandle &handle);
93
93
 
94
+ //! How many eviction queue types we have (BLOCK and EXTERNAL_FILE go into same queue)
95
+ static constexpr idx_t EVICTION_QUEUE_TYPES = FILE_BUFFER_TYPE_COUNT - 1;
94
96
  //! How many eviction queues we have for the different FileBufferTypes
95
- static constexpr idx_t BLOCK_QUEUE_SIZE = 1;
97
+ static constexpr idx_t BLOCK_AND_EXTERNAL_FILE_QUEUE_SIZE = 1;
96
98
  static constexpr idx_t MANAGED_BUFFER_QUEUE_SIZE = 6;
97
99
  static constexpr idx_t TINY_BUFFER_QUEUE_SIZE = 1;
98
100
  //! Mapping and priority order for the eviction queues
99
- const array<idx_t, FILE_BUFFER_TYPE_COUNT> eviction_queue_sizes;
101
+ const array<idx_t, EVICTION_QUEUE_TYPES> eviction_queue_sizes;
100
102
 
101
103
  protected:
102
104
  enum class MemoryUsageCaches {
@@ -221,6 +221,7 @@ void LogManager::RegisterDefaultLogTypes() {
221
221
  RegisterLogType(make_uniq<FileSystemLogType>());
222
222
  RegisterLogType(make_uniq<HTTPLogType>());
223
223
  RegisterLogType(make_uniq<QueryLogType>());
224
+ RegisterLogType(make_uniq<PhysicalOperatorLogType>());
224
225
  }
225
226
 
226
227
  } // namespace duckdb
@@ -4,6 +4,7 @@
4
4
  #include "duckdb/common/http_util.hpp"
5
5
  #include "duckdb/main/client_context.hpp"
6
6
  #include "duckdb/main/database.hpp"
7
+ #include "duckdb/execution/physical_operator.hpp"
7
8
 
8
9
  namespace duckdb {
9
10
 
@@ -11,6 +12,7 @@ constexpr LogLevel DefaultLogType::LEVEL;
11
12
  constexpr LogLevel FileSystemLogType::LEVEL;
12
13
  constexpr LogLevel QueryLogType::LEVEL;
13
14
  constexpr LogLevel HTTPLogType::LEVEL;
15
+ constexpr LogLevel PhysicalOperatorLogType::LEVEL;
14
16
 
15
17
  FileSystemLogType::FileSystemLogType() : LogType(NAME, LEVEL, GetLogType()) {
16
18
  }
@@ -90,4 +92,42 @@ string HTTPLogType::ConstructLogMessage(BaseRequest &request, optional_ptr<HTTPR
90
92
  return Value::STRUCT(child_list).ToString();
91
93
  }
92
94
 
95
+ PhysicalOperatorLogType::PhysicalOperatorLogType() : LogType(NAME, LEVEL, GetLogType()) {
96
+ }
97
+
98
+ LogicalType PhysicalOperatorLogType::GetLogType() {
99
+ child_list_t<LogicalType> child_list = {
100
+ {"operator_type", LogicalType::VARCHAR},
101
+ {"parameters", LogicalType::MAP(LogicalType::VARCHAR, LogicalType::VARCHAR)},
102
+ {"class", LogicalType::VARCHAR},
103
+ {"event", LogicalType::VARCHAR},
104
+ {"info", LogicalType::MAP(LogicalType::VARCHAR, LogicalType::VARCHAR)},
105
+ };
106
+ return LogicalType::STRUCT(child_list);
107
+ }
108
+
109
+ template <class ITERABLE>
110
+ static Value StringPairIterableToMap(const ITERABLE &iterable) {
111
+ vector<Value> keys;
112
+ vector<Value> values;
113
+ for (const auto &kv : iterable) {
114
+ keys.emplace_back(kv.first);
115
+ values.emplace_back(kv.second);
116
+ }
117
+ return Value::MAP(LogicalType::VARCHAR, LogicalType::VARCHAR, std::move(keys), std::move(values));
118
+ }
119
+
120
+ string PhysicalOperatorLogType::ConstructLogMessage(const PhysicalOperator &physical_operator, const string &class_p,
121
+ const string &event, const vector<pair<string, string>> &info) {
122
+ child_list_t<Value> child_list = {
123
+ {"operator_type", EnumUtil::ToString(physical_operator.type)},
124
+ {"parameters", StringPairIterableToMap(physical_operator.ParamsToString())},
125
+ {"class", class_p},
126
+ {"event", event},
127
+ {"info", StringPairIterableToMap(info)},
128
+ };
129
+
130
+ return Value::STRUCT(std::move(child_list)).ToString();
131
+ }
132
+
93
133
  } // namespace duckdb
@@ -185,6 +185,10 @@ void AttachedDatabase::Initialize(optional_ptr<ClientContext> context, StorageOp
185
185
  }
186
186
  }
187
187
 
188
+ void AttachedDatabase::FinalizeLoad(optional_ptr<ClientContext> context) {
189
+ catalog->FinalizeLoad(context);
190
+ }
191
+
188
192
  StorageManager &AttachedDatabase::GetStorageManager() {
189
193
  if (!storage) {
190
194
  throw InternalException("Internal system catalog does not have storage");
@@ -1382,6 +1382,7 @@ ClientProperties ClientContext::GetClientProperties() {
1382
1382
  db->config.options.arrow_use_list_view,
1383
1383
  db->config.options.produce_arrow_string_views,
1384
1384
  db->config.options.arrow_lossless_conversion,
1385
+ db->config.options.arrow_output_version,
1385
1386
  this};
1386
1387
  }
1387
1388
 
@@ -72,6 +72,7 @@ static const ConfigurationOption internal_options[] = {
72
72
  DUCKDB_GLOBAL(ArrowLargeBufferSizeSetting),
73
73
  DUCKDB_GLOBAL(ArrowLosslessConversionSetting),
74
74
  DUCKDB_GLOBAL(ArrowOutputListViewSetting),
75
+ DUCKDB_GLOBAL(ArrowOutputVersionSetting),
75
76
  DUCKDB_LOCAL(AsofLoopJoinThresholdSetting),
76
77
  DUCKDB_GLOBAL(AutoinstallExtensionRepositorySetting),
77
78
  DUCKDB_GLOBAL(AutoinstallKnownExtensionsSetting),
@@ -345,6 +345,7 @@ DuckDB::DuckDB(const char *path, DBConfig *new_config) : instance(make_shared_pt
345
345
  if (instance->config.options.load_extensions) {
346
346
  ExtensionHelper::LoadAllExtensions(*this);
347
347
  }
348
+ instance->db_manager->FinalizeStartup();
348
349
  }
349
350
 
350
351
  DuckDB::DuckDB(const string &path, DBConfig *config) : DuckDB(path.c_str(), config) {
@@ -29,6 +29,13 @@ void DatabaseManager::InitializeSystemCatalog() {
29
29
  system->Initialize();
30
30
  }
31
31
 
32
+ void DatabaseManager::FinalizeStartup() {
33
+ auto databases = GetDatabases();
34
+ for (auto &db : databases) {
35
+ db.get().FinalizeLoad(nullptr);
36
+ }
37
+ }
38
+
32
39
  optional_ptr<AttachedDatabase> DatabaseManager::GetDatabase(ClientContext &context, const string &name) {
33
40
  if (StringUtil::Lower(name) == TEMP_CATALOG) {
34
41
  return context.client_data->temporary_objects.get();
@@ -236,9 +243,19 @@ void DatabaseManager::SetDefaultDatabase(ClientContext &context, const string &n
236
243
  }
237
244
  // LCOV_EXCL_STOP
238
245
 
239
- vector<reference<AttachedDatabase>> DatabaseManager::GetDatabases(ClientContext &context) {
246
+ vector<reference<AttachedDatabase>> DatabaseManager::GetDatabases(ClientContext &context,
247
+ const optional_idx max_db_count) {
240
248
  vector<reference<AttachedDatabase>> result;
241
- databases->Scan(context, [&](CatalogEntry &entry) { result.push_back(entry.Cast<AttachedDatabase>()); });
249
+ idx_t count = 2;
250
+ databases->ScanWithReturn(context, [&](CatalogEntry &entry) {
251
+ if (max_db_count.IsValid() && count >= max_db_count.GetIndex()) {
252
+ return false;
253
+ }
254
+ result.push_back(entry.Cast<AttachedDatabase>());
255
+ count++;
256
+ return true;
257
+ });
258
+
242
259
  result.push_back(*system);
243
260
  result.push_back(*context.client_data->temporary_objects);
244
261
  return result;
@@ -123,6 +123,7 @@ static const DefaultExtension internal_extensions[] = {
123
123
  {"delta", "Adds support for Delta Lake", false},
124
124
  {"fts", "Adds support for Full-Text Search Indexes", false},
125
125
  {"ui", "Adds local UI for DuckDB", false},
126
+ {"ducklake", "Adds support for DuckLake, SQL as a Lakehouse Format", false},
126
127
  {nullptr, nullptr, false}};
127
128
 
128
129
  idx_t ExtensionHelper::DefaultExtensionCount() {
@@ -140,9 +141,9 @@ DefaultExtension ExtensionHelper::GetDefaultExtension(idx_t index) {
140
141
  //===--------------------------------------------------------------------===//
141
142
  // Allow Auto-Install Extensions
142
143
  //===--------------------------------------------------------------------===//
143
- static const char *const auto_install[] = {"motherduck", "postgres_scanner", "mysql_scanner", "sqlite_scanner",
144
- "delta", "iceberg", "uc_catalog", "ui",
145
- nullptr};
144
+ static const char *const auto_install[] = {
145
+ "motherduck", "postgres_scanner", "mysql_scanner", "sqlite_scanner", "delta", "iceberg", "uc_catalog",
146
+ "ui", "ducklake", nullptr};
146
147
 
147
148
  // TODO: unify with new autoload mechanism
148
149
  bool ExtensionHelper::AllowAutoInstall(const string &extension) {