duckdb 0.3.2-dev739.0 → 0.3.2-dev782.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.3.2-dev739.0",
4
+ "version": "0.3.2-dev782.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -27591,8 +27591,6 @@ public:
27591
27591
  private:
27592
27592
  unique_ptr<TreeNode> CreateTree(PhysicalOperator *root, idx_t depth = 0);
27593
27593
  void Render(const TreeNode &node, std::ostream &str) const;
27594
- //! The lock used for flushing information from a thread into the global query profiler
27595
- mutex flush_lock;
27596
27594
 
27597
27595
  public:
27598
27596
  DUCKDB_API bool IsEnabled() const;
@@ -27633,6 +27631,8 @@ private:
27633
27631
 
27634
27632
  //! Whether or not the query profiler is running
27635
27633
  bool running;
27634
+ //! The lock used for flushing information from a thread into the global query profiler
27635
+ mutex flush_lock;
27636
27636
 
27637
27637
  //! Whether or not the query requires profiling
27638
27638
  bool query_requires_profiling;
@@ -27645,7 +27645,7 @@ private:
27645
27645
  Profiler main_query;
27646
27646
  //! A map of a Physical Operator pointer to a tree node
27647
27647
  TreeMap tree_map;
27648
-
27648
+ //! Whether or not we are running as part of a explain_analyze query
27649
27649
  bool is_explain_analyze;
27650
27650
 
27651
27651
  public:
@@ -27675,12 +27675,12 @@ private:
27675
27675
  class QueryProfilerHistory {
27676
27676
  private:
27677
27677
  //! Previous Query profilers
27678
- deque<pair<transaction_t, unique_ptr<QueryProfiler>>> prev_profilers;
27678
+ deque<pair<transaction_t, shared_ptr<QueryProfiler>>> prev_profilers;
27679
27679
  //! Previous Query profilers size
27680
27680
  uint64_t prev_profilers_size = 20;
27681
27681
 
27682
27682
  public:
27683
- deque<pair<transaction_t, unique_ptr<QueryProfiler>>> &GetPrevProfilers() {
27683
+ deque<pair<transaction_t, shared_ptr<QueryProfiler>>> &GetPrevProfilers() {
27684
27684
  return prev_profilers;
27685
27685
  }
27686
27686
  QueryProfilerHistory() {
@@ -33840,13 +33840,14 @@ void ValidityMask::Slice(const ValidityMask &other, idx_t offset) {
33840
33840
  Initialize(other);
33841
33841
  return;
33842
33842
  }
33843
- Initialize(STANDARD_VECTOR_SIZE);
33843
+ ValidityMask new_mask(STANDARD_VECTOR_SIZE);
33844
33844
 
33845
33845
  // FIXME THIS NEEDS FIXING!
33846
33846
  #if 1
33847
33847
  for (idx_t i = offset; i < STANDARD_VECTOR_SIZE; i++) {
33848
- Set(i - offset, other.RowIsValid(i));
33848
+ new_mask.Set(i - offset, other.RowIsValid(i));
33849
33849
  }
33850
+ Initialize(new_mask);
33850
33851
  #else
33851
33852
  // first shift the "whole" units
33852
33853
  idx_t entire_units = offset / BITS_PER_VALUE;
@@ -33854,7 +33855,7 @@ void ValidityMask::Slice(const ValidityMask &other, idx_t offset) {
33854
33855
  if (entire_units > 0) {
33855
33856
  idx_t validity_idx;
33856
33857
  for (validity_idx = 0; validity_idx + entire_units < STANDARD_ENTRY_COUNT; validity_idx++) {
33857
- validity_mask[validity_idx] = other.validity_mask[validity_idx + entire_units];
33858
+ new_mask.validity_mask[validity_idx] = other.validity_mask[validity_idx + entire_units];
33858
33859
  }
33859
33860
  }
33860
33861
  // now we shift the remaining sub units
@@ -33869,15 +33870,17 @@ void ValidityMask::Slice(const ValidityMask &other, idx_t offset) {
33869
33870
  if (sub_units > 0) {
33870
33871
  idx_t validity_idx;
33871
33872
  for (validity_idx = 0; validity_idx + 1 < STANDARD_ENTRY_COUNT; validity_idx++) {
33872
- validity_mask[validity_idx] = (other.validity_mask[validity_idx] >> sub_units) |
33873
- (other.validity_mask[validity_idx + 1] << (BITS_PER_VALUE - sub_units));
33873
+ new_mask.validity_mask[validity_idx] =
33874
+ (other.validity_mask[validity_idx] >> sub_units) |
33875
+ (other.validity_mask[validity_idx + 1] << (BITS_PER_VALUE - sub_units));
33874
33876
  }
33875
- validity_mask[validity_idx] >>= sub_units;
33877
+ new_mask.validity_mask[validity_idx] >>= sub_units;
33876
33878
  }
33877
33879
  #ifdef DEBUG
33878
33880
  for (idx_t i = offset; i < STANDARD_VECTOR_SIZE; i++) {
33879
- D_ASSERT(RowIsValid(i - offset) == other.RowIsValid(i));
33881
+ D_ASSERT(new_mask.RowIsValid(i - offset) == other.RowIsValid(i));
33880
33882
  }
33883
+ Initialize(new_mask);
33881
33884
  #endif
33882
33885
  #endif
33883
33886
  }
@@ -97524,7 +97527,7 @@ struct ActiveQueryContext {
97524
97527
  };
97525
97528
 
97526
97529
  ClientContext::ClientContext(shared_ptr<DatabaseInstance> database)
97527
- : profiler(make_unique<QueryProfiler>(*this)), query_profiler_history(make_unique<QueryProfilerHistory>()),
97530
+ : profiler(make_shared<QueryProfiler>(*this)), query_profiler_history(make_unique<QueryProfilerHistory>()),
97528
97531
  db(move(database)), transaction(db->GetTransactionManager(), *this), interrupted(false),
97529
97532
  temporary_objects(make_unique<SchemaCatalogEntry>(&db->GetCatalog(), TEMP_SCHEMA, true)),
97530
97533
  catalog_search_path(make_unique<CatalogSearchPath>(*this)),
@@ -97619,7 +97622,7 @@ string ClientContext::EndQueryInternal(ClientContextLock &lock, bool success, bo
97619
97622
  auto &prev_profilers = query_profiler_history->GetPrevProfilers();
97620
97623
  prev_profilers.emplace_back(transaction.ActiveTransaction().active_query, move(profiler));
97621
97624
  // Reinitialize the query profiler
97622
- profiler = make_unique<QueryProfiler>(*this);
97625
+ profiler = make_shared<QueryProfiler>(*this);
97623
97626
  // Propagate settings of the saved query into the new profiler.
97624
97627
  profiler->Propagate(*prev_profilers.back().second);
97625
97628
  if (prev_profilers.size() >= query_profiler_history->GetPrevProfilersSize()) {
@@ -107895,6 +107898,7 @@ void QueryProfiler::StartExplainAnalyze() {
107895
107898
  }
107896
107899
 
107897
107900
  void QueryProfiler::EndQuery() {
107901
+ lock_guard<mutex> guard(flush_lock);
107898
107902
  if (!IsEnabled() || !running) {
107899
107903
  return;
107900
107904
  }
@@ -108053,10 +108057,10 @@ void OperatorProfiler::Flush(const PhysicalOperator *phys_op, ExpressionExecutor
108053
108057
  }
108054
108058
 
108055
108059
  void QueryProfiler::Flush(OperatorProfiler &profiler) {
108060
+ lock_guard<mutex> guard(flush_lock);
108056
108061
  if (!IsEnabled() || !running) {
108057
108062
  return;
108058
108063
  }
108059
- lock_guard<mutex> guard(flush_lock);
108060
108064
  for (auto &node : profiler.timings) {
108061
108065
  auto entry = tree_map.find(node.first);
108062
108066
  D_ASSERT(entry != tree_map.end());
@@ -120731,8 +120735,8 @@ void Executor::Initialize(PhysicalOperator *plan) {
120731
120735
  lock_guard<mutex> elock(executor_lock);
120732
120736
  physical_plan = plan;
120733
120737
 
120734
- auto &profiler = QueryProfiler::Get(context);
120735
- profiler.Initialize(physical_plan);
120738
+ this->profiler = context.profiler;
120739
+ profiler->Initialize(physical_plan);
120736
120740
  this->producer = scheduler.CreateProducer();
120737
120741
 
120738
120742
  auto root_pipeline = make_shared<Pipeline>(*this);
@@ -121143,9 +121147,7 @@ void Executor::ThrowExceptionInternal() { // LCOV_EXCL_START
121143
121147
  } // LCOV_EXCL_STOP
121144
121148
 
121145
121149
  void Executor::Flush(ThreadContext &tcontext) {
121146
- lock_guard<mutex> elock(executor_lock);
121147
- auto &profiler = QueryProfiler::Get(context);
121148
- profiler.Flush(tcontext.profiler);
121150
+ profiler->Flush(tcontext.profiler);
121149
121151
  }
121150
121152
 
121151
121153
  bool Executor::GetPipelinesProgress(double &current_progress) { // LCOV_EXCL_START
@@ -153713,6 +153715,7 @@ void __fastpack64(const uint64_t *__restrict in, uint32_t *__restrict out);
153713
153715
  // LICENSE_CHANGE_END
153714
153716
 
153715
153717
 
153718
+
153716
153719
  #include <stdexcept>
153717
153720
 
153718
153721
  namespace duckdb_fastpforlib {
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 "2bb221361"
15
- #define DUCKDB_VERSION "0.3.2-dev739"
14
+ #define DUCKDB_SOURCE_ID "7473f3eb0"
15
+ #define DUCKDB_VERSION "0.3.2-dev782"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //
@@ -9869,6 +9869,7 @@ class DataChunk;
9869
9869
  class PhysicalOperator;
9870
9870
  class PipelineExecutor;
9871
9871
  class OperatorState;
9872
+ class QueryProfiler;
9872
9873
  class ThreadContext;
9873
9874
  class Task;
9874
9875
 
@@ -9968,6 +9969,8 @@ private:
9968
9969
  vector<pair<ExceptionType, string>> exceptions;
9969
9970
  //! List of events
9970
9971
  vector<shared_ptr<Event>> events;
9972
+ //! The query profiler
9973
+ shared_ptr<QueryProfiler> profiler;
9971
9974
 
9972
9975
  //! The amount of completed pipelines of the query
9973
9976
  atomic<idx_t> completed_pipelines;
@@ -17117,7 +17120,7 @@ public:
17117
17120
  DUCKDB_API ~ClientContext();
17118
17121
 
17119
17122
  //! Query profiler
17120
- unique_ptr<QueryProfiler> profiler;
17123
+ shared_ptr<QueryProfiler> profiler;
17121
17124
  //! QueryProfiler History
17122
17125
  unique_ptr<QueryProfilerHistory> query_profiler_history;
17123
17126
  //! The database that this client is connected to