duckdb 0.3.2-dev735.0 → 0.3.2-dev780.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 +1 -1
- package/src/duckdb.cpp +91 -40
- package/src/duckdb.hpp +6 -3
- package/src/parquet-amalgamation.cpp +35720 -35009
- package/src/parquet-amalgamation.hpp +118 -0
package/package.json
CHANGED
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,
|
|
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,
|
|
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
|
-
|
|
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] =
|
|
33873
|
-
|
|
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
|
}
|
|
@@ -63950,10 +63953,7 @@ namespace duckdb {
|
|
|
63950
63953
|
//! LogicalLimit represents a LIMIT clause
|
|
63951
63954
|
class LogicalLimit : public LogicalOperator {
|
|
63952
63955
|
public:
|
|
63953
|
-
LogicalLimit(int64_t limit_val, int64_t offset_val, unique_ptr<Expression> limit, unique_ptr<Expression> offset)
|
|
63954
|
-
: LogicalOperator(LogicalOperatorType::LOGICAL_LIMIT), limit_val(limit_val), offset_val(offset_val),
|
|
63955
|
-
limit(move(limit)), offset(move(offset)) {
|
|
63956
|
-
}
|
|
63956
|
+
LogicalLimit(int64_t limit_val, int64_t offset_val, unique_ptr<Expression> limit, unique_ptr<Expression> offset);
|
|
63957
63957
|
|
|
63958
63958
|
//! Limit and offset values in case they are constants, used in optimizations.
|
|
63959
63959
|
int64_t limit_val;
|
|
@@ -63964,14 +63964,12 @@ public:
|
|
|
63964
63964
|
unique_ptr<Expression> offset;
|
|
63965
63965
|
|
|
63966
63966
|
public:
|
|
63967
|
-
vector<ColumnBinding> GetColumnBindings() override
|
|
63968
|
-
|
|
63969
|
-
|
|
63967
|
+
vector<ColumnBinding> GetColumnBindings() override;
|
|
63968
|
+
|
|
63969
|
+
idx_t EstimateCardinality(ClientContext &context) override;
|
|
63970
63970
|
|
|
63971
63971
|
protected:
|
|
63972
|
-
void ResolveTypes() override
|
|
63973
|
-
types = children[0]->types;
|
|
63974
|
-
}
|
|
63972
|
+
void ResolveTypes() override;
|
|
63975
63973
|
};
|
|
63976
63974
|
} // namespace duckdb
|
|
63977
63975
|
|
|
@@ -64394,23 +64392,18 @@ namespace duckdb {
|
|
|
64394
64392
|
//! LogicalSample represents a SAMPLE clause
|
|
64395
64393
|
class LogicalSample : public LogicalOperator {
|
|
64396
64394
|
public:
|
|
64397
|
-
LogicalSample(unique_ptr<SampleOptions> sample_options_p, unique_ptr<LogicalOperator> child)
|
|
64398
|
-
: LogicalOperator(LogicalOperatorType::LOGICAL_SAMPLE), sample_options(move(sample_options_p)) {
|
|
64399
|
-
children.push_back(move(child));
|
|
64400
|
-
}
|
|
64395
|
+
LogicalSample(unique_ptr<SampleOptions> sample_options_p, unique_ptr<LogicalOperator> child);
|
|
64401
64396
|
|
|
64402
64397
|
//! The sample options
|
|
64403
64398
|
unique_ptr<SampleOptions> sample_options;
|
|
64404
64399
|
|
|
64405
64400
|
public:
|
|
64406
|
-
vector<ColumnBinding> GetColumnBindings() override
|
|
64407
|
-
|
|
64408
|
-
|
|
64401
|
+
vector<ColumnBinding> GetColumnBindings() override;
|
|
64402
|
+
|
|
64403
|
+
idx_t EstimateCardinality(ClientContext &context) override;
|
|
64409
64404
|
|
|
64410
64405
|
protected:
|
|
64411
|
-
void ResolveTypes() override
|
|
64412
|
-
types = children[0]->types;
|
|
64413
|
-
}
|
|
64406
|
+
void ResolveTypes() override;
|
|
64414
64407
|
};
|
|
64415
64408
|
|
|
64416
64409
|
} // namespace duckdb
|
|
@@ -97534,7 +97527,7 @@ struct ActiveQueryContext {
|
|
|
97534
97527
|
};
|
|
97535
97528
|
|
|
97536
97529
|
ClientContext::ClientContext(shared_ptr<DatabaseInstance> database)
|
|
97537
|
-
: profiler(
|
|
97530
|
+
: profiler(make_shared<QueryProfiler>(*this)), query_profiler_history(make_unique<QueryProfilerHistory>()),
|
|
97538
97531
|
db(move(database)), transaction(db->GetTransactionManager(), *this), interrupted(false),
|
|
97539
97532
|
temporary_objects(make_unique<SchemaCatalogEntry>(&db->GetCatalog(), TEMP_SCHEMA, true)),
|
|
97540
97533
|
catalog_search_path(make_unique<CatalogSearchPath>(*this)),
|
|
@@ -97629,7 +97622,7 @@ string ClientContext::EndQueryInternal(ClientContextLock &lock, bool success, bo
|
|
|
97629
97622
|
auto &prev_profilers = query_profiler_history->GetPrevProfilers();
|
|
97630
97623
|
prev_profilers.emplace_back(transaction.ActiveTransaction().active_query, move(profiler));
|
|
97631
97624
|
// Reinitialize the query profiler
|
|
97632
|
-
profiler =
|
|
97625
|
+
profiler = make_shared<QueryProfiler>(*this);
|
|
97633
97626
|
// Propagate settings of the saved query into the new profiler.
|
|
97634
97627
|
profiler->Propagate(*prev_profilers.back().second);
|
|
97635
97628
|
if (prev_profilers.size() >= query_profiler_history->GetPrevProfilersSize()) {
|
|
@@ -107905,6 +107898,7 @@ void QueryProfiler::StartExplainAnalyze() {
|
|
|
107905
107898
|
}
|
|
107906
107899
|
|
|
107907
107900
|
void QueryProfiler::EndQuery() {
|
|
107901
|
+
lock_guard<mutex> guard(flush_lock);
|
|
107908
107902
|
if (!IsEnabled() || !running) {
|
|
107909
107903
|
return;
|
|
107910
107904
|
}
|
|
@@ -108063,10 +108057,10 @@ void OperatorProfiler::Flush(const PhysicalOperator *phys_op, ExpressionExecutor
|
|
|
108063
108057
|
}
|
|
108064
108058
|
|
|
108065
108059
|
void QueryProfiler::Flush(OperatorProfiler &profiler) {
|
|
108060
|
+
lock_guard<mutex> guard(flush_lock);
|
|
108066
108061
|
if (!IsEnabled() || !running) {
|
|
108067
108062
|
return;
|
|
108068
108063
|
}
|
|
108069
|
-
lock_guard<mutex> guard(flush_lock);
|
|
108070
108064
|
for (auto &node : profiler.timings) {
|
|
108071
108065
|
auto entry = tree_map.find(node.first);
|
|
108072
108066
|
D_ASSERT(entry != tree_map.end());
|
|
@@ -120741,8 +120735,8 @@ void Executor::Initialize(PhysicalOperator *plan) {
|
|
|
120741
120735
|
lock_guard<mutex> elock(executor_lock);
|
|
120742
120736
|
physical_plan = plan;
|
|
120743
120737
|
|
|
120744
|
-
|
|
120745
|
-
profiler
|
|
120738
|
+
this->profiler = context.profiler;
|
|
120739
|
+
profiler->Initialize(physical_plan);
|
|
120746
120740
|
this->producer = scheduler.CreateProducer();
|
|
120747
120741
|
|
|
120748
120742
|
auto root_pipeline = make_shared<Pipeline>(*this);
|
|
@@ -121153,9 +121147,7 @@ void Executor::ThrowExceptionInternal() { // LCOV_EXCL_START
|
|
|
121153
121147
|
} // LCOV_EXCL_STOP
|
|
121154
121148
|
|
|
121155
121149
|
void Executor::Flush(ThreadContext &tcontext) {
|
|
121156
|
-
|
|
121157
|
-
auto &profiler = QueryProfiler::Get(context);
|
|
121158
|
-
profiler.Flush(tcontext.profiler);
|
|
121150
|
+
profiler->Flush(tcontext.profiler);
|
|
121159
121151
|
}
|
|
121160
121152
|
|
|
121161
121153
|
bool Executor::GetPipelinesProgress(double ¤t_progress) { // LCOV_EXCL_START
|
|
@@ -150796,6 +150788,33 @@ void LogicalJoin::GetExpressionBindings(Expression &expr, unordered_set<idx_t> &
|
|
|
150796
150788
|
} // namespace duckdb
|
|
150797
150789
|
|
|
150798
150790
|
|
|
150791
|
+
namespace duckdb {
|
|
150792
|
+
|
|
150793
|
+
LogicalLimit::LogicalLimit(int64_t limit_val, int64_t offset_val, unique_ptr<Expression> limit,
|
|
150794
|
+
unique_ptr<Expression> offset)
|
|
150795
|
+
: LogicalOperator(LogicalOperatorType::LOGICAL_LIMIT), limit_val(limit_val), offset_val(offset_val),
|
|
150796
|
+
limit(move(limit)), offset(move(offset)) {
|
|
150797
|
+
}
|
|
150798
|
+
|
|
150799
|
+
vector<ColumnBinding> LogicalLimit::GetColumnBindings() {
|
|
150800
|
+
return children[0]->GetColumnBindings();
|
|
150801
|
+
}
|
|
150802
|
+
|
|
150803
|
+
idx_t LogicalLimit::EstimateCardinality(ClientContext &context) {
|
|
150804
|
+
auto child_cardinality = children[0]->EstimateCardinality(context);
|
|
150805
|
+
if (limit_val >= 0 && idx_t(limit_val) < child_cardinality) {
|
|
150806
|
+
child_cardinality = limit_val;
|
|
150807
|
+
}
|
|
150808
|
+
return child_cardinality;
|
|
150809
|
+
}
|
|
150810
|
+
|
|
150811
|
+
void LogicalLimit::ResolveTypes() {
|
|
150812
|
+
types = children[0]->types;
|
|
150813
|
+
}
|
|
150814
|
+
|
|
150815
|
+
} // namespace duckdb
|
|
150816
|
+
|
|
150817
|
+
|
|
150799
150818
|
namespace duckdb {
|
|
150800
150819
|
|
|
150801
150820
|
LogicalProjection::LogicalProjection(idx_t table_index, vector<unique_ptr<Expression>> select_list)
|
|
@@ -150815,6 +150834,37 @@ void LogicalProjection::ResolveTypes() {
|
|
|
150815
150834
|
} // namespace duckdb
|
|
150816
150835
|
|
|
150817
150836
|
|
|
150837
|
+
namespace duckdb {
|
|
150838
|
+
|
|
150839
|
+
LogicalSample::LogicalSample(unique_ptr<SampleOptions> sample_options_p, unique_ptr<LogicalOperator> child)
|
|
150840
|
+
: LogicalOperator(LogicalOperatorType::LOGICAL_SAMPLE), sample_options(move(sample_options_p)) {
|
|
150841
|
+
children.push_back(move(child));
|
|
150842
|
+
}
|
|
150843
|
+
|
|
150844
|
+
vector<ColumnBinding> LogicalSample::GetColumnBindings() {
|
|
150845
|
+
return children[0]->GetColumnBindings();
|
|
150846
|
+
}
|
|
150847
|
+
|
|
150848
|
+
idx_t LogicalSample::EstimateCardinality(ClientContext &context) {
|
|
150849
|
+
auto child_cardinality = children[0]->EstimateCardinality(context);
|
|
150850
|
+
if (sample_options->is_percentage) {
|
|
150851
|
+
return idx_t(child_cardinality * sample_options->sample_size.GetValue<double>());
|
|
150852
|
+
} else {
|
|
150853
|
+
auto sample_size = sample_options->sample_size.GetValue<uint64_t>();
|
|
150854
|
+
if (sample_size < child_cardinality) {
|
|
150855
|
+
return sample_size;
|
|
150856
|
+
}
|
|
150857
|
+
}
|
|
150858
|
+
return child_cardinality;
|
|
150859
|
+
}
|
|
150860
|
+
|
|
150861
|
+
void LogicalSample::ResolveTypes() {
|
|
150862
|
+
types = children[0]->types;
|
|
150863
|
+
}
|
|
150864
|
+
|
|
150865
|
+
} // namespace duckdb
|
|
150866
|
+
|
|
150867
|
+
|
|
150818
150868
|
namespace duckdb {
|
|
150819
150869
|
|
|
150820
150870
|
vector<ColumnBinding> LogicalUnnest::GetColumnBindings() {
|
|
@@ -153665,6 +153715,7 @@ void __fastpack64(const uint64_t *__restrict in, uint32_t *__restrict out);
|
|
|
153665
153715
|
// LICENSE_CHANGE_END
|
|
153666
153716
|
|
|
153667
153717
|
|
|
153718
|
+
|
|
153668
153719
|
#include <stdexcept>
|
|
153669
153720
|
|
|
153670
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 "
|
|
15
|
-
#define DUCKDB_VERSION "0.3.2-
|
|
14
|
+
#define DUCKDB_SOURCE_ID "3e55c44bd"
|
|
15
|
+
#define DUCKDB_VERSION "0.3.2-dev780"
|
|
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
|
-
|
|
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
|