duckdb 0.5.1-dev219.0 → 0.5.1-dev225.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "duckdb",
3
3
  "main": "./lib/duckdb.js",
4
- "version": "0.5.1-dev219.0",
4
+ "version": "0.5.1-dev225.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -80446,11 +80446,10 @@ unique_ptr<GlobalSinkState> PhysicalCreateTableAs::GetGlobalSinkState(ClientCont
80446
80446
  SinkResultType PhysicalCreateTableAs::Sink(ExecutionContext &context, GlobalSinkState &state, LocalSinkState &lstate_p,
80447
80447
  DataChunk &input) const {
80448
80448
  auto &sink = (CreateTableAsGlobalState &)state;
80449
- if (sink.table) {
80450
- lock_guard<mutex> client_guard(sink.append_lock);
80451
- sink.table->storage->Append(*sink.table, context.client, input);
80452
- sink.inserted_count += input.size();
80453
- }
80449
+ D_ASSERT(sink.table);
80450
+ lock_guard<mutex> client_guard(sink.append_lock);
80451
+ sink.table->storage->Append(*sink.table, context.client, input);
80452
+ sink.inserted_count += input.size();
80454
80453
  return SinkResultType::NEED_MORE_INPUT;
80455
80454
  }
80456
80455
 
@@ -115227,8 +115226,8 @@ struct ArrowScanLocalState : public LocalTableFunctionState {
115227
115226
  struct ArrowScanGlobalState : public GlobalTableFunctionState {
115228
115227
  unique_ptr<ArrowArrayStreamWrapper> stream;
115229
115228
  mutex main_mutex;
115230
- bool ready = false;
115231
115229
  idx_t max_threads = 1;
115230
+ bool done = false;
115232
115231
 
115233
115232
  idx_t MaxThreads() const override {
115234
115233
  return max_threads;
@@ -115516,6 +115515,9 @@ idx_t ArrowTableFunction::ArrowScanMaxThreads(ClientContext &context, const Func
115516
115515
  bool ArrowScanParallelStateNext(ClientContext &context, const FunctionData *bind_data_p, ArrowScanLocalState &state,
115517
115516
  ArrowScanGlobalState &parallel_state) {
115518
115517
  lock_guard<mutex> parallel_lock(parallel_state.main_mutex);
115518
+ if (parallel_state.done) {
115519
+ return false;
115520
+ }
115519
115521
  state.chunk_offset = 0;
115520
115522
 
115521
115523
  auto current_chunk = parallel_state.stream->GetNextChunk();
@@ -115525,6 +115527,7 @@ bool ArrowScanParallelStateNext(ClientContext &context, const FunctionData *bind
115525
115527
  state.chunk = move(current_chunk);
115526
115528
  //! have we run out of chunks? we are done
115527
115529
  if (!state.chunk->arrow_array.release) {
115530
+ parallel_state.done = true;
115528
115531
  return false;
115529
115532
  }
115530
115533
  return true;
@@ -153457,10 +153460,10 @@ PendingExecutionResult Executor::ExecuteTask() {
153457
153460
  lock_guard<mutex> elock(executor_lock);
153458
153461
  pipelines.clear();
153459
153462
  NextExecutor();
153460
- if (!exceptions.empty()) { // LCOV_EXCL_START
153463
+ if (HasError()) { // LCOV_EXCL_START
153461
153464
  // an exception has occurred executing one of the pipelines
153462
153465
  execution_result = PendingExecutionResult::EXECUTION_ERROR;
153463
- ThrowExceptionInternal();
153466
+ ThrowException();
153464
153467
  } // LCOV_EXCL_STOP
153465
153468
  execution_result = PendingExecutionResult::RESULT_READY;
153466
153469
  return execution_result;
@@ -153506,7 +153509,7 @@ vector<LogicalType> Executor::GetTypes() {
153506
153509
  }
153507
153510
 
153508
153511
  void Executor::PushError(PreservedError exception) {
153509
- lock_guard<mutex> elock(executor_lock);
153512
+ lock_guard<mutex> elock(error_lock);
153510
153513
  // interrupt execution of any other pipelines that belong to this executor
153511
153514
  context.interrupted = true;
153512
153515
  // push the exception onto the stack
@@ -153514,20 +153517,16 @@ void Executor::PushError(PreservedError exception) {
153514
153517
  }
153515
153518
 
153516
153519
  bool Executor::HasError() {
153517
- lock_guard<mutex> elock(executor_lock);
153520
+ lock_guard<mutex> elock(error_lock);
153518
153521
  return !exceptions.empty();
153519
153522
  }
153520
153523
 
153521
153524
  void Executor::ThrowException() {
153522
- lock_guard<mutex> elock(executor_lock);
153523
- ThrowExceptionInternal();
153524
- }
153525
-
153526
- void Executor::ThrowExceptionInternal() { // LCOV_EXCL_START
153525
+ lock_guard<mutex> elock(error_lock);
153527
153526
  D_ASSERT(!exceptions.empty());
153528
153527
  auto &entry = exceptions[0];
153529
153528
  entry.Throw();
153530
- } // LCOV_EXCL_STOP
153529
+ }
153531
153530
 
153532
153531
  void Executor::Flush(ThreadContext &tcontext) {
153533
153532
  profiler->Flush(tcontext.profiler);
@@ -153792,6 +153791,9 @@ void Pipeline::Ready() {
153792
153791
  }
153793
153792
 
153794
153793
  void Pipeline::Finalize(Event &event) {
153794
+ if (executor.HasError()) {
153795
+ return;
153796
+ }
153795
153797
  D_ASSERT(ready);
153796
153798
  try {
153797
153799
  auto sink_state = sink->Finalize(*this, event, executor.context, *sink->sink_state);
@@ -153902,6 +153904,7 @@ void PipelineCompleteEvent::FinalizeFinish() {
153902
153904
  } // namespace duckdb
153903
153905
 
153904
153906
 
153907
+
153905
153908
  namespace duckdb {
153906
153909
 
153907
153910
  PipelineEvent::PipelineEvent(shared_ptr<Pipeline> pipeline_p) : BasePipelineEvent(move(pipeline_p)) {
@@ -153909,8 +153912,17 @@ PipelineEvent::PipelineEvent(shared_ptr<Pipeline> pipeline_p) : BasePipelineEven
153909
153912
 
153910
153913
  void PipelineEvent::Schedule() {
153911
153914
  auto event = shared_from_this();
153912
- pipeline->Schedule(event);
153913
- D_ASSERT(total_tasks > 0);
153915
+ auto &executor = pipeline->executor;
153916
+ try {
153917
+ pipeline->Schedule(event);
153918
+ D_ASSERT(total_tasks > 0);
153919
+ } catch (Exception &ex) {
153920
+ executor.PushError(PreservedError(ex));
153921
+ } catch (std::exception &ex) {
153922
+ executor.PushError(PreservedError(ex));
153923
+ } catch (...) { // LCOV_EXCL_START
153924
+ executor.PushError(PreservedError("Unknown exception in Finalize!"));
153925
+ } // LCOV_EXCL_STOP
153914
153926
  }
153915
153927
 
153916
153928
  void PipelineEvent::FinishEvent() {
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 "f0bc4c1db"
15
- #define DUCKDB_VERSION "v0.5.1-dev219"
14
+ #define DUCKDB_SOURCE_ID "1f2e0822a"
15
+ #define DUCKDB_VERSION "v0.5.1-dev225"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //
@@ -12959,6 +12959,7 @@ public:
12959
12959
 
12960
12960
  //! Push a new error
12961
12961
  void PushError(PreservedError exception);
12962
+
12962
12963
  //! True if an error has been thrown
12963
12964
  bool HasError();
12964
12965
  //! Throw the exception that was pushed using PushError.
@@ -13006,13 +13007,13 @@ private:
13006
13007
 
13007
13008
  void VerifyPipeline(Pipeline &pipeline);
13008
13009
  void VerifyPipelines();
13009
- void ThrowExceptionInternal();
13010
13010
 
13011
13011
  private:
13012
13012
  PhysicalOperator *physical_plan;
13013
13013
  unique_ptr<PhysicalOperator> owned_plan;
13014
13014
 
13015
13015
  mutex executor_lock;
13016
+ mutex error_lock;
13016
13017
  //! The pipelines of the current query
13017
13018
  vector<shared_ptr<Pipeline>> pipelines;
13018
13019
  //! The root pipeline of the query