duckdb 0.7.2-dev1671.0 → 0.7.2-dev1684.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/src/execution/expression_executor.cpp +1 -1
- package/src/duckdb/src/execution/expression_executor_state.cpp +2 -3
- package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/expression_executor_state.hpp +1 -3
- package/src/duckdb/src/include/duckdb/planner/pragma_handler.hpp +3 -2
- package/src/duckdb/src/main/query_profiler.cpp +1 -1
- package/src/duckdb/src/planner/pragma_handler.cpp +7 -5
package/package.json
CHANGED
@@ -56,7 +56,7 @@ Allocator &ExpressionExecutor::GetAllocator() {
|
|
56
56
|
|
57
57
|
void ExpressionExecutor::AddExpression(const Expression &expr) {
|
58
58
|
expressions.push_back(&expr);
|
59
|
-
auto state = make_uniq<ExpressionExecutorState>(
|
59
|
+
auto state = make_uniq<ExpressionExecutorState>();
|
60
60
|
Initialize(expr, *state);
|
61
61
|
state->Verify();
|
62
62
|
states.push_back(std::move(state));
|
@@ -31,11 +31,10 @@ ClientContext &ExpressionState::GetContext() {
|
|
31
31
|
return root.executor->GetContext();
|
32
32
|
}
|
33
33
|
|
34
|
-
ExpressionState::ExpressionState(const Expression &expr, ExpressionExecutorState &root)
|
35
|
-
: expr(expr), root(root), name(expr.ToString()) {
|
34
|
+
ExpressionState::ExpressionState(const Expression &expr, ExpressionExecutorState &root) : expr(expr), root(root) {
|
36
35
|
}
|
37
36
|
|
38
|
-
ExpressionExecutorState::ExpressionExecutorState(
|
37
|
+
ExpressionExecutorState::ExpressionExecutorState() : profiler() {
|
39
38
|
}
|
40
39
|
|
41
40
|
void ExpressionState::Verify(ExpressionExecutorState &root_executor) {
|
@@ -1,8 +1,8 @@
|
|
1
1
|
#ifndef DUCKDB_VERSION
|
2
|
-
#define DUCKDB_VERSION "0.7.2-
|
2
|
+
#define DUCKDB_VERSION "0.7.2-dev1684"
|
3
3
|
#endif
|
4
4
|
#ifndef DUCKDB_SOURCE_ID
|
5
|
-
#define DUCKDB_SOURCE_ID "
|
5
|
+
#define DUCKDB_SOURCE_ID "754ff32005"
|
6
6
|
#endif
|
7
7
|
#include "duckdb/function/table/system_functions.hpp"
|
8
8
|
#include "duckdb/main/database.hpp"
|
@@ -29,7 +29,6 @@ struct ExpressionState {
|
|
29
29
|
vector<unique_ptr<ExpressionState>> child_states;
|
30
30
|
vector<LogicalType> types;
|
31
31
|
DataChunk intermediate_chunk;
|
32
|
-
string name;
|
33
32
|
CycleCounter profiler;
|
34
33
|
|
35
34
|
public:
|
@@ -55,12 +54,11 @@ public:
|
|
55
54
|
};
|
56
55
|
|
57
56
|
struct ExpressionExecutorState {
|
58
|
-
|
57
|
+
ExpressionExecutorState();
|
59
58
|
|
60
59
|
unique_ptr<ExpressionState> root_state;
|
61
60
|
ExpressionExecutor *executor = nullptr;
|
62
61
|
CycleCounter profiler;
|
63
|
-
string name;
|
64
62
|
|
65
63
|
void Verify();
|
66
64
|
};
|
@@ -29,8 +29,9 @@ private:
|
|
29
29
|
ClientContext &context;
|
30
30
|
|
31
31
|
private:
|
32
|
-
//! Handles a pragma statement,
|
33
|
-
|
32
|
+
//! Handles a pragma statement, returns whether the statement was expanded, if it was expanded the 'resulting_query'
|
33
|
+
//! contains the statement(s) to replace the current one
|
34
|
+
bool HandlePragma(SQLStatement *statement, string &resulting_query);
|
34
35
|
|
35
36
|
void HandlePragmaStatementsInternal(vector<unique_ptr<SQLStatement>> &statements);
|
36
37
|
};
|
@@ -690,7 +690,7 @@ ExpressionExecutorInfo::ExpressionExecutorInfo(ExpressionExecutor &executor, con
|
|
690
690
|
ExpressionRootInfo::ExpressionRootInfo(ExpressionExecutorState &state, string name)
|
691
691
|
: current_count(state.profiler.current_count), sample_count(state.profiler.sample_count),
|
692
692
|
sample_tuples_count(state.profiler.sample_tuples_count), tuples_count(state.profiler.tuples_count),
|
693
|
-
name(
|
693
|
+
name("expression"), time(state.profiler.time) {
|
694
694
|
// Use the name of expression-tree as extra-info
|
695
695
|
extra_info = std::move(name);
|
696
696
|
auto expression_info_p = make_uniq<ExpressionInfo>();
|
@@ -32,8 +32,9 @@ void PragmaHandler::HandlePragmaStatementsInternal(vector<unique_ptr<SQLStatemen
|
|
32
32
|
if (statements[i]->type == StatementType::PRAGMA_STATEMENT) {
|
33
33
|
// PRAGMA statement: check if we need to replace it by a new set of statements
|
34
34
|
PragmaHandler handler(context);
|
35
|
-
|
36
|
-
|
35
|
+
string new_query;
|
36
|
+
bool expanded = handler.HandlePragma(statements[i].get(), new_query);
|
37
|
+
if (expanded) {
|
37
38
|
// this PRAGMA statement gets replaced by a new query string
|
38
39
|
// push the new query string through the parser again and add it to the transformer
|
39
40
|
Parser parser(context.GetParserOptions());
|
@@ -67,7 +68,7 @@ void PragmaHandler::HandlePragmaStatements(ClientContextLock &lock, vector<uniqu
|
|
67
68
|
context.RunFunctionInTransactionInternal(lock, [&]() { HandlePragmaStatementsInternal(statements); });
|
68
69
|
}
|
69
70
|
|
70
|
-
|
71
|
+
bool PragmaHandler::HandlePragma(SQLStatement *statement, string &resulting_query) { // PragmaInfo &info
|
71
72
|
auto info = *(statement->Cast<PragmaStatement>()).info;
|
72
73
|
auto entry =
|
73
74
|
Catalog::GetEntry<PragmaFunctionCatalogEntry>(context, INVALID_CATALOG, DEFAULT_SCHEMA, info.name, false);
|
@@ -84,9 +85,10 @@ string PragmaHandler::HandlePragma(SQLStatement *statement) { // PragmaInfo &inf
|
|
84
85
|
Binder::BindNamedParameters(bound_function.named_parameters, info.named_parameters, error_context,
|
85
86
|
bound_function.name);
|
86
87
|
FunctionParameters parameters {info.parameters, info.named_parameters};
|
87
|
-
|
88
|
+
resulting_query = bound_function.query(context, parameters);
|
89
|
+
return true;
|
88
90
|
}
|
89
|
-
return
|
91
|
+
return false;
|
90
92
|
}
|
91
93
|
|
92
94
|
} // namespace duckdb
|