duckdb 0.4.1-dev247.0 → 0.4.1-dev261.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 +38 -25
- package/src/duckdb.hpp +9 -5
- package/src/parquet-amalgamation.cpp +37073 -37063
package/package.json
CHANGED
package/src/duckdb.cpp
CHANGED
|
@@ -36961,10 +36961,14 @@ public:
|
|
|
36961
36961
|
|
|
36962
36962
|
DUCKDB_API void Initialize(PhysicalOperator *root);
|
|
36963
36963
|
|
|
36964
|
-
DUCKDB_API string
|
|
36965
|
-
DUCKDB_API void
|
|
36964
|
+
DUCKDB_API string QueryTreeToString(bool print_optimizer_output = false) const;
|
|
36965
|
+
DUCKDB_API void QueryTreeToStream(std::ostream &str, bool print_optimizer_output = false) const;
|
|
36966
36966
|
DUCKDB_API void Print();
|
|
36967
36967
|
|
|
36968
|
+
//! return the printed as a string. Unlike ToString, which is always formatted as a string,
|
|
36969
|
+
//! the return value is formatted based on the current print format (see GetPrintFormat()).
|
|
36970
|
+
DUCKDB_API string ToString() const;
|
|
36971
|
+
|
|
36968
36972
|
DUCKDB_API string ToJSON() const;
|
|
36969
36973
|
DUCKDB_API void WriteToFile(const char *path, string &info) const;
|
|
36970
36974
|
|
|
@@ -88769,8 +88773,8 @@ namespace duckdb {
|
|
|
88769
88773
|
|
|
88770
88774
|
static void PragmaEnableProfilingStatement(ClientContext &context, const FunctionParameters ¶meters) {
|
|
88771
88775
|
auto &config = ClientConfig::GetConfig(context);
|
|
88772
|
-
config.profiler_print_format = ProfilerPrintFormat::QUERY_TREE;
|
|
88773
88776
|
config.enable_profiler = true;
|
|
88777
|
+
config.emit_profiler_output = true;
|
|
88774
88778
|
}
|
|
88775
88779
|
|
|
88776
88780
|
void RegisterEnableProfiling(BuiltinFunctions &set) {
|
|
@@ -88784,7 +88788,6 @@ void RegisterEnableProfiling(BuiltinFunctions &set) {
|
|
|
88784
88788
|
static void PragmaDisableProfiling(ClientContext &context, const FunctionParameters ¶meters) {
|
|
88785
88789
|
auto &config = ClientConfig::GetConfig(context);
|
|
88786
88790
|
config.enable_profiler = false;
|
|
88787
|
-
config.profiler_print_format = ProfilerPrintFormat::NONE;
|
|
88788
88791
|
}
|
|
88789
88792
|
|
|
88790
88793
|
static void PragmaEnableProgressBar(ClientContext &context, const FunctionParameters ¶meters) {
|
|
@@ -116630,6 +116633,7 @@ void ClientContext::EnableProfiling() {
|
|
|
116630
116633
|
auto lock = LockContext();
|
|
116631
116634
|
auto &config = ClientConfig::GetConfig(*this);
|
|
116632
116635
|
config.enable_profiler = true;
|
|
116636
|
+
config.emit_profiler_output = true;
|
|
116633
116637
|
}
|
|
116634
116638
|
|
|
116635
116639
|
void ClientContext::DisableProfiling() {
|
|
@@ -117852,6 +117856,7 @@ Connection::Connection(DatabaseInstance &database) : context(make_shared<ClientC
|
|
|
117852
117856
|
ConnectionManager::Get(database).AddConnection(*context);
|
|
117853
117857
|
#ifdef DEBUG
|
|
117854
117858
|
EnableProfiling();
|
|
117859
|
+
context->config.emit_profiler_output = false;
|
|
117855
117860
|
#endif
|
|
117856
117861
|
}
|
|
117857
117862
|
|
|
@@ -117867,7 +117872,7 @@ string Connection::GetProfilingInformation(ProfilerPrintFormat format) {
|
|
|
117867
117872
|
if (format == ProfilerPrintFormat::JSON) {
|
|
117868
117873
|
return profiler.ToJSON();
|
|
117869
117874
|
} else {
|
|
117870
|
-
return profiler.
|
|
117875
|
+
return profiler.QueryTreeToString();
|
|
117871
117876
|
}
|
|
117872
117877
|
}
|
|
117873
117878
|
|
|
@@ -127330,7 +127335,7 @@ bool QueryProfiler::IsDetailedEnabled() const {
|
|
|
127330
127335
|
}
|
|
127331
127336
|
|
|
127332
127337
|
ProfilerPrintFormat QueryProfiler::GetPrintFormat() const {
|
|
127333
|
-
return
|
|
127338
|
+
return ClientConfig::GetConfig(context).profiler_print_format;
|
|
127334
127339
|
}
|
|
127335
127340
|
|
|
127336
127341
|
string QueryProfiler::GetSaveLocation() const {
|
|
@@ -127418,20 +127423,14 @@ void QueryProfiler::EndQuery() {
|
|
|
127418
127423
|
Finalize(*root);
|
|
127419
127424
|
}
|
|
127420
127425
|
this->running = false;
|
|
127421
|
-
|
|
127422
|
-
//
|
|
127423
|
-
if (
|
|
127424
|
-
|
|
127425
|
-
string query_info;
|
|
127426
|
-
if (automatic_print_format == ProfilerPrintFormat::JSON) {
|
|
127427
|
-
query_info = ToJSON();
|
|
127428
|
-
} else if (automatic_print_format == ProfilerPrintFormat::QUERY_TREE) {
|
|
127429
|
-
query_info = ToString();
|
|
127430
|
-
} else if (automatic_print_format == ProfilerPrintFormat::QUERY_TREE_OPTIMIZER) {
|
|
127431
|
-
query_info = ToString(true);
|
|
127432
|
-
}
|
|
127426
|
+
// print or output the query profiling after termination
|
|
127427
|
+
// EXPLAIN ANALYSE should not be outputted by the profiler
|
|
127428
|
+
if (IsEnabled() && !is_explain_analyze) {
|
|
127429
|
+
string query_info = ToString();
|
|
127433
127430
|
auto save_location = GetSaveLocation();
|
|
127434
|
-
if (
|
|
127431
|
+
if (!ClientConfig::GetConfig(context).emit_profiler_output) {
|
|
127432
|
+
// disable output
|
|
127433
|
+
} else if (save_location.empty()) {
|
|
127435
127434
|
Printer::Print(query_info);
|
|
127436
127435
|
Printer::Print("\n");
|
|
127437
127436
|
} else {
|
|
@@ -127440,6 +127439,19 @@ void QueryProfiler::EndQuery() {
|
|
|
127440
127439
|
}
|
|
127441
127440
|
this->is_explain_analyze = false;
|
|
127442
127441
|
}
|
|
127442
|
+
string QueryProfiler::ToString() const {
|
|
127443
|
+
const auto format = GetPrintFormat();
|
|
127444
|
+
switch (format) {
|
|
127445
|
+
case ProfilerPrintFormat::QUERY_TREE:
|
|
127446
|
+
return QueryTreeToString();
|
|
127447
|
+
case ProfilerPrintFormat::JSON:
|
|
127448
|
+
return ToJSON();
|
|
127449
|
+
case ProfilerPrintFormat::QUERY_TREE_OPTIMIZER:
|
|
127450
|
+
return QueryTreeToString(true);
|
|
127451
|
+
default:
|
|
127452
|
+
throw InternalException("Unknown ProfilerPrintFormat \"%s\"", format);
|
|
127453
|
+
}
|
|
127454
|
+
}
|
|
127443
127455
|
|
|
127444
127456
|
void QueryProfiler::StartPhase(string new_phase) {
|
|
127445
127457
|
if (!IsEnabled() || !running) {
|
|
@@ -127631,13 +127643,13 @@ static string RenderTiming(double timing) {
|
|
|
127631
127643
|
return timing_s + "s";
|
|
127632
127644
|
}
|
|
127633
127645
|
|
|
127634
|
-
string QueryProfiler::
|
|
127646
|
+
string QueryProfiler::QueryTreeToString(bool print_optimizer_output) const {
|
|
127635
127647
|
std::stringstream str;
|
|
127636
|
-
|
|
127648
|
+
QueryTreeToStream(str, print_optimizer_output);
|
|
127637
127649
|
return str.str();
|
|
127638
127650
|
}
|
|
127639
127651
|
|
|
127640
|
-
void QueryProfiler::
|
|
127652
|
+
void QueryProfiler::QueryTreeToStream(std::ostream &ss, bool print_optimizer_output) const {
|
|
127641
127653
|
if (!IsEnabled()) {
|
|
127642
127654
|
ss << "Query profiling is disabled. Call "
|
|
127643
127655
|
"Connection::EnableProfiling() to enable profiling!";
|
|
@@ -127888,7 +127900,7 @@ void QueryProfiler::Render(const QueryProfiler::TreeNode &node, std::ostream &ss
|
|
|
127888
127900
|
}
|
|
127889
127901
|
|
|
127890
127902
|
void QueryProfiler::Print() {
|
|
127891
|
-
Printer::Print(
|
|
127903
|
+
Printer::Print(QueryTreeToString());
|
|
127892
127904
|
}
|
|
127893
127905
|
|
|
127894
127906
|
vector<QueryProfiler::PhaseTimingItem> QueryProfiler::GetOrderedPhaseTimings() const {
|
|
@@ -131022,6 +131034,7 @@ void EnableProfilingSetting::SetLocal(ClientContext &context, const Value &input
|
|
|
131022
131034
|
"Unrecognized print format %s, supported formats: [json, query_tree, query_tree_optimizer]", parameter);
|
|
131023
131035
|
}
|
|
131024
131036
|
config.enable_profiler = true;
|
|
131037
|
+
config.emit_profiler_output = true;
|
|
131025
131038
|
}
|
|
131026
131039
|
|
|
131027
131040
|
Value EnableProfilingSetting::GetSetting(ClientContext &context) {
|
|
@@ -131030,8 +131043,6 @@ Value EnableProfilingSetting::GetSetting(ClientContext &context) {
|
|
|
131030
131043
|
return Value();
|
|
131031
131044
|
}
|
|
131032
131045
|
switch (config.profiler_print_format) {
|
|
131033
|
-
case ProfilerPrintFormat::NONE:
|
|
131034
|
-
return Value("none");
|
|
131035
131046
|
case ProfilerPrintFormat::JSON:
|
|
131036
131047
|
return Value("json");
|
|
131037
131048
|
case ProfilerPrintFormat::QUERY_TREE:
|
|
@@ -131255,9 +131266,11 @@ void ProfilingModeSetting::SetLocal(ClientContext &context, const Value &input)
|
|
|
131255
131266
|
if (parameter == "standard") {
|
|
131256
131267
|
config.enable_profiler = true;
|
|
131257
131268
|
config.enable_detailed_profiling = false;
|
|
131269
|
+
config.emit_profiler_output = true;
|
|
131258
131270
|
} else if (parameter == "detailed") {
|
|
131259
131271
|
config.enable_profiler = true;
|
|
131260
131272
|
config.enable_detailed_profiling = true;
|
|
131273
|
+
config.emit_profiler_output = true;
|
|
131261
131274
|
} else {
|
|
131262
131275
|
throw ParserException("Unrecognized profiling mode \"%s\", supported formats: [standard, detailed]", parameter);
|
|
131263
131276
|
}
|
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 "v0.4.1-
|
|
14
|
+
#define DUCKDB_SOURCE_ID "54d6c7036"
|
|
15
|
+
#define DUCKDB_VERSION "v0.4.1-dev261"
|
|
16
16
|
//===----------------------------------------------------------------------===//
|
|
17
17
|
// DuckDB
|
|
18
18
|
//
|
|
@@ -204,7 +204,7 @@ uint64_t NextPowerOfTwo(uint64_t v);
|
|
|
204
204
|
|
|
205
205
|
namespace duckdb {
|
|
206
206
|
|
|
207
|
-
enum class ProfilerPrintFormat : uint8_t {
|
|
207
|
+
enum class ProfilerPrintFormat : uint8_t { QUERY_TREE, JSON, QUERY_TREE_OPTIMIZER };
|
|
208
208
|
|
|
209
209
|
} // namespace duckdb
|
|
210
210
|
|
|
@@ -17709,12 +17709,16 @@ struct ClientConfig {
|
|
|
17709
17709
|
bool enable_profiler = false;
|
|
17710
17710
|
//! If detailed query profiling is enabled
|
|
17711
17711
|
bool enable_detailed_profiling = false;
|
|
17712
|
-
//! The format to
|
|
17713
|
-
ProfilerPrintFormat profiler_print_format = ProfilerPrintFormat::
|
|
17712
|
+
//! The format to print query profiling information in (default: query_tree), if enabled.
|
|
17713
|
+
ProfilerPrintFormat profiler_print_format = ProfilerPrintFormat::QUERY_TREE;
|
|
17714
17714
|
//! The file to save query profiling information to, instead of printing it to the console
|
|
17715
17715
|
//! (empty = print to console)
|
|
17716
17716
|
string profiler_save_location;
|
|
17717
17717
|
|
|
17718
|
+
//! Allows suppressing profiler output, even if enabled. We turn on the profiler on all test runs but don't want
|
|
17719
|
+
//! to output anything
|
|
17720
|
+
bool emit_profiler_output = true;
|
|
17721
|
+
|
|
17718
17722
|
//! If the progress bar is enabled or not.
|
|
17719
17723
|
bool enable_progress_bar = false;
|
|
17720
17724
|
//! If the print of the progress bar is enabled
|