duckdb 0.3.5-dev612.0 → 0.3.5-dev651.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 "a54f365cc"
15
- #define DUCKDB_VERSION "v0.3.5-dev612"
14
+ #define DUCKDB_SOURCE_ID "a25b6e307"
15
+ #define DUCKDB_VERSION "v0.3.5-dev651"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //
@@ -9672,11 +9672,8 @@ public:
9672
9672
  //! Copy a single cell to a target vector
9673
9673
  DUCKDB_API void CopyCell(idx_t column, idx_t index, Vector &target, idx_t target_offset);
9674
9674
 
9675
- DUCKDB_API string ToString() const {
9676
- return chunks.size() == 0 ? "ChunkCollection [ 0 ]"
9677
- : "ChunkCollection [ " + std::to_string(count) + " ]: \n" + chunks[0]->ToString();
9678
- }
9679
- DUCKDB_API void Print();
9675
+ DUCKDB_API string ToString() const;
9676
+ DUCKDB_API void Print() const;
9680
9677
 
9681
9678
  //! Gets a reference to the chunk at the given index
9682
9679
  DUCKDB_API DataChunk &GetChunkForRow(idx_t row_index) {
@@ -9994,8 +9991,6 @@ class ClientContext;
9994
9991
  class MaterializedQueryResult : public QueryResult {
9995
9992
  public:
9996
9993
  friend class ClientContext;
9997
- //! Creates an empty successful query result
9998
- DUCKDB_API explicit MaterializedQueryResult(StatementType statement_type);
9999
9994
  //! Creates a successful query result with the specified names and types
10000
9995
  DUCKDB_API MaterializedQueryResult(StatementType statement_type, StatementProperties properties,
10001
9996
  vector<LogicalType> types, vector<string> names,
@@ -10112,6 +10107,7 @@ enum class PhysicalOperatorType : uint8_t {
10112
10107
  INVALID,
10113
10108
  ORDER_BY,
10114
10109
  LIMIT,
10110
+ STREAMING_LIMIT,
10115
10111
  LIMIT_PERCENT,
10116
10112
  TOP_N,
10117
10113
  WINDOW,
@@ -10186,7 +10182,8 @@ enum class PhysicalOperatorType : uint8_t {
10186
10182
  EXPORT,
10187
10183
  SET,
10188
10184
  LOAD,
10189
- INOUT_FUNCTION
10185
+ INOUT_FUNCTION,
10186
+ RESULT_COLLECTOR
10190
10187
  };
10191
10188
 
10192
10189
  string PhysicalOperatorToString(PhysicalOperatorType type);
@@ -10265,8 +10262,10 @@ enum class SinkFinalizeType : uint8_t { READY, NO_OUTPUT_POSSIBLE };
10265
10262
 
10266
10263
  namespace duckdb {
10267
10264
  class Event;
10265
+ class Executor;
10268
10266
  class PhysicalOperator;
10269
10267
  class Pipeline;
10268
+ class PipelineBuildState;
10270
10269
 
10271
10270
  // LCOV_EXCL_START
10272
10271
  class OperatorState {
@@ -10298,6 +10297,13 @@ class LocalSinkState {
10298
10297
  public:
10299
10298
  virtual ~LocalSinkState() {
10300
10299
  }
10300
+
10301
+ //! The current batch index
10302
+ //! This is only set in case RequiresBatchIndex() is true, and the source has support for it (SupportsBatchIndex())
10303
+ //! Otherwise this is left on INVALID_INDEX
10304
+ //! The batch index is a globally unique, increasing index that should be used to maintain insertion order
10305
+ //! //! in conjunction with parallelism
10306
+ idx_t batch_index = DConstants::INVALID_INDEX;
10301
10307
  };
10302
10308
 
10303
10309
  class GlobalSourceState {
@@ -10315,6 +10321,7 @@ public:
10315
10321
  virtual ~LocalSourceState() {
10316
10322
  }
10317
10323
  };
10324
+
10318
10325
  // LCOV_EXCL_STOP
10319
10326
 
10320
10327
  //! PhysicalOperator is the base class of the physical operators present in the
@@ -10347,6 +10354,7 @@ public:
10347
10354
  }
10348
10355
  virtual string ToString() const;
10349
10356
  void Print() const;
10357
+ virtual vector<PhysicalOperator *> GetChildren() const;
10350
10358
 
10351
10359
  //! Return a vector of the types that will be returned by this operator
10352
10360
  const vector<LogicalType> &GetTypes() const {
@@ -10357,6 +10365,14 @@ public:
10357
10365
  return false;
10358
10366
  }
10359
10367
 
10368
+ virtual void Verify();
10369
+
10370
+ //! Whether or not the operator depends on the order of the input chunks
10371
+ //! If this is set to true, we cannot do things like caching intermediate vectors
10372
+ virtual bool IsOrderDependent() const {
10373
+ return false;
10374
+ }
10375
+
10360
10376
  public:
10361
10377
  // Operator interface
10362
10378
  virtual unique_ptr<OperatorState> GetOperatorState(ClientContext &context) const;
@@ -10379,6 +10395,8 @@ public:
10379
10395
  virtual unique_ptr<GlobalSourceState> GetGlobalSourceState(ClientContext &context) const;
10380
10396
  virtual void GetData(ExecutionContext &context, DataChunk &chunk, GlobalSourceState &gstate,
10381
10397
  LocalSourceState &lstate) const;
10398
+ virtual idx_t GetBatchIndex(ExecutionContext &context, DataChunk &chunk, GlobalSourceState &gstate,
10399
+ LocalSourceState &lstate) const;
10382
10400
 
10383
10401
  virtual bool IsSource() const {
10384
10402
  return false;
@@ -10388,6 +10406,10 @@ public:
10388
10406
  return false;
10389
10407
  }
10390
10408
 
10409
+ virtual bool SupportsBatchIndex() const {
10410
+ return false;
10411
+ }
10412
+
10391
10413
  public:
10392
10414
  // Sink interface
10393
10415
 
@@ -10416,9 +10438,19 @@ public:
10416
10438
  return false;
10417
10439
  }
10418
10440
 
10419
- virtual bool SinkOrderMatters() const {
10441
+ virtual bool RequiresBatchIndex() const {
10420
10442
  return false;
10421
10443
  }
10444
+
10445
+ public:
10446
+ // Pipeline construction
10447
+ virtual vector<const PhysicalOperator *> GetSources() const;
10448
+ bool AllSourcesSupportBatchIndex() const;
10449
+
10450
+ void AddPipeline(Executor &executor, shared_ptr<Pipeline> current, PipelineBuildState &state);
10451
+ virtual void BuildPipelines(Executor &executor, Pipeline &current, PipelineBuildState &state);
10452
+ void BuildChildPipeline(Executor &executor, Pipeline &current, PipelineBuildState &state,
10453
+ PhysicalOperator *pipeline_child);
10422
10454
  };
10423
10455
 
10424
10456
  } // namespace duckdb
@@ -10492,7 +10524,8 @@ typedef OperatorResultType (*table_in_out_function_t)(ClientContext &context, co
10492
10524
  typedef void (*table_function_parallel_t)(ClientContext &context, const FunctionData *bind_data,
10493
10525
  FunctionOperatorData *operator_state, DataChunk &output,
10494
10526
  ParallelState *parallel_state);
10495
-
10527
+ typedef idx_t (*table_function_get_batch_index_t)(ClientContext &context, const FunctionData *bind_data,
10528
+ FunctionOperatorData *operator_state, ParallelState *parallel_state);
10496
10529
  typedef void (*table_function_cleanup_t)(ClientContext &context, const FunctionData *bind_data,
10497
10530
  FunctionOperatorData *operator_state);
10498
10531
  typedef idx_t (*table_function_max_threads_t)(ClientContext &context, const FunctionData *bind_data);
@@ -10588,12 +10621,16 @@ public:
10588
10621
  table_function_parallel_state_next_t parallel_state_next;
10589
10622
  //! (Optional) return how much of the table we have scanned up to this point (% of the data)
10590
10623
  table_function_progress_t table_scan_progress;
10624
+ //! (Optional) returns the current batch index of the current scan operator
10625
+ table_function_get_batch_index_t get_batch_index;
10591
10626
  //! Whether or not the table function supports projection pushdown. If not supported a projection will be added
10592
10627
  //! that filters out unused columns.
10593
10628
  bool projection_pushdown;
10594
10629
  //! Whether or not the table function supports filter pushdown. If not supported a filter will be added
10595
10630
  //! that applies the table filter directly.
10596
10631
  bool filter_pushdown;
10632
+ //! Whether or not the table function supports fetching of a batch index
10633
+ bool supports_batch_index;
10597
10634
  //! Additional function info, passed to the bind
10598
10635
  shared_ptr<TableFunctionInfo> function_info;
10599
10636
  };
@@ -10752,12 +10789,45 @@ namespace duckdb {
10752
10789
  class Executor;
10753
10790
  class Event;
10754
10791
 
10792
+ class PipelineBuildState {
10793
+ public:
10794
+ //! How much to increment batch indexes when multiple pipelines share the same source
10795
+ constexpr static idx_t BATCH_INCREMENT = 10000000000000;
10796
+
10797
+ public:
10798
+ //! The current recursive CTE node (if any)
10799
+ PhysicalOperator *recursive_cte = nullptr;
10800
+
10801
+ //! Duplicate eliminated join scan dependencies
10802
+ unordered_map<PhysicalOperator *, Pipeline *> delim_join_dependencies;
10803
+
10804
+ //! The number of pipelines that have each specific sink as their sink
10805
+ unordered_map<PhysicalOperator *, idx_t> sink_pipeline_count;
10806
+
10807
+ public:
10808
+ void SetPipelineSource(Pipeline &pipeline, PhysicalOperator *op);
10809
+ void SetPipelineSink(Pipeline &pipeline, PhysicalOperator *op);
10810
+ void SetPipelineOperators(Pipeline &pipeline, vector<PhysicalOperator *> operators);
10811
+ void AddPipelineOperator(Pipeline &pipeline, PhysicalOperator *op);
10812
+ void AddPipeline(Executor &executor, shared_ptr<Pipeline> pipeline);
10813
+ void AddChildPipeline(Executor &executor, Pipeline &pipeline);
10814
+
10815
+ unordered_map<Pipeline *, vector<shared_ptr<Pipeline>>> &GetUnionPipelines(Executor &executor);
10816
+ unordered_map<Pipeline *, vector<shared_ptr<Pipeline>>> &GetChildPipelines(Executor &executor);
10817
+ unordered_map<Pipeline *, vector<Pipeline *>> &GetChildDependencies(Executor &executor);
10818
+
10819
+ PhysicalOperator *GetPipelineSource(Pipeline &pipeline);
10820
+ PhysicalOperator *GetPipelineSink(Pipeline &pipeline);
10821
+ vector<PhysicalOperator *> GetPipelineOperators(Pipeline &pipeline);
10822
+ };
10823
+
10755
10824
  //! The Pipeline class represents an execution pipeline
10756
10825
  class Pipeline : public std::enable_shared_from_this<Pipeline> {
10757
10826
  friend class Executor;
10758
10827
  friend class PipelineExecutor;
10759
10828
  friend class PipelineEvent;
10760
10829
  friend class PipelineFinishEvent;
10830
+ friend class PipelineBuildState;
10761
10831
 
10762
10832
  public:
10763
10833
  explicit Pipeline(Executor &execution_context);
@@ -10790,6 +10860,9 @@ public:
10790
10860
  return sink;
10791
10861
  }
10792
10862
 
10863
+ //! Returns whether any of the operators in the pipeline care about preserving insertion order
10864
+ bool IsOrderDependent() const;
10865
+
10793
10866
  private:
10794
10867
  //! Whether or not the pipeline has been readied
10795
10868
  bool ready;
@@ -10808,6 +10881,9 @@ private:
10808
10881
  //! The dependencies of this pipeline
10809
10882
  vector<weak_ptr<Pipeline>> dependencies;
10810
10883
 
10884
+ //! The base batch index of this pipeline
10885
+ idx_t base_batch_index = 0;
10886
+
10811
10887
  private:
10812
10888
  bool GetProgressInternal(ClientContext &context, PhysicalOperator *op, double &current_percentage);
10813
10889
  void ScheduleSequentialTask(shared_ptr<Event> &event);
@@ -10856,6 +10932,7 @@ using event_map_t = unordered_map<const Pipeline *, PipelineEventStack>;
10856
10932
  class Executor {
10857
10933
  friend class Pipeline;
10858
10934
  friend class PipelineTask;
10935
+ friend class PipelineBuildState;
10859
10936
 
10860
10937
  public:
10861
10938
  explicit Executor(ClientContext &context);
@@ -10867,7 +10944,7 @@ public:
10867
10944
  static Executor &Get(ClientContext &context);
10868
10945
 
10869
10946
  void Initialize(PhysicalOperator *physical_plan);
10870
- void BuildPipelines(PhysicalOperator *op, Pipeline *current);
10947
+ void Initialize(unique_ptr<PhysicalOperator> physical_plan);
10871
10948
 
10872
10949
  void CancelTasks();
10873
10950
  PendingExecutionResult ExecuteTask();
@@ -10905,7 +10982,14 @@ public:
10905
10982
 
10906
10983
  void ReschedulePipelines(const vector<shared_ptr<Pipeline>> &pipelines, vector<shared_ptr<Event>> &events);
10907
10984
 
10985
+ //! Whether or not the root of the pipeline is a result collector object
10986
+ bool HasResultCollector();
10987
+ //! Returns the query result - can only be used if `HasResultCollector` returns true
10988
+ unique_ptr<QueryResult> GetResult();
10989
+
10908
10990
  private:
10991
+ void InitializeInternal(PhysicalOperator *physical_plan);
10992
+
10909
10993
  void ScheduleEvents();
10910
10994
  void ScheduleEventsInternal(const vector<shared_ptr<Pipeline>> &pipelines,
10911
10995
  unordered_map<Pipeline *, vector<shared_ptr<Pipeline>>> &child_pipelines,
@@ -10928,6 +11012,7 @@ private:
10928
11012
 
10929
11013
  private:
10930
11014
  PhysicalOperator *physical_plan;
11015
+ unique_ptr<PhysicalOperator> owned_plan;
10931
11016
 
10932
11017
  mutex executor_lock;
10933
11018
  //! The pipelines of the current query
@@ -10963,12 +11048,6 @@ private:
10963
11048
  //! Dependencies of child pipelines
10964
11049
  unordered_map<Pipeline *, vector<Pipeline *>> child_dependencies;
10965
11050
 
10966
- //! Duplicate eliminated join scan dependencies
10967
- unordered_map<PhysicalOperator *, Pipeline *> delim_join_dependencies;
10968
-
10969
- //! Active recursive CTE node (if any)
10970
- PhysicalOperator *recursive_cte;
10971
-
10972
11051
  //! The last pending execution result (if any)
10973
11052
  PendingExecutionResult execution_result;
10974
11053
  //! The current task in process (if any)
@@ -10987,7 +11066,7 @@ class PendingQueryResult : public BaseQueryResult {
10987
11066
 
10988
11067
  public:
10989
11068
  DUCKDB_API PendingQueryResult(shared_ptr<ClientContext> context, PreparedStatementData &statement,
10990
- vector<LogicalType> types);
11069
+ vector<LogicalType> types, bool allow_stream_result);
10991
11070
  DUCKDB_API explicit PendingQueryResult(string error_message);
10992
11071
  DUCKDB_API ~PendingQueryResult();
10993
11072
 
@@ -11001,18 +11080,19 @@ public:
11001
11080
 
11002
11081
  //! Returns the result of the query as an actual query result.
11003
11082
  //! This returns (mostly) instantly if ExecuteTask has been called until RESULT_READY was returned.
11004
- DUCKDB_API unique_ptr<QueryResult> Execute(bool allow_streaming_result = false);
11083
+ DUCKDB_API unique_ptr<QueryResult> Execute();
11005
11084
 
11006
11085
  DUCKDB_API void Close();
11007
11086
 
11008
11087
  private:
11009
11088
  shared_ptr<ClientContext> context;
11089
+ bool allow_stream_result;
11010
11090
 
11011
11091
  private:
11012
11092
  void CheckExecutableInternal(ClientContextLock &lock);
11013
11093
 
11014
11094
  PendingExecutionResult ExecuteTaskInternal(ClientContextLock &lock);
11015
- unique_ptr<QueryResult> ExecuteInternal(ClientContextLock &lock, bool allow_streaming_result = false);
11095
+ unique_ptr<QueryResult> ExecuteInternal(ClientContextLock &lock);
11016
11096
  unique_ptr<ClientContextLock> LockContext();
11017
11097
  };
11018
11098
 
@@ -11088,7 +11168,7 @@ public:
11088
11168
  }
11089
11169
 
11090
11170
  //! Create a pending query result of the prepared statement with the given set of arguments
11091
- DUCKDB_API unique_ptr<PendingQueryResult> PendingQuery(vector<Value> &values);
11171
+ DUCKDB_API unique_ptr<PendingQueryResult> PendingQuery(vector<Value> &values, bool allow_stream_result = true);
11092
11172
 
11093
11173
  //! Execute the prepared statement with the given set of values
11094
11174
  DUCKDB_API unique_ptr<QueryResult> Execute(vector<Value> &values, bool allow_stream_result = true);
@@ -17293,6 +17373,11 @@ enum class ExplainOutputType : uint8_t { ALL = 0, OPTIMIZED_ONLY = 1, PHYSICAL_O
17293
17373
 
17294
17374
  namespace duckdb {
17295
17375
  class ClientContext;
17376
+ class PhysicalResultCollector;
17377
+ class PreparedStatementData;
17378
+
17379
+ typedef std::function<unique_ptr<PhysicalResultCollector>(ClientContext &context, PreparedStatementData &data)>
17380
+ get_result_collector_t;
17296
17381
 
17297
17382
  struct ClientConfig {
17298
17383
  //! If the query profiler is enabled or not.
@@ -17340,6 +17425,10 @@ struct ClientConfig {
17340
17425
  //! Generic options
17341
17426
  case_insensitive_map_t<Value> set_variables;
17342
17427
 
17428
+ //! Function that is used to create the result collector for a materialized result
17429
+ //! Defaults to PhysicalMaterializedCollector
17430
+ get_result_collector_t result_collector = nullptr;
17431
+
17343
17432
  public:
17344
17433
  static ClientConfig &GetConfig(ClientContext &context);
17345
17434
 
@@ -17389,6 +17478,13 @@ struct ActiveQueryContext;
17389
17478
  struct ParserOptions;
17390
17479
  struct ClientData;
17391
17480
 
17481
+ struct PendingQueryParameters {
17482
+ //! Prepared statement parameters (if any)
17483
+ vector<Value> *parameters = nullptr;
17484
+ //! Whether or not a stream result should be allowed
17485
+ bool allow_stream_result = false;
17486
+ };
17487
+
17392
17488
  //! The ClientContext holds information relevant to the current client session
17393
17489
  //! during execution
17394
17490
  class ClientContext : public std::enable_shared_from_this<ClientContext> {
@@ -17434,9 +17530,10 @@ public:
17434
17530
 
17435
17531
  //! Issues a query to the database and returns a Pending Query Result. Note that "query" may only contain
17436
17532
  //! a single statement.
17437
- DUCKDB_API unique_ptr<PendingQueryResult> PendingQuery(const string &query);
17533
+ DUCKDB_API unique_ptr<PendingQueryResult> PendingQuery(const string &query, bool allow_stream_result);
17438
17534
  //! Issues a query to the database and returns a Pending Query Result
17439
- DUCKDB_API unique_ptr<PendingQueryResult> PendingQuery(unique_ptr<SQLStatement> statement);
17535
+ DUCKDB_API unique_ptr<PendingQueryResult> PendingQuery(unique_ptr<SQLStatement> statement,
17536
+ bool allow_stream_result);
17440
17537
 
17441
17538
  //! Destroy the client context
17442
17539
  DUCKDB_API void Destroy();
@@ -17461,13 +17558,15 @@ public:
17461
17558
  //! It is possible that the prepared statement will be re-bound. This will generally happen if the catalog is
17462
17559
  //! modified in between the prepared statement being bound and the prepared statement being run.
17463
17560
  DUCKDB_API unique_ptr<PendingQueryResult>
17464
- PendingQuery(const string &query, shared_ptr<PreparedStatementData> &prepared, vector<Value> &values);
17561
+ PendingQuery(const string &query, shared_ptr<PreparedStatementData> &prepared, PendingQueryParameters parameters);
17465
17562
 
17466
17563
  //! Execute a prepared statement with the given name and set of parameters
17467
17564
  //! It is possible that the prepared statement will be re-bound. This will generally happen if the catalog is
17468
17565
  //! modified in between the prepared statement being bound and the prepared statement being run.
17469
17566
  DUCKDB_API unique_ptr<QueryResult> Execute(const string &query, shared_ptr<PreparedStatementData> &prepared,
17470
17567
  vector<Value> &values, bool allow_stream_result = true);
17568
+ DUCKDB_API unique_ptr<QueryResult> Execute(const string &query, shared_ptr<PreparedStatementData> &prepared,
17569
+ PendingQueryParameters parameters);
17471
17570
 
17472
17571
  //! Gets current percentage of the query's progress, returns 0 in case the progress bar is disabled.
17473
17572
  DUCKDB_API double GetProgress();
@@ -17516,9 +17615,8 @@ private:
17516
17615
  string &error);
17517
17616
  //! Issues a query to the database and returns a Pending Query Result
17518
17617
  unique_ptr<PendingQueryResult> PendingQueryInternal(ClientContextLock &lock, unique_ptr<SQLStatement> statement,
17519
- bool verify = true);
17520
- unique_ptr<QueryResult> ExecutePendingQueryInternal(ClientContextLock &lock, PendingQueryResult &query,
17521
- bool allow_stream_result);
17618
+ PendingQueryParameters parameters, bool verify = true);
17619
+ unique_ptr<QueryResult> ExecutePendingQueryInternal(ClientContextLock &lock, PendingQueryResult &query);
17522
17620
 
17523
17621
  //! Parse statements from a query
17524
17622
  vector<unique_ptr<SQLStatement>> ParseStatementsInternal(ClientContextLock &lock, const string &query);
@@ -17530,29 +17628,28 @@ private:
17530
17628
  //! Internal clean up, does not lock. Caller must hold the context_lock.
17531
17629
  void CleanupInternal(ClientContextLock &lock, BaseQueryResult *result = nullptr,
17532
17630
  bool invalidate_transaction = false);
17533
- string FinalizeQuery(ClientContextLock &lock, bool success);
17534
17631
  unique_ptr<PendingQueryResult> PendingStatementOrPreparedStatement(ClientContextLock &lock, const string &query,
17535
17632
  unique_ptr<SQLStatement> statement,
17536
17633
  shared_ptr<PreparedStatementData> &prepared,
17537
- vector<Value> *values);
17634
+ PendingQueryParameters parameters);
17538
17635
  unique_ptr<PendingQueryResult> PendingPreparedStatement(ClientContextLock &lock,
17539
17636
  shared_ptr<PreparedStatementData> statement_p,
17540
- vector<Value> bound_values);
17637
+ PendingQueryParameters parameters);
17541
17638
 
17542
17639
  //! Internally prepare a SQL statement. Caller must hold the context_lock.
17543
17640
  shared_ptr<PreparedStatementData> CreatePreparedStatement(ClientContextLock &lock, const string &query,
17544
17641
  unique_ptr<SQLStatement> statement,
17545
17642
  vector<Value> *values = nullptr);
17546
17643
  unique_ptr<PendingQueryResult> PendingStatementInternal(ClientContextLock &lock, const string &query,
17547
- unique_ptr<SQLStatement> statement);
17644
+ unique_ptr<SQLStatement> statement,
17645
+ PendingQueryParameters parameters);
17548
17646
  unique_ptr<QueryResult> RunStatementInternal(ClientContextLock &lock, const string &query,
17549
17647
  unique_ptr<SQLStatement> statement, bool allow_stream_result,
17550
17648
  bool verify = true);
17551
17649
  unique_ptr<PreparedStatement> PrepareInternal(ClientContextLock &lock, unique_ptr<SQLStatement> statement);
17552
17650
  void LogQueryInternal(ClientContextLock &lock, const string &query);
17553
17651
 
17554
- unique_ptr<QueryResult> FetchResultInternal(ClientContextLock &lock, PendingQueryResult &pending,
17555
- bool allow_stream_result);
17652
+ unique_ptr<QueryResult> FetchResultInternal(ClientContextLock &lock, PendingQueryResult &pending);
17556
17653
  unique_ptr<DataChunk> FetchInternal(ClientContextLock &lock, Executor &executor, BaseQueryResult &result);
17557
17654
 
17558
17655
  unique_ptr<ClientContextLock> LockContext();
@@ -17565,14 +17662,13 @@ private:
17565
17662
 
17566
17663
  PendingExecutionResult ExecuteTaskInternal(ClientContextLock &lock, PendingQueryResult &result);
17567
17664
 
17568
- unique_ptr<PendingQueryResult>
17569
- PendingStatementOrPreparedStatementInternal(ClientContextLock &lock, const string &query,
17570
- unique_ptr<SQLStatement> statement,
17571
- shared_ptr<PreparedStatementData> &prepared, vector<Value> *values);
17665
+ unique_ptr<PendingQueryResult> PendingStatementOrPreparedStatementInternal(
17666
+ ClientContextLock &lock, const string &query, unique_ptr<SQLStatement> statement,
17667
+ shared_ptr<PreparedStatementData> &prepared, PendingQueryParameters parameters);
17572
17668
 
17573
17669
  unique_ptr<PendingQueryResult> PendingQueryPreparedInternal(ClientContextLock &lock, const string &query,
17574
17670
  shared_ptr<PreparedStatementData> &prepared,
17575
- vector<Value> &values);
17671
+ PendingQueryParameters parameters);
17576
17672
 
17577
17673
  private:
17578
17674
  //! Lock on using the ClientContext in parallel
@@ -17816,9 +17912,10 @@ public:
17816
17912
 
17817
17913
  //! Issues a query to the database and returns a Pending Query Result. Note that "query" may only contain
17818
17914
  //! a single statement.
17819
- DUCKDB_API unique_ptr<PendingQueryResult> PendingQuery(const string &query);
17915
+ DUCKDB_API unique_ptr<PendingQueryResult> PendingQuery(const string &query, bool allow_stream_result = false);
17820
17916
  //! Issues a query to the database and returns a Pending Query Result
17821
- DUCKDB_API unique_ptr<PendingQueryResult> PendingQuery(unique_ptr<SQLStatement> statement);
17917
+ DUCKDB_API unique_ptr<PendingQueryResult> PendingQuery(unique_ptr<SQLStatement> statement,
17918
+ bool allow_stream_result = false);
17822
17919
 
17823
17920
  //! Prepare the specified query, returning a prepared statement object
17824
17921
  DUCKDB_API unique_ptr<PreparedStatement> Prepare(const string &query);
@@ -18314,6 +18411,8 @@ public:
18314
18411
  bool debug_many_free_list_blocks = false;
18315
18412
  //! Debug setting for window aggregation mode: (window, combine, separate)
18316
18413
  WindowAggregationMode window_mode = WindowAggregationMode::WINDOW;
18414
+ //! Whether or not preserving insertion order should be preserved
18415
+ bool preserve_insertion_order = true;
18317
18416
 
18318
18417
  //! Extra parameters that can be SET for loaded extensions
18319
18418
  case_insensitive_map_t<ExtensionOption> extension_parameters;
@@ -20101,7 +20200,8 @@ namespace duckdb {
20101
20200
  class CatalogEntry;
20102
20201
 
20103
20202
  struct BoundCreateTableInfo {
20104
- explicit BoundCreateTableInfo(unique_ptr<CreateInfo> base) : base(move(base)) {
20203
+ explicit BoundCreateTableInfo(unique_ptr<CreateInfo> base_p) : base(move(base_p)) {
20204
+ D_ASSERT(base);
20105
20205
  }
20106
20206
 
20107
20207
  //! The schema to create the table in
@@ -20124,6 +20224,7 @@ struct BoundCreateTableInfo {
20124
20224
  unique_ptr<LogicalOperator> query;
20125
20225
 
20126
20226
  CreateTableInfo &Base() {
20227
+ D_ASSERT(base);
20127
20228
  return (CreateTableInfo &)*base;
20128
20229
  }
20129
20230
  };