duckdb 0.3.3-dev551.0 → 0.3.3-dev562.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 +93 -88
- package/src/duckdb.hpp +5157 -5133
- package/src/parquet-amalgamation.cpp +24876 -24876
package/package.json
CHANGED
package/src/duckdb.cpp
CHANGED
|
@@ -104310,7 +104310,7 @@ class SelectStatement;
|
|
|
104310
104310
|
|
|
104311
104311
|
class QueryRelation : public Relation {
|
|
104312
104312
|
public:
|
|
104313
|
-
QueryRelation(ClientContext &context, unique_ptr<SelectStatement> select_stmt, string alias);
|
|
104313
|
+
QueryRelation(const std::shared_ptr<ClientContext> &context, unique_ptr<SelectStatement> select_stmt, string alias);
|
|
104314
104314
|
~QueryRelation();
|
|
104315
104315
|
|
|
104316
104316
|
unique_ptr<SelectStatement> select_stmt;
|
|
@@ -104348,8 +104348,8 @@ namespace duckdb {
|
|
|
104348
104348
|
|
|
104349
104349
|
class ReadCSVRelation : public Relation {
|
|
104350
104350
|
public:
|
|
104351
|
-
ReadCSVRelation(ClientContext &context, string csv_file, vector<ColumnDefinition> columns,
|
|
104352
|
-
string alias = string());
|
|
104351
|
+
ReadCSVRelation(const std::shared_ptr<ClientContext> &context, string csv_file, vector<ColumnDefinition> columns,
|
|
104352
|
+
bool auto_detect = false, string alias = string());
|
|
104353
104353
|
|
|
104354
104354
|
string csv_file;
|
|
104355
104355
|
bool auto_detect;
|
|
@@ -104383,7 +104383,7 @@ namespace duckdb {
|
|
|
104383
104383
|
|
|
104384
104384
|
class TableRelation : public Relation {
|
|
104385
104385
|
public:
|
|
104386
|
-
TableRelation(ClientContext &context, unique_ptr<TableDescription> description);
|
|
104386
|
+
TableRelation(const std::shared_ptr<ClientContext> &context, unique_ptr<TableDescription> description);
|
|
104387
104387
|
|
|
104388
104388
|
unique_ptr<TableDescription> description;
|
|
104389
104389
|
|
|
@@ -104418,10 +104418,10 @@ namespace duckdb {
|
|
|
104418
104418
|
|
|
104419
104419
|
class TableFunctionRelation : public Relation {
|
|
104420
104420
|
public:
|
|
104421
|
-
TableFunctionRelation(ClientContext &context, string name, vector<Value> parameters,
|
|
104421
|
+
TableFunctionRelation(const std::shared_ptr<ClientContext> &context, string name, vector<Value> parameters,
|
|
104422
104422
|
named_parameter_map_t named_parameters, shared_ptr<Relation> input_relation_p = nullptr);
|
|
104423
104423
|
|
|
104424
|
-
TableFunctionRelation(ClientContext &context, string name, vector<Value> parameters,
|
|
104424
|
+
TableFunctionRelation(const std::shared_ptr<ClientContext> &context, string name, vector<Value> parameters,
|
|
104425
104425
|
shared_ptr<Relation> input_relation_p = nullptr);
|
|
104426
104426
|
|
|
104427
104427
|
string name;
|
|
@@ -104458,9 +104458,10 @@ namespace duckdb {
|
|
|
104458
104458
|
|
|
104459
104459
|
class ValueRelation : public Relation {
|
|
104460
104460
|
public:
|
|
104461
|
-
ValueRelation(ClientContext &context, const vector<vector<Value>> &values,
|
|
104461
|
+
ValueRelation(const std::shared_ptr<ClientContext> &context, const vector<vector<Value>> &values,
|
|
104462
|
+
vector<string> names, string alias = "values");
|
|
104463
|
+
ValueRelation(const std::shared_ptr<ClientContext> &context, const string &values, vector<string> names,
|
|
104462
104464
|
string alias = "values");
|
|
104463
|
-
ValueRelation(ClientContext &context, const string &values, vector<string> names, string alias = "values");
|
|
104464
104465
|
|
|
104465
104466
|
vector<vector<unique_ptr<ParsedExpression>>> expressions;
|
|
104466
104467
|
vector<string> names;
|
|
@@ -104495,7 +104496,7 @@ namespace duckdb {
|
|
|
104495
104496
|
|
|
104496
104497
|
class ViewRelation : public Relation {
|
|
104497
104498
|
public:
|
|
104498
|
-
ViewRelation(ClientContext &context, string schema_name, string view_name);
|
|
104499
|
+
ViewRelation(const std::shared_ptr<ClientContext> &context, string schema_name, string view_name);
|
|
104499
104500
|
|
|
104500
104501
|
string schema_name;
|
|
104501
104502
|
string view_name;
|
|
@@ -104690,7 +104691,7 @@ shared_ptr<Relation> Connection::Table(const string &schema_name, const string &
|
|
|
104690
104691
|
if (!table_info) {
|
|
104691
104692
|
throw Exception("Table does not exist!");
|
|
104692
104693
|
}
|
|
104693
|
-
return make_shared<TableRelation>(
|
|
104694
|
+
return make_shared<TableRelation>(context, move(table_info));
|
|
104694
104695
|
}
|
|
104695
104696
|
|
|
104696
104697
|
shared_ptr<Relation> Connection::View(const string &tname) {
|
|
@@ -104698,7 +104699,7 @@ shared_ptr<Relation> Connection::View(const string &tname) {
|
|
|
104698
104699
|
}
|
|
104699
104700
|
|
|
104700
104701
|
shared_ptr<Relation> Connection::View(const string &schema_name, const string &table_name) {
|
|
104701
|
-
return make_shared<ViewRelation>(
|
|
104702
|
+
return make_shared<ViewRelation>(context, schema_name, table_name);
|
|
104702
104703
|
}
|
|
104703
104704
|
|
|
104704
104705
|
shared_ptr<Relation> Connection::TableFunction(const string &fname) {
|
|
@@ -104709,11 +104710,11 @@ shared_ptr<Relation> Connection::TableFunction(const string &fname) {
|
|
|
104709
104710
|
|
|
104710
104711
|
shared_ptr<Relation> Connection::TableFunction(const string &fname, const vector<Value> &values,
|
|
104711
104712
|
const named_parameter_map_t &named_parameters) {
|
|
104712
|
-
return make_shared<TableFunctionRelation>(
|
|
104713
|
+
return make_shared<TableFunctionRelation>(context, fname, values, named_parameters);
|
|
104713
104714
|
}
|
|
104714
104715
|
|
|
104715
104716
|
shared_ptr<Relation> Connection::TableFunction(const string &fname, const vector<Value> &values) {
|
|
104716
|
-
return make_shared<TableFunctionRelation>(
|
|
104717
|
+
return make_shared<TableFunctionRelation>(context, fname, values);
|
|
104717
104718
|
}
|
|
104718
104719
|
|
|
104719
104720
|
shared_ptr<Relation> Connection::Values(const vector<vector<Value>> &values) {
|
|
@@ -104723,7 +104724,7 @@ shared_ptr<Relation> Connection::Values(const vector<vector<Value>> &values) {
|
|
|
104723
104724
|
|
|
104724
104725
|
shared_ptr<Relation> Connection::Values(const vector<vector<Value>> &values, const vector<string> &column_names,
|
|
104725
104726
|
const string &alias) {
|
|
104726
|
-
return make_shared<ValueRelation>(
|
|
104727
|
+
return make_shared<ValueRelation>(context, values, column_names, alias);
|
|
104727
104728
|
}
|
|
104728
104729
|
|
|
104729
104730
|
shared_ptr<Relation> Connection::Values(const string &values) {
|
|
@@ -104732,7 +104733,7 @@ shared_ptr<Relation> Connection::Values(const string &values) {
|
|
|
104732
104733
|
}
|
|
104733
104734
|
|
|
104734
104735
|
shared_ptr<Relation> Connection::Values(const string &values, const vector<string> &column_names, const string &alias) {
|
|
104735
|
-
return make_shared<ValueRelation>(
|
|
104736
|
+
return make_shared<ValueRelation>(context, values, column_names, alias);
|
|
104736
104737
|
}
|
|
104737
104738
|
|
|
104738
104739
|
shared_ptr<Relation> Connection::ReadCSV(const string &csv_file) {
|
|
@@ -104744,7 +104745,7 @@ shared_ptr<Relation> Connection::ReadCSV(const string &csv_file) {
|
|
|
104744
104745
|
for (idx_t i = 0; i < reader.sql_types.size(); i++) {
|
|
104745
104746
|
column_list.emplace_back(reader.col_names[i], reader.sql_types[i]);
|
|
104746
104747
|
}
|
|
104747
|
-
return make_shared<ReadCSVRelation>(
|
|
104748
|
+
return make_shared<ReadCSVRelation>(context, csv_file, move(column_list), true);
|
|
104748
104749
|
}
|
|
104749
104750
|
|
|
104750
104751
|
shared_ptr<Relation> Connection::ReadCSV(const string &csv_file, const vector<string> &columns) {
|
|
@@ -104757,19 +104758,19 @@ shared_ptr<Relation> Connection::ReadCSV(const string &csv_file, const vector<st
|
|
|
104757
104758
|
}
|
|
104758
104759
|
column_list.push_back(move(col_list[0]));
|
|
104759
104760
|
}
|
|
104760
|
-
return make_shared<ReadCSVRelation>(
|
|
104761
|
+
return make_shared<ReadCSVRelation>(context, csv_file, move(column_list));
|
|
104761
104762
|
}
|
|
104762
104763
|
|
|
104763
104764
|
unordered_set<string> Connection::GetTableNames(const string &query) {
|
|
104764
104765
|
return context->GetTableNames(query);
|
|
104765
104766
|
}
|
|
104766
104767
|
|
|
104767
|
-
shared_ptr<Relation> Connection::RelationFromQuery(const string &query, string alias, const string &error) {
|
|
104768
|
-
return RelationFromQuery(QueryRelation::ParseStatement(*context, query, error),
|
|
104768
|
+
shared_ptr<Relation> Connection::RelationFromQuery(const string &query, const string &alias, const string &error) {
|
|
104769
|
+
return RelationFromQuery(QueryRelation::ParseStatement(*context, query, error), alias);
|
|
104769
104770
|
}
|
|
104770
104771
|
|
|
104771
|
-
shared_ptr<Relation> Connection::RelationFromQuery(unique_ptr<SelectStatement> select_stmt, string alias) {
|
|
104772
|
-
return make_shared<QueryRelation>(
|
|
104772
|
+
shared_ptr<Relation> Connection::RelationFromQuery(unique_ptr<SelectStatement> select_stmt, const string &alias) {
|
|
104773
|
+
return make_shared<QueryRelation>(context, move(select_stmt), alias);
|
|
104773
104774
|
}
|
|
104774
104775
|
|
|
104775
104776
|
void Connection::BeginTransaction() {
|
|
@@ -114987,7 +114988,7 @@ AggregateRelation::AggregateRelation(shared_ptr<Relation> child_p,
|
|
|
114987
114988
|
: Relation(child_p->context, RelationType::AGGREGATE_RELATION), expressions(move(parsed_expressions)),
|
|
114988
114989
|
child(move(child_p)) {
|
|
114989
114990
|
// bind the expressions
|
|
114990
|
-
context.TryBindRelation(*this, this->columns);
|
|
114991
|
+
context.GetContext()->TryBindRelation(*this, this->columns);
|
|
114991
114992
|
}
|
|
114992
114993
|
|
|
114993
114994
|
AggregateRelation::AggregateRelation(shared_ptr<Relation> child_p,
|
|
@@ -114996,7 +114997,7 @@ AggregateRelation::AggregateRelation(shared_ptr<Relation> child_p,
|
|
|
114996
114997
|
: Relation(child_p->context, RelationType::AGGREGATE_RELATION), expressions(move(parsed_expressions)),
|
|
114997
114998
|
groups(move(groups_p)), child(move(child_p)) {
|
|
114998
114999
|
// bind the expressions
|
|
114999
|
-
context.TryBindRelation(*this, this->columns);
|
|
115000
|
+
context.GetContext()->TryBindRelation(*this, this->columns);
|
|
115000
115001
|
}
|
|
115001
115002
|
|
|
115002
115003
|
unique_ptr<QueryNode> AggregateRelation::GetQueryNode() {
|
|
@@ -115132,7 +115133,7 @@ namespace duckdb {
|
|
|
115132
115133
|
CreateTableRelation::CreateTableRelation(shared_ptr<Relation> child_p, string schema_name, string table_name)
|
|
115133
115134
|
: Relation(child_p->context, RelationType::CREATE_TABLE_RELATION), child(move(child_p)),
|
|
115134
115135
|
schema_name(move(schema_name)), table_name(move(table_name)) {
|
|
115135
|
-
context.TryBindRelation(*this, this->columns);
|
|
115136
|
+
context.GetContext()->TryBindRelation(*this, this->columns);
|
|
115136
115137
|
}
|
|
115137
115138
|
|
|
115138
115139
|
BoundStatement CreateTableRelation::Bind(Binder &binder) {
|
|
@@ -115205,7 +115206,7 @@ CreateViewRelation::CreateViewRelation(shared_ptr<Relation> child_p, string view
|
|
|
115205
115206
|
bool temporary_p)
|
|
115206
115207
|
: Relation(child_p->context, RelationType::CREATE_VIEW_RELATION), child(move(child_p)),
|
|
115207
115208
|
view_name(move(view_name_p)), replace(replace_p), temporary(temporary_p) {
|
|
115208
|
-
context.TryBindRelation(*this, this->columns);
|
|
115209
|
+
context.GetContext()->TryBindRelation(*this, this->columns);
|
|
115209
115210
|
}
|
|
115210
115211
|
|
|
115211
115212
|
BoundStatement CreateViewRelation::Bind(Binder &binder) {
|
|
@@ -115275,10 +115276,10 @@ namespace duckdb {
|
|
|
115275
115276
|
|
|
115276
115277
|
CrossProductRelation::CrossProductRelation(shared_ptr<Relation> left_p, shared_ptr<Relation> right_p)
|
|
115277
115278
|
: Relation(left_p->context, RelationType::CROSS_PRODUCT_RELATION), left(move(left_p)), right(move(right_p)) {
|
|
115278
|
-
if (
|
|
115279
|
+
if (left->context.GetContext() != right->context.GetContext()) {
|
|
115279
115280
|
throw Exception("Cannot combine LEFT and RIGHT relations of different connections!");
|
|
115280
115281
|
}
|
|
115281
|
-
context.TryBindRelation(*this, this->columns);
|
|
115282
|
+
context.GetContext()->TryBindRelation(*this, this->columns);
|
|
115282
115283
|
}
|
|
115283
115284
|
|
|
115284
115285
|
unique_ptr<QueryNode> CrossProductRelation::GetQueryNode() {
|
|
@@ -115323,7 +115324,7 @@ namespace duckdb {
|
|
|
115323
115324
|
|
|
115324
115325
|
class DeleteRelation : public Relation {
|
|
115325
115326
|
public:
|
|
115326
|
-
DeleteRelation(
|
|
115327
|
+
DeleteRelation(ClientContextWrapper &context, unique_ptr<ParsedExpression> condition, string schema_name,
|
|
115327
115328
|
string table_name);
|
|
115328
115329
|
|
|
115329
115330
|
vector<ColumnDefinition> columns;
|
|
@@ -115381,11 +115382,11 @@ public:
|
|
|
115381
115382
|
|
|
115382
115383
|
namespace duckdb {
|
|
115383
115384
|
|
|
115384
|
-
DeleteRelation::DeleteRelation(
|
|
115385
|
-
string table_name_p)
|
|
115385
|
+
DeleteRelation::DeleteRelation(ClientContextWrapper &context, unique_ptr<ParsedExpression> condition_p,
|
|
115386
|
+
string schema_name_p, string table_name_p)
|
|
115386
115387
|
: Relation(context, RelationType::DELETE_RELATION), condition(move(condition_p)), schema_name(move(schema_name_p)),
|
|
115387
115388
|
table_name(move(table_name_p)) {
|
|
115388
|
-
context.TryBindRelation(*this, this->columns);
|
|
115389
|
+
context.GetContext()->TryBindRelation(*this, this->columns);
|
|
115389
115390
|
}
|
|
115390
115391
|
|
|
115391
115392
|
BoundStatement DeleteRelation::Bind(Binder &binder) {
|
|
@@ -115458,7 +115459,7 @@ namespace duckdb {
|
|
|
115458
115459
|
DistinctRelation::DistinctRelation(shared_ptr<Relation> child_p)
|
|
115459
115460
|
: Relation(child_p->context, RelationType::DISTINCT_RELATION), child(move(child_p)) {
|
|
115460
115461
|
vector<ColumnDefinition> dummy_columns;
|
|
115461
|
-
context.TryBindRelation(*this, dummy_columns);
|
|
115462
|
+
context.GetContext()->TryBindRelation(*this, dummy_columns);
|
|
115462
115463
|
}
|
|
115463
115464
|
|
|
115464
115465
|
unique_ptr<QueryNode> DistinctRelation::GetQueryNode() {
|
|
@@ -115524,7 +115525,7 @@ namespace duckdb {
|
|
|
115524
115525
|
|
|
115525
115526
|
ExplainRelation::ExplainRelation(shared_ptr<Relation> child_p)
|
|
115526
115527
|
: Relation(child_p->context, RelationType::EXPLAIN_RELATION), child(move(child_p)) {
|
|
115527
|
-
context.TryBindRelation(*this, this->columns);
|
|
115528
|
+
context.GetContext()->TryBindRelation(*this, this->columns);
|
|
115528
115529
|
}
|
|
115529
115530
|
|
|
115530
115531
|
BoundStatement ExplainRelation::Bind(Binder &binder) {
|
|
@@ -115656,7 +115657,7 @@ namespace duckdb {
|
|
|
115656
115657
|
FilterRelation::FilterRelation(shared_ptr<Relation> child_p, unique_ptr<ParsedExpression> condition_p)
|
|
115657
115658
|
: Relation(child_p->context, RelationType::FILTER_RELATION), condition(move(condition_p)), child(move(child_p)) {
|
|
115658
115659
|
vector<ColumnDefinition> dummy_columns;
|
|
115659
|
-
context.TryBindRelation(*this, dummy_columns);
|
|
115660
|
+
context.GetContext()->TryBindRelation(*this, dummy_columns);
|
|
115660
115661
|
}
|
|
115661
115662
|
|
|
115662
115663
|
unique_ptr<QueryNode> FilterRelation::GetQueryNode() {
|
|
@@ -115781,7 +115782,7 @@ namespace duckdb {
|
|
|
115781
115782
|
InsertRelation::InsertRelation(shared_ptr<Relation> child_p, string schema_name, string table_name)
|
|
115782
115783
|
: Relation(child_p->context, RelationType::INSERT_RELATION), child(move(child_p)), schema_name(move(schema_name)),
|
|
115783
115784
|
table_name(move(table_name)) {
|
|
115784
|
-
context.TryBindRelation(*this, this->columns);
|
|
115785
|
+
context.GetContext()->TryBindRelation(*this, this->columns);
|
|
115785
115786
|
}
|
|
115786
115787
|
|
|
115787
115788
|
BoundStatement InsertRelation::Bind(Binder &binder) {
|
|
@@ -115855,20 +115856,20 @@ JoinRelation::JoinRelation(shared_ptr<Relation> left_p, shared_ptr<Relation> rig
|
|
|
115855
115856
|
unique_ptr<ParsedExpression> condition_p, JoinType type)
|
|
115856
115857
|
: Relation(left_p->context, RelationType::JOIN_RELATION), left(move(left_p)), right(move(right_p)),
|
|
115857
115858
|
condition(move(condition_p)), join_type(type) {
|
|
115858
|
-
if (
|
|
115859
|
+
if (left->context.GetContext() != right->context.GetContext()) {
|
|
115859
115860
|
throw Exception("Cannot combine LEFT and RIGHT relations of different connections!");
|
|
115860
115861
|
}
|
|
115861
|
-
context.TryBindRelation(*this, this->columns);
|
|
115862
|
+
context.GetContext()->TryBindRelation(*this, this->columns);
|
|
115862
115863
|
}
|
|
115863
115864
|
|
|
115864
115865
|
JoinRelation::JoinRelation(shared_ptr<Relation> left_p, shared_ptr<Relation> right_p, vector<string> using_columns_p,
|
|
115865
115866
|
JoinType type)
|
|
115866
115867
|
: Relation(left_p->context, RelationType::JOIN_RELATION), left(move(left_p)), right(move(right_p)),
|
|
115867
115868
|
using_columns(move(using_columns_p)), join_type(type) {
|
|
115868
|
-
if (
|
|
115869
|
+
if (left->context.GetContext() != right->context.GetContext()) {
|
|
115869
115870
|
throw Exception("Cannot combine LEFT and RIGHT relations of different connections!");
|
|
115870
115871
|
}
|
|
115871
|
-
context.TryBindRelation(*this, this->columns);
|
|
115872
|
+
context.GetContext()->TryBindRelation(*this, this->columns);
|
|
115872
115873
|
}
|
|
115873
115874
|
|
|
115874
115875
|
unique_ptr<QueryNode> JoinRelation::GetQueryNode() {
|
|
@@ -116035,7 +116036,7 @@ OrderRelation::OrderRelation(shared_ptr<Relation> child_p, vector<OrderByNode> o
|
|
|
116035
116036
|
: Relation(child_p->context, RelationType::ORDER_RELATION), orders(move(orders)), child(move(child_p)) {
|
|
116036
116037
|
// bind the expressions
|
|
116037
116038
|
vector<ColumnDefinition> dummy_columns;
|
|
116038
|
-
context.TryBindRelation(*this, dummy_columns);
|
|
116039
|
+
context.GetContext()->TryBindRelation(*this, dummy_columns);
|
|
116039
116040
|
}
|
|
116040
116041
|
|
|
116041
116042
|
unique_ptr<QueryNode> OrderRelation::GetQueryNode() {
|
|
@@ -116122,7 +116123,7 @@ ProjectionRelation::ProjectionRelation(shared_ptr<Relation> child_p,
|
|
|
116122
116123
|
}
|
|
116123
116124
|
}
|
|
116124
116125
|
// bind the expressions
|
|
116125
|
-
context.TryBindRelation(*this, this->columns);
|
|
116126
|
+
context.GetContext()->TryBindRelation(*this, this->columns);
|
|
116126
116127
|
}
|
|
116127
116128
|
|
|
116128
116129
|
unique_ptr<QueryNode> ProjectionRelation::GetQueryNode() {
|
|
@@ -116179,9 +116180,10 @@ string ProjectionRelation::ToString(idx_t depth) {
|
|
|
116179
116180
|
|
|
116180
116181
|
namespace duckdb {
|
|
116181
116182
|
|
|
116182
|
-
QueryRelation::QueryRelation(ClientContext &context, unique_ptr<SelectStatement> select_stmt_p,
|
|
116183
|
+
QueryRelation::QueryRelation(const std::shared_ptr<ClientContext> &context, unique_ptr<SelectStatement> select_stmt_p,
|
|
116184
|
+
string alias_p)
|
|
116183
116185
|
: Relation(context, RelationType::QUERY_RELATION), select_stmt(move(select_stmt_p)), alias(move(alias_p)) {
|
|
116184
|
-
context
|
|
116186
|
+
context->TryBindRelation(*this, this->columns);
|
|
116185
116187
|
}
|
|
116186
116188
|
|
|
116187
116189
|
QueryRelation::~QueryRelation() {
|
|
@@ -116240,8 +116242,8 @@ string QueryRelation::ToString(idx_t depth) {
|
|
|
116240
116242
|
|
|
116241
116243
|
namespace duckdb {
|
|
116242
116244
|
|
|
116243
|
-
ReadCSVRelation::ReadCSVRelation(ClientContext &context, string csv_file_p,
|
|
116244
|
-
bool auto_detect, string alias_p)
|
|
116245
|
+
ReadCSVRelation::ReadCSVRelation(const std::shared_ptr<ClientContext> &context, string csv_file_p,
|
|
116246
|
+
vector<ColumnDefinition> columns_p, bool auto_detect, string alias_p)
|
|
116245
116247
|
: Relation(context, RelationType::READ_CSV_RELATION), csv_file(move(csv_file_p)), auto_detect(auto_detect),
|
|
116246
116248
|
alias(move(alias_p)), columns(move(columns_p)) {
|
|
116247
116249
|
if (alias.empty()) {
|
|
@@ -116334,11 +116336,11 @@ namespace duckdb {
|
|
|
116334
116336
|
SetOpRelation::SetOpRelation(shared_ptr<Relation> left_p, shared_ptr<Relation> right_p, SetOperationType setop_type_p)
|
|
116335
116337
|
: Relation(left_p->context, RelationType::SET_OPERATION_RELATION), left(move(left_p)), right(move(right_p)),
|
|
116336
116338
|
setop_type(setop_type_p) {
|
|
116337
|
-
if (
|
|
116339
|
+
if (left->context.GetContext() != right->context.GetContext()) {
|
|
116338
116340
|
throw Exception("Cannot combine LEFT and RIGHT relations of different connections!");
|
|
116339
116341
|
}
|
|
116340
116342
|
vector<ColumnDefinition> dummy_columns;
|
|
116341
|
-
context.TryBindRelation(*this, dummy_columns);
|
|
116343
|
+
context.GetContext()->TryBindRelation(*this, dummy_columns);
|
|
116342
116344
|
}
|
|
116343
116345
|
|
|
116344
116346
|
unique_ptr<QueryNode> SetOpRelation::GetQueryNode() {
|
|
@@ -116423,7 +116425,7 @@ namespace duckdb {
|
|
|
116423
116425
|
SubqueryRelation::SubqueryRelation(shared_ptr<Relation> child_p, string alias_p)
|
|
116424
116426
|
: Relation(child_p->context, RelationType::SUBQUERY_RELATION), child(move(child_p)), alias(move(alias_p)) {
|
|
116425
116427
|
vector<ColumnDefinition> dummy_columns;
|
|
116426
|
-
context.TryBindRelation(*this, dummy_columns);
|
|
116428
|
+
context.GetContext()->TryBindRelation(*this, dummy_columns);
|
|
116427
116429
|
}
|
|
116428
116430
|
|
|
116429
116431
|
unique_ptr<QueryNode> SubqueryRelation::GetQueryNode() {
|
|
@@ -116457,19 +116459,20 @@ string SubqueryRelation::ToString(idx_t depth) {
|
|
|
116457
116459
|
|
|
116458
116460
|
namespace duckdb {
|
|
116459
116461
|
|
|
116460
|
-
TableFunctionRelation::TableFunctionRelation(ClientContext &context, string name_p,
|
|
116461
|
-
named_parameter_map_t named_parameters,
|
|
116462
|
+
TableFunctionRelation::TableFunctionRelation(const std::shared_ptr<ClientContext> &context, string name_p,
|
|
116463
|
+
vector<Value> parameters_p, named_parameter_map_t named_parameters,
|
|
116462
116464
|
shared_ptr<Relation> input_relation_p)
|
|
116463
116465
|
: Relation(context, RelationType::TABLE_FUNCTION_RELATION), name(move(name_p)), parameters(move(parameters_p)),
|
|
116464
116466
|
named_parameters(move(named_parameters)), input_relation(move(input_relation_p)) {
|
|
116465
|
-
context
|
|
116467
|
+
context->TryBindRelation(*this, this->columns);
|
|
116466
116468
|
}
|
|
116467
|
-
TableFunctionRelation::TableFunctionRelation(ClientContext &context, string name_p,
|
|
116469
|
+
TableFunctionRelation::TableFunctionRelation(const std::shared_ptr<ClientContext> &context, string name_p,
|
|
116470
|
+
vector<Value> parameters_p,
|
|
116468
116471
|
|
|
116469
116472
|
shared_ptr<Relation> input_relation_p)
|
|
116470
116473
|
: Relation(context, RelationType::TABLE_FUNCTION_RELATION), name(move(name_p)), parameters(move(parameters_p)),
|
|
116471
116474
|
input_relation(move(input_relation_p)) {
|
|
116472
|
-
context
|
|
116475
|
+
context->TryBindRelation(*this, this->columns);
|
|
116473
116476
|
}
|
|
116474
116477
|
|
|
116475
116478
|
unique_ptr<QueryNode> TableFunctionRelation::GetQueryNode() {
|
|
@@ -116552,7 +116555,7 @@ namespace duckdb {
|
|
|
116552
116555
|
|
|
116553
116556
|
class UpdateRelation : public Relation {
|
|
116554
116557
|
public:
|
|
116555
|
-
UpdateRelation(
|
|
116558
|
+
UpdateRelation(ClientContextWrapper &context, unique_ptr<ParsedExpression> condition, string schema_name,
|
|
116556
116559
|
string table_name, vector<string> update_columns, vector<unique_ptr<ParsedExpression>> expressions);
|
|
116557
116560
|
|
|
116558
116561
|
vector<ColumnDefinition> columns;
|
|
@@ -116578,7 +116581,7 @@ public:
|
|
|
116578
116581
|
|
|
116579
116582
|
namespace duckdb {
|
|
116580
116583
|
|
|
116581
|
-
TableRelation::TableRelation(ClientContext &context, unique_ptr<TableDescription> description)
|
|
116584
|
+
TableRelation::TableRelation(const std::shared_ptr<ClientContext> &context, unique_ptr<TableDescription> description)
|
|
116582
116585
|
: Relation(context, RelationType::TABLE_RELATION), description(move(description)) {
|
|
116583
116586
|
}
|
|
116584
116587
|
|
|
@@ -116623,15 +116626,15 @@ static unique_ptr<ParsedExpression> ParseCondition(ClientContext &context, const
|
|
|
116623
116626
|
void TableRelation::Update(const string &update_list, const string &condition) {
|
|
116624
116627
|
vector<string> update_columns;
|
|
116625
116628
|
vector<unique_ptr<ParsedExpression>> expressions;
|
|
116626
|
-
auto cond = ParseCondition(context, condition);
|
|
116627
|
-
Parser::ParseUpdateList(update_list, update_columns, expressions, context.GetParserOptions());
|
|
116629
|
+
auto cond = ParseCondition(*context.GetContext(), condition);
|
|
116630
|
+
Parser::ParseUpdateList(update_list, update_columns, expressions, context.GetContext()->GetParserOptions());
|
|
116628
116631
|
auto update = make_shared<UpdateRelation>(context, move(cond), description->schema, description->table,
|
|
116629
116632
|
move(update_columns), move(expressions));
|
|
116630
116633
|
update->Execute();
|
|
116631
116634
|
}
|
|
116632
116635
|
|
|
116633
116636
|
void TableRelation::Delete(const string &condition) {
|
|
116634
|
-
auto cond = ParseCondition(context, condition);
|
|
116637
|
+
auto cond = ParseCondition(*context.GetContext(), condition);
|
|
116635
116638
|
auto del = make_shared<DeleteRelation>(context, move(cond), description->schema, description->table);
|
|
116636
116639
|
del->Execute();
|
|
116637
116640
|
}
|
|
@@ -116680,13 +116683,13 @@ public:
|
|
|
116680
116683
|
|
|
116681
116684
|
namespace duckdb {
|
|
116682
116685
|
|
|
116683
|
-
UpdateRelation::UpdateRelation(
|
|
116684
|
-
string table_name_p, vector<string> update_columns_p,
|
|
116686
|
+
UpdateRelation::UpdateRelation(ClientContextWrapper &context, unique_ptr<ParsedExpression> condition_p,
|
|
116687
|
+
string schema_name_p, string table_name_p, vector<string> update_columns_p,
|
|
116685
116688
|
vector<unique_ptr<ParsedExpression>> expressions_p)
|
|
116686
116689
|
: Relation(context, RelationType::UPDATE_RELATION), condition(move(condition_p)), schema_name(move(schema_name_p)),
|
|
116687
116690
|
table_name(move(table_name_p)), update_columns(move(update_columns_p)), expressions(move(expressions_p)) {
|
|
116688
116691
|
D_ASSERT(update_columns.size() == expressions.size());
|
|
116689
|
-
context.TryBindRelation(*this, this->columns);
|
|
116692
|
+
context.GetContext()->TryBindRelation(*this, this->columns);
|
|
116690
116693
|
}
|
|
116691
116694
|
|
|
116692
116695
|
BoundStatement UpdateRelation::Bind(Binder &binder) {
|
|
@@ -116730,8 +116733,8 @@ string UpdateRelation::ToString(idx_t depth) {
|
|
|
116730
116733
|
|
|
116731
116734
|
namespace duckdb {
|
|
116732
116735
|
|
|
116733
|
-
ValueRelation::ValueRelation(ClientContext &context, const vector<vector<Value>> &values,
|
|
116734
|
-
string alias_p)
|
|
116736
|
+
ValueRelation::ValueRelation(const std::shared_ptr<ClientContext> &context, const vector<vector<Value>> &values,
|
|
116737
|
+
vector<string> names_p, string alias_p)
|
|
116735
116738
|
: Relation(context, RelationType::VALUE_LIST_RELATION), names(move(names_p)), alias(move(alias_p)) {
|
|
116736
116739
|
// create constant expressions for the values
|
|
116737
116740
|
for (idx_t row_idx = 0; row_idx < values.size(); row_idx++) {
|
|
@@ -116742,13 +116745,14 @@ ValueRelation::ValueRelation(ClientContext &context, const vector<vector<Value>>
|
|
|
116742
116745
|
}
|
|
116743
116746
|
this->expressions.push_back(move(expressions));
|
|
116744
116747
|
}
|
|
116745
|
-
context
|
|
116748
|
+
context->TryBindRelation(*this, this->columns);
|
|
116746
116749
|
}
|
|
116747
116750
|
|
|
116748
|
-
ValueRelation::ValueRelation(ClientContext &context, const string &values_list,
|
|
116751
|
+
ValueRelation::ValueRelation(const std::shared_ptr<ClientContext> &context, const string &values_list,
|
|
116752
|
+
vector<string> names_p, string alias_p)
|
|
116749
116753
|
: Relation(context, RelationType::VALUE_LIST_RELATION), names(move(names_p)), alias(move(alias_p)) {
|
|
116750
|
-
this->expressions = Parser::ParseValuesList(values_list, context
|
|
116751
|
-
context
|
|
116754
|
+
this->expressions = Parser::ParseValuesList(values_list, context->GetParserOptions());
|
|
116755
|
+
context->TryBindRelation(*this, this->columns);
|
|
116752
116756
|
}
|
|
116753
116757
|
|
|
116754
116758
|
unique_ptr<QueryNode> ValueRelation::GetQueryNode() {
|
|
@@ -116819,9 +116823,9 @@ string ValueRelation::ToString(idx_t depth) {
|
|
|
116819
116823
|
|
|
116820
116824
|
namespace duckdb {
|
|
116821
116825
|
|
|
116822
|
-
ViewRelation::ViewRelation(ClientContext &context, string schema_name_p, string view_name_p)
|
|
116826
|
+
ViewRelation::ViewRelation(const std::shared_ptr<ClientContext> &context, string schema_name_p, string view_name_p)
|
|
116823
116827
|
: Relation(context, RelationType::VIEW_RELATION), schema_name(move(schema_name_p)), view_name(move(view_name_p)) {
|
|
116824
|
-
context
|
|
116828
|
+
context->TryBindRelation(*this, this->columns);
|
|
116825
116829
|
}
|
|
116826
116830
|
|
|
116827
116831
|
unique_ptr<QueryNode> ViewRelation::GetQueryNode() {
|
|
@@ -116924,7 +116928,7 @@ namespace duckdb {
|
|
|
116924
116928
|
|
|
116925
116929
|
WriteCSVRelation::WriteCSVRelation(shared_ptr<Relation> child_p, string csv_file_p)
|
|
116926
116930
|
: Relation(child_p->context, RelationType::WRITE_CSV_RELATION), child(move(child_p)), csv_file(move(csv_file_p)) {
|
|
116927
|
-
context.TryBindRelation(*this, this->columns);
|
|
116931
|
+
context.GetContext()->TryBindRelation(*this, this->columns);
|
|
116928
116932
|
}
|
|
116929
116933
|
|
|
116930
116934
|
BoundStatement WriteCSVRelation::Bind(Binder &binder) {
|
|
@@ -116986,7 +116990,7 @@ shared_ptr<Relation> Relation::Project(const string &expression, const string &a
|
|
|
116986
116990
|
}
|
|
116987
116991
|
|
|
116988
116992
|
shared_ptr<Relation> Relation::Project(const string &select_list, const vector<string> &aliases) {
|
|
116989
|
-
auto expressions = Parser::ParseExpressionList(select_list, context.GetParserOptions());
|
|
116993
|
+
auto expressions = Parser::ParseExpressionList(select_list, context.GetContext()->GetParserOptions());
|
|
116990
116994
|
return make_shared<ProjectionRelation>(shared_from_this(), move(expressions), aliases);
|
|
116991
116995
|
}
|
|
116992
116996
|
|
|
@@ -117012,12 +117016,12 @@ static vector<unique_ptr<ParsedExpression>> StringListToExpressionList(ClientCon
|
|
|
117012
117016
|
}
|
|
117013
117017
|
|
|
117014
117018
|
shared_ptr<Relation> Relation::Project(const vector<string> &expressions, const vector<string> &aliases) {
|
|
117015
|
-
auto result_list = StringListToExpressionList(context, expressions);
|
|
117019
|
+
auto result_list = StringListToExpressionList(*context.GetContext(), expressions);
|
|
117016
117020
|
return make_shared<ProjectionRelation>(shared_from_this(), move(result_list), aliases);
|
|
117017
117021
|
}
|
|
117018
117022
|
|
|
117019
117023
|
shared_ptr<Relation> Relation::Filter(const string &expression) {
|
|
117020
|
-
auto expression_list = Parser::ParseExpressionList(expression, context.GetParserOptions());
|
|
117024
|
+
auto expression_list = Parser::ParseExpressionList(expression, context.GetContext()->GetParserOptions());
|
|
117021
117025
|
if (expression_list.size() != 1) {
|
|
117022
117026
|
throw ParserException("Expected a single expression as filter condition");
|
|
117023
117027
|
}
|
|
@@ -117026,7 +117030,7 @@ shared_ptr<Relation> Relation::Filter(const string &expression) {
|
|
|
117026
117030
|
|
|
117027
117031
|
shared_ptr<Relation> Relation::Filter(const vector<string> &expressions) {
|
|
117028
117032
|
// if there are multiple expressions, we AND them together
|
|
117029
|
-
auto expression_list = StringListToExpressionList(context, expressions);
|
|
117033
|
+
auto expression_list = StringListToExpressionList(*context.GetContext(), expressions);
|
|
117030
117034
|
D_ASSERT(!expression_list.empty());
|
|
117031
117035
|
|
|
117032
117036
|
auto expr = move(expression_list[0]);
|
|
@@ -117042,7 +117046,7 @@ shared_ptr<Relation> Relation::Limit(int64_t limit, int64_t offset) {
|
|
|
117042
117046
|
}
|
|
117043
117047
|
|
|
117044
117048
|
shared_ptr<Relation> Relation::Order(const string &expression) {
|
|
117045
|
-
auto order_list = Parser::ParseOrderList(expression, context.GetParserOptions());
|
|
117049
|
+
auto order_list = Parser::ParseOrderList(expression, context.GetContext()->GetParserOptions());
|
|
117046
117050
|
return make_shared<OrderRelation>(shared_from_this(), move(order_list));
|
|
117047
117051
|
}
|
|
117048
117052
|
|
|
@@ -117052,7 +117056,7 @@ shared_ptr<Relation> Relation::Order(const vector<string> &expressions) {
|
|
|
117052
117056
|
}
|
|
117053
117057
|
vector<OrderByNode> order_list;
|
|
117054
117058
|
for (auto &expression : expressions) {
|
|
117055
|
-
auto inner_list = Parser::ParseOrderList(expression, context.GetParserOptions());
|
|
117059
|
+
auto inner_list = Parser::ParseOrderList(expression, context.GetContext()->GetParserOptions());
|
|
117056
117060
|
if (inner_list.size() != 1) {
|
|
117057
117061
|
throw ParserException("Expected a single ORDER BY expression in the expression list");
|
|
117058
117062
|
}
|
|
@@ -117062,7 +117066,7 @@ shared_ptr<Relation> Relation::Order(const vector<string> &expressions) {
|
|
|
117062
117066
|
}
|
|
117063
117067
|
|
|
117064
117068
|
shared_ptr<Relation> Relation::Join(const shared_ptr<Relation> &other, const string &condition, JoinType type) {
|
|
117065
|
-
auto expression_list = Parser::ParseExpressionList(condition, context.GetParserOptions());
|
|
117069
|
+
auto expression_list = Parser::ParseExpressionList(condition, context.GetContext()->GetParserOptions());
|
|
117066
117070
|
D_ASSERT(!expression_list.empty());
|
|
117067
117071
|
|
|
117068
117072
|
if (expression_list.size() > 1 || expression_list[0]->type == ExpressionType::COLUMN_REF) {
|
|
@@ -117110,24 +117114,24 @@ shared_ptr<Relation> Relation::Alias(const string &alias) {
|
|
|
117110
117114
|
}
|
|
117111
117115
|
|
|
117112
117116
|
shared_ptr<Relation> Relation::Aggregate(const string &aggregate_list) {
|
|
117113
|
-
auto expression_list = Parser::ParseExpressionList(aggregate_list, context.GetParserOptions());
|
|
117117
|
+
auto expression_list = Parser::ParseExpressionList(aggregate_list, context.GetContext()->GetParserOptions());
|
|
117114
117118
|
return make_shared<AggregateRelation>(shared_from_this(), move(expression_list));
|
|
117115
117119
|
}
|
|
117116
117120
|
|
|
117117
117121
|
shared_ptr<Relation> Relation::Aggregate(const string &aggregate_list, const string &group_list) {
|
|
117118
|
-
auto expression_list = Parser::ParseExpressionList(aggregate_list, context.GetParserOptions());
|
|
117119
|
-
auto groups = Parser::ParseExpressionList(group_list, context.GetParserOptions());
|
|
117122
|
+
auto expression_list = Parser::ParseExpressionList(aggregate_list, context.GetContext()->GetParserOptions());
|
|
117123
|
+
auto groups = Parser::ParseExpressionList(group_list, context.GetContext()->GetParserOptions());
|
|
117120
117124
|
return make_shared<AggregateRelation>(shared_from_this(), move(expression_list), move(groups));
|
|
117121
117125
|
}
|
|
117122
117126
|
|
|
117123
117127
|
shared_ptr<Relation> Relation::Aggregate(const vector<string> &aggregates) {
|
|
117124
|
-
auto aggregate_list = StringListToExpressionList(context, aggregates);
|
|
117128
|
+
auto aggregate_list = StringListToExpressionList(*context.GetContext(), aggregates);
|
|
117125
117129
|
return make_shared<AggregateRelation>(shared_from_this(), move(aggregate_list));
|
|
117126
117130
|
}
|
|
117127
117131
|
|
|
117128
117132
|
shared_ptr<Relation> Relation::Aggregate(const vector<string> &aggregates, const vector<string> &groups) {
|
|
117129
|
-
auto aggregate_list = StringListToExpressionList(context, aggregates);
|
|
117130
|
-
auto group_list = StringListToExpressionList(context, groups);
|
|
117133
|
+
auto aggregate_list = StringListToExpressionList(*context.GetContext(), aggregates);
|
|
117134
|
+
auto group_list = StringListToExpressionList(*context.GetContext(), groups);
|
|
117131
117135
|
return make_shared<AggregateRelation>(shared_from_this(), move(aggregate_list), move(group_list));
|
|
117132
117136
|
}
|
|
117133
117137
|
|
|
@@ -117142,7 +117146,7 @@ unique_ptr<TableRef> Relation::GetTableRef() {
|
|
|
117142
117146
|
}
|
|
117143
117147
|
|
|
117144
117148
|
unique_ptr<QueryResult> Relation::Execute() {
|
|
117145
|
-
return context.Execute(shared_from_this());
|
|
117149
|
+
return context.GetContext()->Execute(shared_from_this());
|
|
117146
117150
|
}
|
|
117147
117151
|
|
|
117148
117152
|
BoundStatement Relation::Bind(Binder &binder) {
|
|
@@ -117165,7 +117169,7 @@ void Relation::Insert(const string &schema_name, const string &table_name) {
|
|
|
117165
117169
|
|
|
117166
117170
|
void Relation::Insert(const vector<vector<Value>> &values) {
|
|
117167
117171
|
vector<string> column_names;
|
|
117168
|
-
auto rel = make_shared<ValueRelation>(context, values, move(column_names), "values");
|
|
117172
|
+
auto rel = make_shared<ValueRelation>(context.GetContext(), values, move(column_names), "values");
|
|
117169
117173
|
rel->Insert(GetAlias());
|
|
117170
117174
|
}
|
|
117171
117175
|
|
|
@@ -117199,7 +117203,7 @@ shared_ptr<Relation> Relation::CreateView(const string &name, bool replace, bool
|
|
|
117199
117203
|
}
|
|
117200
117204
|
|
|
117201
117205
|
unique_ptr<QueryResult> Relation::Query(const string &sql) {
|
|
117202
|
-
return context.Query(sql, false);
|
|
117206
|
+
return context.GetContext()->Query(sql, false);
|
|
117203
117207
|
}
|
|
117204
117208
|
|
|
117205
117209
|
unique_ptr<QueryResult> Relation::Query(const string &name, const string &sql) {
|
|
@@ -117222,11 +117226,12 @@ void Relation::Delete(const string &condition) {
|
|
|
117222
117226
|
|
|
117223
117227
|
shared_ptr<Relation> Relation::TableFunction(const std::string &fname, const vector<Value> &values,
|
|
117224
117228
|
const named_parameter_map_t &named_parameters) {
|
|
117225
|
-
return make_shared<TableFunctionRelation>(context, fname, values, named_parameters,
|
|
117229
|
+
return make_shared<TableFunctionRelation>(context.GetContext(), fname, values, named_parameters,
|
|
117230
|
+
shared_from_this());
|
|
117226
117231
|
}
|
|
117227
117232
|
|
|
117228
117233
|
shared_ptr<Relation> Relation::TableFunction(const std::string &fname, const vector<Value> &values) {
|
|
117229
|
-
return make_shared<TableFunctionRelation>(context, fname, values, shared_from_this());
|
|
117234
|
+
return make_shared<TableFunctionRelation>(context.GetContext(), fname, values, shared_from_this());
|
|
117230
117235
|
}
|
|
117231
117236
|
|
|
117232
117237
|
string Relation::ToString() {
|