duckdb 0.3.5-dev230.0 → 0.3.5-dev252.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.
package/src/duckdb.hpp CHANGED
@@ -11,8 +11,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
11
11
  #pragma once
12
12
  #define DUCKDB_AMALGAMATION 1
13
13
  #define DUCKDB_AMALGAMATION_EXTENDED 1
14
- #define DUCKDB_SOURCE_ID "991d06596"
15
- #define DUCKDB_VERSION "v0.3.5-dev230"
14
+ #define DUCKDB_SOURCE_ID "2c1e52086"
15
+ #define DUCKDB_VERSION "v0.3.5-dev252"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //
@@ -10323,9 +10323,12 @@ public:
10323
10323
 
10324
10324
 
10325
10325
 
10326
+
10327
+
10326
10328
  #include <functional>
10327
10329
 
10328
10330
  namespace duckdb {
10331
+
10329
10332
  class BaseStatistics;
10330
10333
  class LogicalGet;
10331
10334
  struct ParallelState;
@@ -10368,10 +10371,14 @@ typedef unique_ptr<FunctionOperatorData> (*table_function_init_t)(ClientContext
10368
10371
  typedef unique_ptr<BaseStatistics> (*table_statistics_t)(ClientContext &context, const FunctionData *bind_data,
10369
10372
  column_t column_index);
10370
10373
  typedef void (*table_function_t)(ClientContext &context, const FunctionData *bind_data,
10371
- FunctionOperatorData *operator_state, DataChunk *input, DataChunk &output);
10374
+ FunctionOperatorData *operator_state, DataChunk &output);
10375
+
10376
+ typedef OperatorResultType (*table_in_out_function_t)(ClientContext &context, const FunctionData *bind_data,
10377
+ FunctionOperatorData *operator_state, DataChunk &input,
10378
+ DataChunk &output);
10372
10379
 
10373
10380
  typedef void (*table_function_parallel_t)(ClientContext &context, const FunctionData *bind_data,
10374
- FunctionOperatorData *operator_state, DataChunk *input, DataChunk &output,
10381
+ FunctionOperatorData *operator_state, DataChunk &output,
10375
10382
  ParallelState *parallel_state);
10376
10383
 
10377
10384
  typedef void (*table_function_cleanup_t)(ClientContext &context, const FunctionData *bind_data,
@@ -10410,7 +10417,8 @@ public:
10410
10417
  table_function_parallel_t parallel_function = nullptr,
10411
10418
  table_function_init_parallel_t parallel_init = nullptr,
10412
10419
  table_function_parallel_state_next_t parallel_state_next = nullptr, bool projection_pushdown = false,
10413
- bool filter_pushdown = false, table_function_progress_t query_progress = nullptr);
10420
+ bool filter_pushdown = false, table_function_progress_t query_progress = nullptr,
10421
+ table_in_out_function_t in_out_function = nullptr);
10414
10422
  DUCKDB_API
10415
10423
  TableFunction(const vector<LogicalType> &arguments, table_function_t function, table_function_bind_t bind = nullptr,
10416
10424
  table_function_init_t init = nullptr, table_statistics_t statistics = nullptr,
@@ -10422,7 +10430,8 @@ public:
10422
10430
  table_function_parallel_t parallel_function = nullptr,
10423
10431
  table_function_init_parallel_t parallel_init = nullptr,
10424
10432
  table_function_parallel_state_next_t parallel_state_next = nullptr, bool projection_pushdown = false,
10425
- bool filter_pushdown = false, table_function_progress_t query_progress = nullptr);
10433
+ bool filter_pushdown = false, table_function_progress_t query_progress = nullptr,
10434
+ table_in_out_function_t in_out_function = nullptr);
10426
10435
  DUCKDB_API TableFunction();
10427
10436
 
10428
10437
  //! Bind function
@@ -10435,6 +10444,8 @@ public:
10435
10444
  table_function_init_t init;
10436
10445
  //! The main function
10437
10446
  table_function_t function;
10447
+ //! The table in-out function (if this is an in-out function)
10448
+ table_in_out_function_t in_out_function;
10438
10449
  //! (Optional) statistics function
10439
10450
  //! Returns the statistics of a specified column
10440
10451
  table_statistics_t statistics;
@@ -10582,11 +10593,11 @@ struct ProducerToken {
10582
10593
 
10583
10594
  //! The TaskScheduler is responsible for managing tasks and threads
10584
10595
  class TaskScheduler {
10585
- // timeout for semaphore wait, default 50ms
10586
- constexpr static int64_t TASK_TIMEOUT_USECS = 50000;
10596
+ // timeout for semaphore wait, default 5ms
10597
+ constexpr static int64_t TASK_TIMEOUT_USECS = 5000;
10587
10598
 
10588
10599
  public:
10589
- TaskScheduler();
10600
+ TaskScheduler(DatabaseInstance &db);
10590
10601
  ~TaskScheduler();
10591
10602
 
10592
10603
  static TaskScheduler &GetScheduler(ClientContext &context);
@@ -10599,6 +10610,8 @@ public:
10599
10610
  bool GetTaskFromProducer(ProducerToken &token, unique_ptr<Task> &task);
10600
10611
  //! Run tasks forever until "marker" is set to false, "marker" must remain valid until the thread is joined
10601
10612
  void ExecuteForever(atomic<bool> *marker);
10613
+ //! Run tasks until `max_tasks` have been completed, or until there are no more tasks available
10614
+ void ExecuteTasks(idx_t max_tasks);
10602
10615
 
10603
10616
  //! Sets the amount of active threads executing tasks for the system; n-1 background threads will be launched.
10604
10617
  //! The main thread will also be used for execution
@@ -10609,6 +10622,8 @@ public:
10609
10622
  private:
10610
10623
  void SetThreadsInternal(int32_t n);
10611
10624
 
10625
+ private:
10626
+ DatabaseInstance &db;
10612
10627
  //! The task queue
10613
10628
  unique_ptr<ConcurrentQueue> queue;
10614
10629
  //! The active background threads of the task scheduler
@@ -13610,9 +13625,12 @@ private:
13610
13625
  unique_ptr<BoundTableRef> Bind(EmptyTableRef &ref);
13611
13626
  unique_ptr<BoundTableRef> Bind(ExpressionListRef &ref);
13612
13627
 
13613
- bool BindFunctionParameters(vector<unique_ptr<ParsedExpression>> &expressions, vector<LogicalType> &arguments,
13614
- vector<Value> &parameters, named_parameter_map_t &named_parameters,
13615
- unique_ptr<BoundSubqueryRef> &subquery, string &error);
13628
+ bool BindTableFunctionParameters(TableFunctionCatalogEntry &table_function,
13629
+ vector<unique_ptr<ParsedExpression>> &expressions, vector<LogicalType> &arguments,
13630
+ vector<Value> &parameters, named_parameter_map_t &named_parameters,
13631
+ unique_ptr<BoundSubqueryRef> &subquery, string &error);
13632
+ bool BindTableInTableOutFunction(vector<unique_ptr<ParsedExpression>> &expressions,
13633
+ unique_ptr<BoundSubqueryRef> &subquery, string &error);
13616
13634
 
13617
13635
  unique_ptr<LogicalOperator> CreatePlan(BoundBaseTableRef &ref);
13618
13636
  unique_ptr<LogicalOperator> CreatePlan(BoundCrossProductRef &ref);
@@ -16879,6 +16897,19 @@ Closes the result and de-allocates all memory allocated for the arrow result.
16879
16897
  */
16880
16898
  DUCKDB_API void duckdb_destroy_arrow(duckdb_arrow *result);
16881
16899
 
16900
+ //===--------------------------------------------------------------------===//
16901
+ // Threading Information
16902
+ //===--------------------------------------------------------------------===//
16903
+ /*!
16904
+ Execute DuckDB tasks on this thread.
16905
+
16906
+ Will return after `max_tasks` have been executed, or if there are no more tasks present.
16907
+
16908
+ * database: The database object to execute tasks for
16909
+ * max_tasks: The maximum amount of tasks to execute
16910
+ */
16911
+ DUCKDB_API void duckdb_execute_tasks(duckdb_database database, idx_t max_tasks);
16912
+
16882
16913
  #ifdef __cplusplus
16883
16914
  }
16884
16915
  #endif
@@ -18127,6 +18158,8 @@ public:
18127
18158
  idx_t maximum_memory = (idx_t)-1;
18128
18159
  //! The maximum amount of CPU threads used by the database system. Default: all available.
18129
18160
  idx_t maximum_threads = (idx_t)-1;
18161
+ //! The number of external threads that work on DuckDB tasks. Default: none.
18162
+ idx_t external_threads = 0;
18130
18163
  //! Whether or not to create and use a temporary directory to store intermediates that do not fit in memory
18131
18164
  bool use_temporary_directory = true;
18132
18165
  //! Directory to store temporary structures that do not fit in memory