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
@@ -312,7 +312,7 @@ string QueryProfiler::ToString(ProfilerPrintFormat format) const {
312
312
  return "";
313
313
  }
314
314
  auto renderer = TreeRenderer::CreateRenderer(GetExplainFormat(format));
315
- std::stringstream str;
315
+ duckdb::stringstream str;
316
316
  auto &info = root->GetProfilingInfo();
317
317
  if (info.Enabled(info.expanded_settings, MetricsType::OPERATOR_TIMING)) {
318
318
  info.metrics[MetricsType::OPERATOR_TIMING] = main_query.Elapsed();
@@ -586,7 +586,7 @@ static string RenderTiming(double timing) {
586
586
  }
587
587
 
588
588
  string QueryProfiler::QueryTreeToString() const {
589
- std::stringstream str;
589
+ duckdb::stringstream str;
590
590
  QueryTreeToStream(str);
591
591
  return str.str();
592
592
  }
@@ -62,7 +62,7 @@ QueryResult::QueryResult(QueryResultType type, StatementType statement_type, Sta
62
62
 
63
63
  QueryResult::QueryResult(QueryResultType type, ErrorData error)
64
64
  : BaseQueryResult(type, std::move(error)),
65
- client_properties("UTC", ArrowOffsetSize::REGULAR, false, false, false, nullptr) {
65
+ client_properties("UTC", ArrowOffsetSize::REGULAR, false, false, false, V1_0, nullptr) {
66
66
  }
67
67
 
68
68
  QueryResult::~QueryResult() {
@@ -646,6 +646,7 @@ DefaultSecretGenerator::DefaultSecretGenerator(Catalog &catalog, SecretManager &
646
646
  }
647
647
 
648
648
  unique_ptr<CatalogEntry> DefaultSecretGenerator::CreateDefaultEntryInternal(const string &entry_name) {
649
+ lock_guard<mutex> guard(lock);
649
650
  auto secret_lu = persistent_secrets.find(entry_name);
650
651
  if (secret_lu == persistent_secrets.end()) {
651
652
  return nullptr;
@@ -718,6 +719,7 @@ unique_ptr<CatalogEntry> DefaultSecretGenerator::CreateDefaultEntry(ClientContex
718
719
  vector<string> DefaultSecretGenerator::GetDefaultEntries() {
719
720
  vector<string> ret;
720
721
 
722
+ lock_guard<mutex> guard(lock);
721
723
  for (const auto &res : persistent_secrets) {
722
724
  ret.push_back(res);
723
725
  }
@@ -177,6 +177,13 @@ Value ArrowOutputListViewSetting::GetSetting(const ClientContext &context) {
177
177
  return Value::BOOLEAN(config.options.arrow_use_list_view);
178
178
  }
179
179
 
180
+ //===----------------------------------------------------------------------===//
181
+ // Arrow Output Version
182
+ //===----------------------------------------------------------------------===//
183
+ void ArrowOutputVersionSetting::ResetGlobal(DatabaseInstance *db, DBConfig &config) {
184
+ config.options.arrow_output_version = DBConfig().options.arrow_output_version;
185
+ }
186
+
180
187
  //===----------------------------------------------------------------------===//
181
188
  // Asof Loop Join Threshold
182
189
  //===----------------------------------------------------------------------===//
@@ -38,6 +38,18 @@ const string GetDefaultUserAgent() {
38
38
  return StringUtil::Format("duckdb/%s(%s)", DuckDB::LibraryVersion(), DuckDB::Platform());
39
39
  }
40
40
 
41
+ namespace {
42
+
43
+ template <class T>
44
+ static DatabaseInstance &GetDB(DatabaseInstance *db) {
45
+ if (!db) {
46
+ throw InvalidInputException("Cannot change/set %s before the database is started", T::Name);
47
+ }
48
+ return *db;
49
+ }
50
+
51
+ } // namespace
52
+
41
53
  //===----------------------------------------------------------------------===//
42
54
  // Access Mode
43
55
  //===----------------------------------------------------------------------===//
@@ -270,6 +282,57 @@ Value ArrowLargeBufferSizeSetting::GetSetting(const ClientContext &context) {
270
282
  return Value::BOOLEAN(export_large_buffers_arrow);
271
283
  }
272
284
 
285
+ //===----------------------------------------------------------------------===//
286
+ // Arrow Output Format Version
287
+ //===----------------------------------------------------------------------===//
288
+ void ArrowOutputVersionSetting::SetGlobal(DatabaseInstance *db, DBConfig &config, const Value &input) {
289
+ auto arrow_version = input.ToString();
290
+ if (arrow_version == "1.0") {
291
+ config.options.arrow_output_version = V1_0;
292
+ } else if (arrow_version == "1.1") {
293
+ config.options.arrow_output_version = V1_1;
294
+ } else if (arrow_version == "1.2") {
295
+ config.options.arrow_output_version = V1_2;
296
+ } else if (arrow_version == "1.3") {
297
+ config.options.arrow_output_version = V1_3;
298
+ } else if (arrow_version == "1.4") {
299
+ config.options.arrow_output_version = V1_4;
300
+ } else if (arrow_version == "1.5") {
301
+ config.options.arrow_output_version = V1_5;
302
+ } else {
303
+ throw NotImplementedException("Unrecognized parameter for option arrow_output_version, expected either "
304
+ "\'1.0\', \'1.1\', \'1.2\', \'1.3\', \'1.4\', \'1.5\'");
305
+ }
306
+ }
307
+
308
+ Value ArrowOutputVersionSetting::GetSetting(const ClientContext &context) {
309
+ auto &config = DBConfig::GetConfig(context);
310
+ string arrow_version;
311
+ switch (config.options.arrow_output_version) {
312
+ case V1_0:
313
+ arrow_version = "1.0";
314
+ break;
315
+ case V1_1:
316
+ arrow_version = "1.1";
317
+ break;
318
+ case V1_2:
319
+ arrow_version = "1.2";
320
+ break;
321
+ case V1_3:
322
+ arrow_version = "1.3";
323
+ break;
324
+ case V1_4:
325
+ arrow_version = "1.4";
326
+ break;
327
+ case V1_5:
328
+ arrow_version = "1.5";
329
+ break;
330
+ default:
331
+ throw InternalException("Unrecognized arrow output version");
332
+ }
333
+ return Value(arrow_version);
334
+ }
335
+
273
336
  //===----------------------------------------------------------------------===//
274
337
  // Checkpoint Threshold
275
338
  //===----------------------------------------------------------------------===//
@@ -554,20 +617,16 @@ Value DisabledCompressionMethodsSetting::GetSetting(const ClientContext &context
554
617
  //===----------------------------------------------------------------------===//
555
618
  // Disabled Filesystems
556
619
  //===----------------------------------------------------------------------===//
557
- void DisabledFilesystemsSetting::SetGlobal(DatabaseInstance *db, DBConfig &config, const Value &input) {
558
- if (!db) {
559
- throw InternalException("disabled_filesystems can only be set in an active database");
560
- }
561
- auto &fs = FileSystem::GetFileSystem(*db);
620
+ void DisabledFilesystemsSetting::SetGlobal(DatabaseInstance *db_p, DBConfig &config, const Value &input) {
621
+ auto &db = GetDB<DisabledFilesystemsSetting>(db_p);
622
+ auto &fs = FileSystem::GetFileSystem(db);
562
623
  auto list = StringUtil::Split(input.ToString(), ",");
563
624
  fs.SetDisabledFileSystems(list);
564
625
  }
565
626
 
566
- void DisabledFilesystemsSetting::ResetGlobal(DatabaseInstance *db, DBConfig &config) {
567
- if (!db) {
568
- throw InternalException("disabled_filesystems can only be set in an active database");
569
- }
570
- auto &fs = FileSystem::GetFileSystem(*db);
627
+ void DisabledFilesystemsSetting::ResetGlobal(DatabaseInstance *db_p, DBConfig &config) {
628
+ auto &db = GetDB<DisabledFilesystemsSetting>(db_p);
629
+ auto &fs = FileSystem::GetFileSystem(db);
571
630
  fs.SetDisabledFileSystems(vector<string>());
572
631
  }
573
632
 
@@ -692,12 +751,14 @@ Value EnableExternalFileCacheSetting::GetSetting(const ClientContext &context) {
692
751
  Value EnableLogging::GetSetting(const ClientContext &context) {
693
752
  return context.db->GetLogManager().GetConfig().enabled;
694
753
  }
695
- void EnableLogging::SetGlobal(DatabaseInstance *db, DBConfig &config, const Value &parameter) {
696
- db->GetLogManager().SetEnableLogging(parameter.GetValue<bool>());
754
+ void EnableLogging::SetGlobal(DatabaseInstance *db_p, DBConfig &config, const Value &parameter) {
755
+ auto &db = GetDB<EnableLogging>(db_p);
756
+ db.GetLogManager().SetEnableLogging(parameter.GetValue<bool>());
697
757
  }
698
758
 
699
- void EnableLogging::ResetGlobal(DatabaseInstance *db, DBConfig &config) {
700
- db->GetLogManager().SetEnableLogging(false);
759
+ void EnableLogging::ResetGlobal(DatabaseInstance *db_p, DBConfig &config) {
760
+ auto &db = GetDB<EnableLogging>(db_p);
761
+ db.GetLogManager().SetEnableLogging(false);
701
762
  }
702
763
 
703
764
  //===----------------------------------------------------------------------===//
@@ -706,12 +767,14 @@ void EnableLogging::ResetGlobal(DatabaseInstance *db, DBConfig &config) {
706
767
  Value LoggingMode::GetSetting(const ClientContext &context) {
707
768
  return EnumUtil::ToString(context.db->GetLogManager().GetConfig().mode);
708
769
  }
709
- void LoggingMode::SetGlobal(DatabaseInstance *db, DBConfig &config, const Value &parameter) {
710
- db->GetLogManager().SetLogMode(EnumUtil::FromString<LogMode>(parameter.GetValue<string>()));
770
+ void LoggingMode::SetGlobal(DatabaseInstance *db_p, DBConfig &config, const Value &parameter) {
771
+ auto &db = GetDB<LoggingMode>(db_p);
772
+ db.GetLogManager().SetLogMode(EnumUtil::FromString<LogMode>(parameter.GetValue<string>()));
711
773
  }
712
774
 
713
- void LoggingMode::ResetGlobal(DatabaseInstance *db, DBConfig &config) {
714
- db->GetLogManager().SetLogMode(LogMode::LEVEL_ONLY);
775
+ void LoggingMode::ResetGlobal(DatabaseInstance *db_p, DBConfig &config) {
776
+ auto &db = GetDB<LoggingMode>(db_p);
777
+ db.GetLogManager().SetLogMode(LogMode::LEVEL_ONLY);
715
778
  }
716
779
 
717
780
  //===----------------------------------------------------------------------===//
@@ -720,12 +783,14 @@ void LoggingMode::ResetGlobal(DatabaseInstance *db, DBConfig &config) {
720
783
  Value LoggingLevel::GetSetting(const ClientContext &context) {
721
784
  return EnumUtil::ToString(context.db->GetLogManager().GetConfig().level);
722
785
  }
723
- void LoggingLevel::SetGlobal(DatabaseInstance *db, DBConfig &config, const Value &parameter) {
724
- db->GetLogManager().SetLogLevel(EnumUtil::FromString<LogLevel>(parameter.GetValue<string>()));
786
+ void LoggingLevel::SetGlobal(DatabaseInstance *db_p, DBConfig &config, const Value &parameter) {
787
+ auto &db = GetDB<LoggingLevel>(db_p);
788
+ db.GetLogManager().SetLogLevel(EnumUtil::FromString<LogLevel>(parameter.GetValue<string>()));
725
789
  }
726
790
 
727
- void LoggingLevel::ResetGlobal(DatabaseInstance *db, DBConfig &config) {
728
- db->GetLogManager().SetLogLevel(LogConfig::DEFAULT_LOG_LEVEL);
791
+ void LoggingLevel::ResetGlobal(DatabaseInstance *db_p, DBConfig &config) {
792
+ auto &db = GetDB<LoggingLevel>(db_p);
793
+ db.GetLogManager().SetLogLevel(LogConfig::DEFAULT_LOG_LEVEL);
729
794
  }
730
795
 
731
796
  //===----------------------------------------------------------------------===//
@@ -734,12 +799,14 @@ void LoggingLevel::ResetGlobal(DatabaseInstance *db, DBConfig &config) {
734
799
  Value LoggingStorage::GetSetting(const ClientContext &context) {
735
800
  return context.db->GetLogManager().GetConfig().storage;
736
801
  }
737
- void LoggingStorage::SetGlobal(DatabaseInstance *db, DBConfig &config, const Value &parameter) {
738
- db->GetLogManager().SetLogStorage(*db, parameter.GetValue<string>());
802
+ void LoggingStorage::SetGlobal(DatabaseInstance *db_p, DBConfig &config, const Value &parameter) {
803
+ auto &db = GetDB<LoggingStorage>(db_p);
804
+ db.GetLogManager().SetLogStorage(db, parameter.GetValue<string>());
739
805
  }
740
806
 
741
- void LoggingStorage::ResetGlobal(DatabaseInstance *db, DBConfig &config) {
742
- db->GetLogManager().SetLogStorage(*db, LogConfig::DEFAULT_LOG_STORAGE);
807
+ void LoggingStorage::ResetGlobal(DatabaseInstance *db_p, DBConfig &config) {
808
+ auto &db = GetDB<LoggingStorage>(db_p);
809
+ db.GetLogManager().SetLogStorage(db, LogConfig::DEFAULT_LOG_STORAGE);
743
810
  }
744
811
 
745
812
  //===----------------------------------------------------------------------===//
@@ -752,18 +819,21 @@ Value EnabledLogTypes::GetSetting(const ClientContext &context) {
752
819
  }
753
820
  return StringUtil::Join(loggers, ",");
754
821
  }
755
- void EnabledLogTypes::SetGlobal(DatabaseInstance *db, DBConfig &config, const Value &parameter) {
822
+ void EnabledLogTypes::SetGlobal(DatabaseInstance *db_p, DBConfig &config, const Value &parameter) {
823
+ auto &db = GetDB<EnabledLogTypes>(db_p);
824
+
756
825
  auto values = StringUtil::Split(parameter.GetValue<string>(), ",");
757
826
  unordered_set<string> set;
758
827
  for (const auto &value : values) {
759
828
  set.insert(value);
760
829
  }
761
- db->GetLogManager().SetEnabledLogTypes(set);
830
+ db.GetLogManager().SetEnabledLogTypes(set);
762
831
  }
763
832
 
764
- void EnabledLogTypes::ResetGlobal(DatabaseInstance *db, DBConfig &config) {
833
+ void EnabledLogTypes::ResetGlobal(DatabaseInstance *db_p, DBConfig &config) {
834
+ auto &db = GetDB<EnabledLogTypes>(db_p);
765
835
  unordered_set<string> set;
766
- db->GetLogManager().SetEnabledLogTypes(set);
836
+ db.GetLogManager().SetEnabledLogTypes(set);
767
837
  }
768
838
 
769
839
  //===----------------------------------------------------------------------===//
@@ -776,18 +846,20 @@ Value DisabledLogTypes::GetSetting(const ClientContext &context) {
776
846
  }
777
847
  return StringUtil::Join(loggers, ",");
778
848
  }
779
- void DisabledLogTypes::SetGlobal(DatabaseInstance *db, DBConfig &config, const Value &parameter) {
849
+ void DisabledLogTypes::SetGlobal(DatabaseInstance *db_p, DBConfig &config, const Value &parameter) {
850
+ auto &db = GetDB<DisabledLogTypes>(db_p);
780
851
  auto values = StringUtil::Split(parameter.GetValue<string>(), ",");
781
852
  unordered_set<string> set;
782
853
  for (const auto &value : values) {
783
854
  set.insert(value);
784
855
  }
785
- db->GetLogManager().SetDisabledLogTypes(set);
856
+ db.GetLogManager().SetDisabledLogTypes(set);
786
857
  }
787
858
 
788
- void DisabledLogTypes::ResetGlobal(DatabaseInstance *db, DBConfig &config) {
859
+ void DisabledLogTypes::ResetGlobal(DatabaseInstance *db_p, DBConfig &config) {
860
+ auto &db = GetDB<DisabledLogTypes>(db_p);
789
861
  unordered_set<string> set;
790
- db->GetLogManager().SetDisabledLogTypes(set);
862
+ db.GetLogManager().SetDisabledLogTypes(set);
791
863
  }
792
864
 
793
865
  //===----------------------------------------------------------------------===//
@@ -224,7 +224,7 @@ void Optimizer::RunBuiltInOptimizers() {
224
224
 
225
225
  // transform ORDER BY + LIMIT to TopN
226
226
  RunOptimizer(OptimizerType::TOP_N, [&]() {
227
- TopN topn;
227
+ TopN topn(context);
228
228
  plan = topn.Optimize(std::move(plan));
229
229
  });
230
230
 
@@ -14,7 +14,10 @@
14
14
 
15
15
  namespace duckdb {
16
16
 
17
- bool TopN::CanOptimize(LogicalOperator &op) {
17
+ TopN::TopN(ClientContext &context_p) : context(context_p) {
18
+ }
19
+
20
+ bool TopN::CanOptimize(LogicalOperator &op, optional_ptr<ClientContext> context) {
18
21
  if (op.type == LogicalOperatorType::LOGICAL_LIMIT) {
19
22
  auto &limit = op.Cast<LogicalLimit>();
20
23
 
@@ -28,14 +31,21 @@ bool TopN::CanOptimize(LogicalOperator &op) {
28
31
  }
29
32
 
30
33
  auto child_op = op.children[0].get();
34
+ if (context) {
35
+ // estimate child cardinality if the context is available
36
+ child_op->EstimateCardinality(*context);
37
+ }
31
38
 
32
- auto constant_limit = static_cast<double>(limit.limit_val.GetConstantValue());
33
- auto child_card = static_cast<double>(child_op->estimated_cardinality);
39
+ if (child_op->has_estimated_cardinality) {
40
+ // only check if we should switch to full sorting if we have estimated cardinality
41
+ auto constant_limit = static_cast<double>(limit.limit_val.GetConstantValue());
42
+ auto child_card = static_cast<double>(child_op->estimated_cardinality);
34
43
 
35
- // if the child cardinality is not 98 times more than the
36
- bool limit_is_large = constant_limit > 5000;
37
- if (constant_limit > child_card * 0.007 && limit_is_large) {
38
- return false;
44
+ // if the limit is > 0.7% of the child cardinality, sorting the whole table is faster
45
+ bool limit_is_large = constant_limit > 5000;
46
+ if (constant_limit > child_card * 0.007 && limit_is_large) {
47
+ return false;
48
+ }
39
49
  }
40
50
 
41
51
  while (child_op->type == LogicalOperatorType::LOGICAL_PROJECTION) {
@@ -116,7 +126,7 @@ void TopN::PushdownDynamicFilters(LogicalTopN &op) {
116
126
  }
117
127
 
118
128
  unique_ptr<LogicalOperator> TopN::Optimize(unique_ptr<LogicalOperator> op) {
119
- if (CanOptimize(*op)) {
129
+ if (CanOptimize(*op, &context)) {
120
130
 
121
131
  vector<unique_ptr<LogicalOperator>> projections;
122
132
 
@@ -589,6 +589,11 @@ PendingExecutionResult Executor::ExecuteTask(bool dry_run) {
589
589
  if (!HasError()) {
590
590
  // we (partially) processed a task and no exceptions were thrown
591
591
  // give back control to the caller
592
+ if (task && DBConfig::GetConfig(context).options.scheduler_process_partial) {
593
+ auto &token = *task->token;
594
+ TaskScheduler::GetScheduler(context).ScheduleTask(token, task);
595
+ task.reset();
596
+ }
592
597
  return PendingExecutionResult::RESULT_NOT_READY;
593
598
  }
594
599
  execution_result = PendingExecutionResult::EXECUTION_ERROR;
@@ -25,7 +25,7 @@ unique_ptr<CreateInfo> CreateSequenceInfo::Copy() const {
25
25
  }
26
26
 
27
27
  string CreateSequenceInfo::ToString() const {
28
- std::stringstream ss;
28
+ duckdb::stringstream ss;
29
29
  ss << "CREATE";
30
30
  if (on_conflict == OnCreateConflict::REPLACE_ON_CONFLICT) {
31
31
  ss << " OR REPLACE";
@@ -27,9 +27,12 @@ unique_ptr<ParsedExpression> Transformer::TransformInterval(duckdb_libpgquery::P
27
27
  default:
28
28
  throw InternalException("Unsupported interval transformation");
29
29
  }
30
+ SetQueryLocation(*expr, node.location);
30
31
 
31
32
  if (!node.typmods) {
32
- return make_uniq<CastExpression>(LogicalType::INTERVAL, std::move(expr));
33
+ auto result = make_uniq<CastExpression>(LogicalType::INTERVAL, std::move(expr));
34
+ SetQueryLocation(*result, node.location);
35
+ return std::move(result);
33
36
  }
34
37
 
35
38
  int32_t mask = NumericCast<int32_t>(
@@ -137,6 +140,7 @@ unique_ptr<ParsedExpression> Transformer::TransformInterval(duckdb_libpgquery::P
137
140
  }
138
141
  // first push a cast to the parse type
139
142
  expr = make_uniq<CastExpression>(parse_type, std::move(expr));
143
+ SetQueryLocation(*expr, node.location);
140
144
 
141
145
  // next, truncate it if the target type doesn't match the parse type
142
146
  if (target_type != parse_type) {
@@ -199,24 +199,32 @@ BindResult ExpressionBinder::BindLambdaFunction(FunctionExpression &function, Sc
199
199
  }
200
200
 
201
201
  // the first child is the list, the second child is the lambda expression
202
- const idx_t list_idx = 0;
203
- const idx_t lambda_expr_idx = 1;
202
+ constexpr idx_t list_idx = 0;
203
+ constexpr idx_t lambda_expr_idx = 1;
204
204
  D_ASSERT(function.children[lambda_expr_idx]->GetExpressionClass() == ExpressionClass::LAMBDA);
205
205
 
206
+ vector<LogicalType> function_child_types;
207
+
206
208
  // bind the list
207
209
  ErrorData error;
208
210
  for (idx_t i = 0; i < function.children.size(); i++) {
209
- if (i != lambda_expr_idx) {
210
- if (function.children[i]->GetExpressionClass() == ExpressionClass::LAMBDA) {
211
- return BindResult("No function matches the given name and argument types: '" + function.ToString() +
212
- "'. You might need to add explicit type casts.");
213
- }
211
+ if (i == lambda_expr_idx) {
212
+ function_child_types.push_back(LogicalType::LAMBDA);
213
+ continue;
214
+ }
214
215
 
215
- BindChild(function.children[i], depth, error);
216
- if (error.HasError()) {
217
- return BindResult(std::move(error));
218
- }
216
+ if (function.children[i]->GetExpressionClass() == ExpressionClass::LAMBDA) {
217
+ return BindResult("No function matches the given name and argument types: '" + function.ToString() +
218
+ "'. You might need to add explicit type casts.");
219
+ }
220
+
221
+ BindChild(function.children[i], depth, error);
222
+ if (error.HasError()) {
223
+ return BindResult(std::move(error));
219
224
  }
225
+
226
+ const auto &child = BoundExpression::GetExpression(*function.children[i]);
227
+ function_child_types.push_back(child->return_type);
220
228
  }
221
229
 
222
230
  // get the logical type of the children of the list
@@ -227,20 +235,9 @@ BindResult ExpressionBinder::BindLambdaFunction(FunctionExpression &function, Sc
227
235
  return BindResult("Invalid LIST argument during lambda function binding!");
228
236
  }
229
237
 
230
- LogicalType list_child_type = list_child->return_type.id();
231
- if (list_child->return_type.id() != LogicalTypeId::SQLNULL &&
232
- list_child->return_type.id() != LogicalTypeId::UNKNOWN) {
233
-
234
- if (list_child->return_type.id() == LogicalTypeId::ARRAY) {
235
- list_child_type = ArrayType::GetChildType(list_child->return_type);
236
- } else {
237
- list_child_type = ListType::GetChildType(list_child->return_type);
238
- }
239
- }
240
-
241
238
  // bind the lambda parameter
242
239
  auto &lambda_expr = function.children[lambda_expr_idx]->Cast<LambdaExpression>();
243
- BindResult bind_lambda_result = BindExpression(lambda_expr, depth, list_child_type, &bind_lambda_function);
240
+ BindResult bind_lambda_result = BindExpression(lambda_expr, depth, function_child_types, &bind_lambda_function);
244
241
 
245
242
  if (bind_lambda_result.HasError()) {
246
243
  return BindResult(bind_lambda_result.error);
@@ -268,7 +265,7 @@ BindResult ExpressionBinder::BindLambdaFunction(FunctionExpression &function, Sc
268
265
 
269
266
  // capture the (lambda) columns
270
267
  auto &bound_lambda_expr = children[lambda_expr_idx]->Cast<BoundLambdaExpression>();
271
- CaptureLambdaColumns(bound_lambda_expr, bound_lambda_expr.lambda_expr, &bind_lambda_function, list_child_type);
268
+ CaptureLambdaColumns(bound_lambda_expr, bound_lambda_expr.lambda_expr, &bind_lambda_function, function_child_types);
272
269
 
273
270
  FunctionBinder function_binder(binder);
274
271
  unique_ptr<Expression> result =
@@ -62,7 +62,8 @@ void ExtractParameters(LambdaExpression &expr, vector<string> &column_names, vec
62
62
  D_ASSERT(!column_names.empty());
63
63
  }
64
64
 
65
- BindResult ExpressionBinder::BindExpression(LambdaExpression &expr, idx_t depth, const LogicalType &list_child_type,
65
+ BindResult ExpressionBinder::BindExpression(LambdaExpression &expr, idx_t depth,
66
+ const vector<LogicalType> &function_child_types,
66
67
  optional_ptr<bind_lambda_function_t> bind_lambda_function) {
67
68
  if (expr.syntax_type == LambdaSyntaxType::LAMBDA_KEYWORD && !bind_lambda_function) {
68
69
  return BindResult("invalid lambda expression");
@@ -93,7 +94,7 @@ BindResult ExpressionBinder::BindExpression(LambdaExpression &expr, idx_t depth,
93
94
  vector<string> column_aliases;
94
95
  ExtractParameters(expr, column_names, column_aliases);
95
96
  for (idx_t i = 0; i < column_names.size(); i++) {
96
- column_types.push_back((*bind_lambda_function)(i, list_child_type));
97
+ column_types.push_back((*bind_lambda_function)(context, function_child_types, i));
97
98
  }
98
99
 
99
100
  // base table alias
@@ -134,7 +135,7 @@ void ExpressionBinder::TransformCapturedLambdaColumn(unique_ptr<Expression> &ori
134
135
  unique_ptr<Expression> &replacement,
135
136
  BoundLambdaExpression &bound_lambda_expr,
136
137
  const optional_ptr<bind_lambda_function_t> bind_lambda_function,
137
- const LogicalType &list_child_type) {
138
+ const vector<LogicalType> &function_child_types) {
138
139
 
139
140
  // check if the original expression is a lambda parameter
140
141
  if (original->GetExpressionClass() == ExpressionClass::BOUND_LAMBDA_REF) {
@@ -164,9 +165,9 @@ void ExpressionBinder::TransformCapturedLambdaColumn(unique_ptr<Expression> &ori
164
165
  // error resolving the lambda index
165
166
  throw InternalException("Failed to bind lambda parameter internally");
166
167
  }
167
-
168
168
  // refers to a lambda parameter inside the current lambda function
169
- auto logical_type = (*bind_lambda_function)(bound_lambda_ref.binding.column_index, list_child_type);
169
+ auto logical_type =
170
+ (*bind_lambda_function)(context, function_child_types, bound_lambda_ref.binding.column_index);
170
171
  auto index = bound_lambda_expr.parameter_count - bound_lambda_ref.binding.column_index - 1;
171
172
  replacement = make_uniq<BoundReferenceExpression>(alias, logical_type, index);
172
173
  return;
@@ -186,7 +187,7 @@ void ExpressionBinder::TransformCapturedLambdaColumn(unique_ptr<Expression> &ori
186
187
 
187
188
  void ExpressionBinder::CaptureLambdaColumns(BoundLambdaExpression &bound_lambda_expr, unique_ptr<Expression> &expr,
188
189
  const optional_ptr<bind_lambda_function_t> bind_lambda_function,
189
- const LogicalType &list_child_type) {
190
+ const vector<LogicalType> &function_child_types) {
190
191
 
191
192
  if (expr->GetExpressionClass() == ExpressionClass::BOUND_SUBQUERY) {
192
193
  throw BinderException("subqueries in lambda expressions are not supported");
@@ -216,7 +217,8 @@ void ExpressionBinder::CaptureLambdaColumns(BoundLambdaExpression &bound_lambda_
216
217
  auto original = std::move(expr);
217
218
  unique_ptr<Expression> replacement;
218
219
 
219
- TransformCapturedLambdaColumn(original, replacement, bound_lambda_expr, bind_lambda_function, list_child_type);
220
+ TransformCapturedLambdaColumn(original, replacement, bound_lambda_expr, bind_lambda_function,
221
+ function_child_types);
220
222
 
221
223
  // replace the expression
222
224
  expr = std::move(replacement);
@@ -224,7 +226,7 @@ void ExpressionBinder::CaptureLambdaColumns(BoundLambdaExpression &bound_lambda_
224
226
  } else {
225
227
  // recursively enumerate the children of the expression
226
228
  ExpressionIterator::EnumerateChildren(*expr, [&](unique_ptr<Expression> &child) {
227
- CaptureLambdaColumns(bound_lambda_expr, child, bind_lambda_function, list_child_type);
229
+ CaptureLambdaColumns(bound_lambda_expr, child, bind_lambda_function, function_child_types);
228
230
  });
229
231
  }
230
232
 
@@ -77,8 +77,9 @@ LogicalType ExpressionBinder::ResolveOperatorType(OperatorExpression &op, vector
77
77
  case ExpressionType::OPERATOR_COALESCE: {
78
78
  return ResolveCoalesceType(op, children);
79
79
  }
80
- case ExpressionType::OPERATOR_TRY:
81
- return ExpressionBinder::GetExpressionReturnType(*children[0]);
80
+ case ExpressionType::OPERATOR_TRY: {
81
+ return children[0]->return_type;
82
+ }
82
83
  case ExpressionType::OPERATOR_NOT:
83
84
  return ResolveNotType(op, children);
84
85
  default:
@@ -266,10 +266,6 @@ BoundStatement Binder::BindCopyTo(CopyStatement &stmt, CopyToType copy_to_type)
266
266
  }
267
267
  }
268
268
  if (!write_empty_file) {
269
- if (rotate) {
270
- throw NotImplementedException(
271
- "Can't combine WRITE_EMPTY_FILE false with file rotation (e.g., ROW_GROUPS_PER_FILE)");
272
- }
273
269
  if (per_thread_output) {
274
270
  throw NotImplementedException("Can't combine WRITE_EMPTY_FILE false with PER_THREAD_OUTPUT");
275
271
  }
@@ -298,6 +298,9 @@ unique_ptr<BoundTableRef> Binder::Bind(BaseTableRef &ref) {
298
298
 
299
299
  unique_ptr<FunctionData> bind_data;
300
300
  auto scan_function = table.GetScanFunction(context, bind_data, table_lookup);
301
+ if (bind_data && !bind_data->SupportStatementCache()) {
302
+ SetAlwaysRequireRebind();
303
+ }
301
304
  // TODO: bundle the type and name vector in a struct (e.g PackedColumnMetadata)
302
305
  vector<LogicalType> table_types;
303
306
  vector<string> table_names;
@@ -240,6 +240,9 @@ unique_ptr<LogicalOperator> Binder::BindTableFunctionInternal(TableFunction &tab
240
240
  throw InvalidInputException("Cannot call function \"%s\" directly - it has no bind function",
241
241
  table_function.name);
242
242
  }
243
+ if (bind_data && !bind_data->SupportStatementCache()) {
244
+ SetAlwaysRequireRebind();
245
+ }
243
246
  if (return_types.size() != return_names.size()) {
244
247
  throw InternalException("Failed to bind \"%s\": return_types/names must have same size", table_function.name);
245
248
  }
@@ -191,6 +191,9 @@ bool BoundCastExpression::CastIsInvertible(const LogicalType &source_type, const
191
191
  return false;
192
192
  }
193
193
  }
194
+ if (source_type.IsSigned() && target_type.IsUnsigned()) {
195
+ return false;
196
+ }
194
197
  return true;
195
198
  }
196
199
 
@@ -37,7 +37,7 @@ bool BoundColumnRefExpression::Equals(const BaseExpression &other_p) const {
37
37
  string BoundColumnRefExpression::GetName() const {
38
38
  #ifdef DEBUG
39
39
  if (DBConfigOptions::debug_print_bindings) {
40
- return binding.ToString();
40
+ return StringUtil::Format("%s (%s)", binding.ToString(), return_type.ToString());
41
41
  }
42
42
  #endif
43
43
  return Expression::GetName();
@@ -127,7 +127,6 @@ unique_ptr<Expression> BoundFunctionExpression::Deserialize(Deserializer &deseri
127
127
  }
128
128
  // Otherwise, fall thorugh and continue on normally
129
129
  }
130
-
131
130
  auto result = make_uniq<BoundFunctionExpression>(std::move(function_return_type), std::move(entry.first),
132
131
  std::move(children), std::move(entry.second));
133
132
  result->is_operator = is_operator;
@@ -17,7 +17,7 @@ BoundReferenceExpression::BoundReferenceExpression(LogicalType type, storage_t i
17
17
  string BoundReferenceExpression::ToString() const {
18
18
  #ifdef DEBUG
19
19
  if (DBConfigOptions::debug_print_bindings) {
20
- return "#" + to_string(index);
20
+ return StringUtil::Format("#%llu (%s)", index, return_type.ToString());
21
21
  }
22
22
  #endif
23
23
  if (!alias.empty()) {
@@ -88,8 +88,10 @@ BindResult ExpressionBinder::BindExpression(unique_ptr<ParsedExpression> &expr,
88
88
  // binding a function expression requires an extra parameter for macros
89
89
  return BindExpression(function, depth, expr);
90
90
  }
91
- case ExpressionClass::LAMBDA:
92
- return BindExpression(expr_ref.Cast<LambdaExpression>(), depth, LogicalTypeId::INVALID, nullptr);
91
+ case ExpressionClass::LAMBDA: {
92
+ const vector<LogicalType> function_child_types;
93
+ return BindExpression(expr_ref.Cast<LambdaExpression>(), depth, function_child_types, nullptr);
94
+ }
93
95
  case ExpressionClass::OPERATOR:
94
96
  return BindExpression(expr_ref.Cast<OperatorExpression>(), depth);
95
97
  case ExpressionClass::SUBQUERY: