duckdb 0.3.3-dev551.0 → 0.3.3-dev579.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 +237 -90
- package/src/duckdb.hpp +5157 -5133
- package/src/parquet-amalgamation.cpp +36648 -36648
package/src/duckdb.cpp
CHANGED
|
@@ -75773,6 +75773,11 @@ struct ListContainsFun {
|
|
|
75773
75773
|
static void RegisterFunction(BuiltinFunctions &set);
|
|
75774
75774
|
};
|
|
75775
75775
|
|
|
75776
|
+
struct ListFlattenFun {
|
|
75777
|
+
static ScalarFunction GetFunction();
|
|
75778
|
+
static void RegisterFunction(BuiltinFunctions &set);
|
|
75779
|
+
};
|
|
75780
|
+
|
|
75776
75781
|
struct ListPositionFun {
|
|
75777
75782
|
static ScalarFunction GetFunction();
|
|
75778
75783
|
static void RegisterFunction(BuiltinFunctions &set);
|
|
@@ -84005,7 +84010,6 @@ void ListPositionFun::RegisterFunction(BuiltinFunctions &set) {
|
|
|
84005
84010
|
} // namespace duckdb
|
|
84006
84011
|
|
|
84007
84012
|
|
|
84008
|
-
|
|
84009
84013
|
//===----------------------------------------------------------------------===//
|
|
84010
84014
|
// DuckDB
|
|
84011
84015
|
//
|
|
@@ -84044,6 +84048,142 @@ public:
|
|
|
84044
84048
|
} // namespace duckdb
|
|
84045
84049
|
|
|
84046
84050
|
|
|
84051
|
+
namespace duckdb {
|
|
84052
|
+
|
|
84053
|
+
void ListFlattenFunction(DataChunk &args, ExpressionState &state, Vector &result) {
|
|
84054
|
+
D_ASSERT(args.ColumnCount() == 1);
|
|
84055
|
+
|
|
84056
|
+
Vector &input = args.data[0];
|
|
84057
|
+
if (input.GetType().id() == LogicalTypeId::SQLNULL) {
|
|
84058
|
+
result.Reference(input);
|
|
84059
|
+
return;
|
|
84060
|
+
}
|
|
84061
|
+
|
|
84062
|
+
idx_t count = args.size();
|
|
84063
|
+
|
|
84064
|
+
VectorData list_data;
|
|
84065
|
+
input.Orrify(count, list_data);
|
|
84066
|
+
auto list_entries = (list_entry_t *)list_data.data;
|
|
84067
|
+
|
|
84068
|
+
auto &child_vector = ListVector::GetEntry(input);
|
|
84069
|
+
|
|
84070
|
+
result.SetVectorType(VectorType::FLAT_VECTOR);
|
|
84071
|
+
auto result_entries = FlatVector::GetData<list_entry_t>(result);
|
|
84072
|
+
auto &result_validity = FlatVector::Validity(result);
|
|
84073
|
+
|
|
84074
|
+
if (child_vector.GetType().id() == LogicalTypeId::SQLNULL) {
|
|
84075
|
+
auto result_entries = FlatVector::GetData<list_entry_t>(result);
|
|
84076
|
+
for (idx_t i = 0; i < count; i++) {
|
|
84077
|
+
auto list_index = list_data.sel->get_index(i);
|
|
84078
|
+
if (!list_data.validity.RowIsValid(list_index)) {
|
|
84079
|
+
result_validity.SetInvalid(i);
|
|
84080
|
+
continue;
|
|
84081
|
+
}
|
|
84082
|
+
result_entries[i].offset = 0;
|
|
84083
|
+
result_entries[i].length = 0;
|
|
84084
|
+
}
|
|
84085
|
+
return;
|
|
84086
|
+
}
|
|
84087
|
+
|
|
84088
|
+
auto child_size = ListVector::GetListSize(input);
|
|
84089
|
+
VectorData child_data;
|
|
84090
|
+
child_vector.Orrify(child_size, child_data);
|
|
84091
|
+
auto child_entries = (list_entry_t *)child_data.data;
|
|
84092
|
+
auto &data_vector = ListVector::GetEntry(child_vector);
|
|
84093
|
+
|
|
84094
|
+
idx_t offset = 0;
|
|
84095
|
+
for (idx_t i = 0; i < count; i++) {
|
|
84096
|
+
auto list_index = list_data.sel->get_index(i);
|
|
84097
|
+
if (!list_data.validity.RowIsValid(list_index)) {
|
|
84098
|
+
result_validity.SetInvalid(i);
|
|
84099
|
+
continue;
|
|
84100
|
+
}
|
|
84101
|
+
auto list_entry = list_entries[list_index];
|
|
84102
|
+
|
|
84103
|
+
idx_t source_offset = 0;
|
|
84104
|
+
// Find first valid child list entry to get offset
|
|
84105
|
+
for (idx_t j = 0; j < list_entry.length; j++) {
|
|
84106
|
+
auto child_list_index = child_data.sel->get_index(list_entry.offset + j);
|
|
84107
|
+
if (child_data.validity.RowIsValid(child_list_index)) {
|
|
84108
|
+
source_offset = child_entries[child_list_index].offset;
|
|
84109
|
+
break;
|
|
84110
|
+
}
|
|
84111
|
+
}
|
|
84112
|
+
|
|
84113
|
+
idx_t length = 0;
|
|
84114
|
+
// Find last valid child list entry to get length
|
|
84115
|
+
for (idx_t j = list_entry.length - 1; j != (idx_t)-1; j--) {
|
|
84116
|
+
auto child_list_index = child_data.sel->get_index(list_entry.offset + j);
|
|
84117
|
+
if (child_data.validity.RowIsValid(child_list_index)) {
|
|
84118
|
+
auto child_entry = child_entries[child_list_index];
|
|
84119
|
+
length = child_entry.offset + child_entry.length - source_offset;
|
|
84120
|
+
break;
|
|
84121
|
+
}
|
|
84122
|
+
}
|
|
84123
|
+
ListVector::Append(result, data_vector, source_offset + length, source_offset);
|
|
84124
|
+
|
|
84125
|
+
result_entries[i].offset = offset;
|
|
84126
|
+
result_entries[i].length = length;
|
|
84127
|
+
offset += length;
|
|
84128
|
+
}
|
|
84129
|
+
|
|
84130
|
+
if (input.GetVectorType() == VectorType::CONSTANT_VECTOR) {
|
|
84131
|
+
result.SetVectorType(VectorType::CONSTANT_VECTOR);
|
|
84132
|
+
}
|
|
84133
|
+
}
|
|
84134
|
+
|
|
84135
|
+
static unique_ptr<FunctionData> ListFlattenBind(ClientContext &context, ScalarFunction &bound_function,
|
|
84136
|
+
vector<unique_ptr<Expression>> &arguments) {
|
|
84137
|
+
D_ASSERT(bound_function.arguments.size() == 1);
|
|
84138
|
+
|
|
84139
|
+
auto &input_type = arguments[0]->return_type;
|
|
84140
|
+
bound_function.arguments[0] = input_type;
|
|
84141
|
+
if (input_type.id() == LogicalTypeId::SQLNULL) {
|
|
84142
|
+
bound_function.return_type = LogicalType(LogicalTypeId::SQLNULL);
|
|
84143
|
+
return make_unique<VariableReturnBindData>(bound_function.return_type);
|
|
84144
|
+
}
|
|
84145
|
+
D_ASSERT(input_type.id() == LogicalTypeId::LIST);
|
|
84146
|
+
|
|
84147
|
+
auto child_type = ListType::GetChildType(input_type);
|
|
84148
|
+
if (child_type.id() == LogicalType::SQLNULL) {
|
|
84149
|
+
bound_function.return_type = input_type;
|
|
84150
|
+
return make_unique<VariableReturnBindData>(bound_function.return_type);
|
|
84151
|
+
}
|
|
84152
|
+
D_ASSERT(child_type.id() == LogicalTypeId::LIST);
|
|
84153
|
+
|
|
84154
|
+
bound_function.return_type = child_type;
|
|
84155
|
+
return make_unique<VariableReturnBindData>(bound_function.return_type);
|
|
84156
|
+
}
|
|
84157
|
+
|
|
84158
|
+
static unique_ptr<BaseStatistics> ListFlattenStats(ClientContext &context, BoundFunctionExpression &expr,
|
|
84159
|
+
FunctionData *bind_data,
|
|
84160
|
+
vector<unique_ptr<BaseStatistics>> &child_stats) {
|
|
84161
|
+
if (!child_stats[0]) {
|
|
84162
|
+
return nullptr;
|
|
84163
|
+
}
|
|
84164
|
+
auto &list_stats = (ListStatistics &)*child_stats[0];
|
|
84165
|
+
if (!list_stats.child_stats || list_stats.child_stats->type == LogicalTypeId::SQLNULL) {
|
|
84166
|
+
return nullptr;
|
|
84167
|
+
}
|
|
84168
|
+
|
|
84169
|
+
auto child_copy = list_stats.child_stats->Copy();
|
|
84170
|
+
child_copy->validity_stats = make_unique<ValidityStatistics>(true);
|
|
84171
|
+
return child_copy;
|
|
84172
|
+
}
|
|
84173
|
+
|
|
84174
|
+
void ListFlattenFun::RegisterFunction(BuiltinFunctions &set) {
|
|
84175
|
+
ScalarFunction fun({LogicalType::LIST(LogicalType::LIST(LogicalType::ANY))}, LogicalType::LIST(LogicalType::ANY),
|
|
84176
|
+
ListFlattenFunction, false, ListFlattenBind, nullptr, ListFlattenStats);
|
|
84177
|
+
set.AddFunction({"flatten"}, fun);
|
|
84178
|
+
}
|
|
84179
|
+
|
|
84180
|
+
} // namespace duckdb
|
|
84181
|
+
|
|
84182
|
+
|
|
84183
|
+
|
|
84184
|
+
|
|
84185
|
+
|
|
84186
|
+
|
|
84047
84187
|
|
|
84048
84188
|
namespace duckdb {
|
|
84049
84189
|
|
|
@@ -86233,6 +86373,7 @@ void BuiltinFunctions::RegisterNestedFunctions() {
|
|
|
86233
86373
|
Register<ListValueFun>();
|
|
86234
86374
|
Register<ListExtractFun>();
|
|
86235
86375
|
Register<ListRangeFun>();
|
|
86376
|
+
Register<ListFlattenFun>();
|
|
86236
86377
|
Register<MapFun>();
|
|
86237
86378
|
Register<MapExtractFun>();
|
|
86238
86379
|
Register<CardinalityFun>();
|
|
@@ -98992,7 +99133,8 @@ void PragmaDatabaseSizeFunction(ClientContext &context, const FunctionData *bind
|
|
|
98992
99133
|
auto free_blocks = block_manager.FreeBlocks();
|
|
98993
99134
|
auto used_blocks = total_blocks - free_blocks;
|
|
98994
99135
|
auto bytes = (total_blocks * block_size);
|
|
98995
|
-
auto
|
|
99136
|
+
auto wal = storage.GetWriteAheadLog();
|
|
99137
|
+
auto wal_size = wal ? wal->GetWALSize() : 0;
|
|
98996
99138
|
output.data[0].SetValue(0, Value(StringUtil::BytesToHumanReadableString(bytes)));
|
|
98997
99139
|
output.data[1].SetValue(0, Value::BIGINT(block_size));
|
|
98998
99140
|
output.data[2].SetValue(0, Value::BIGINT(total_blocks));
|
|
@@ -104310,7 +104452,7 @@ class SelectStatement;
|
|
|
104310
104452
|
|
|
104311
104453
|
class QueryRelation : public Relation {
|
|
104312
104454
|
public:
|
|
104313
|
-
QueryRelation(ClientContext &context, unique_ptr<SelectStatement> select_stmt, string alias);
|
|
104455
|
+
QueryRelation(const std::shared_ptr<ClientContext> &context, unique_ptr<SelectStatement> select_stmt, string alias);
|
|
104314
104456
|
~QueryRelation();
|
|
104315
104457
|
|
|
104316
104458
|
unique_ptr<SelectStatement> select_stmt;
|
|
@@ -104348,8 +104490,8 @@ namespace duckdb {
|
|
|
104348
104490
|
|
|
104349
104491
|
class ReadCSVRelation : public Relation {
|
|
104350
104492
|
public:
|
|
104351
|
-
ReadCSVRelation(ClientContext &context, string csv_file, vector<ColumnDefinition> columns,
|
|
104352
|
-
string alias = string());
|
|
104493
|
+
ReadCSVRelation(const std::shared_ptr<ClientContext> &context, string csv_file, vector<ColumnDefinition> columns,
|
|
104494
|
+
bool auto_detect = false, string alias = string());
|
|
104353
104495
|
|
|
104354
104496
|
string csv_file;
|
|
104355
104497
|
bool auto_detect;
|
|
@@ -104383,7 +104525,7 @@ namespace duckdb {
|
|
|
104383
104525
|
|
|
104384
104526
|
class TableRelation : public Relation {
|
|
104385
104527
|
public:
|
|
104386
|
-
TableRelation(ClientContext &context, unique_ptr<TableDescription> description);
|
|
104528
|
+
TableRelation(const std::shared_ptr<ClientContext> &context, unique_ptr<TableDescription> description);
|
|
104387
104529
|
|
|
104388
104530
|
unique_ptr<TableDescription> description;
|
|
104389
104531
|
|
|
@@ -104418,10 +104560,10 @@ namespace duckdb {
|
|
|
104418
104560
|
|
|
104419
104561
|
class TableFunctionRelation : public Relation {
|
|
104420
104562
|
public:
|
|
104421
|
-
TableFunctionRelation(ClientContext &context, string name, vector<Value> parameters,
|
|
104563
|
+
TableFunctionRelation(const std::shared_ptr<ClientContext> &context, string name, vector<Value> parameters,
|
|
104422
104564
|
named_parameter_map_t named_parameters, shared_ptr<Relation> input_relation_p = nullptr);
|
|
104423
104565
|
|
|
104424
|
-
TableFunctionRelation(ClientContext &context, string name, vector<Value> parameters,
|
|
104566
|
+
TableFunctionRelation(const std::shared_ptr<ClientContext> &context, string name, vector<Value> parameters,
|
|
104425
104567
|
shared_ptr<Relation> input_relation_p = nullptr);
|
|
104426
104568
|
|
|
104427
104569
|
string name;
|
|
@@ -104458,9 +104600,10 @@ namespace duckdb {
|
|
|
104458
104600
|
|
|
104459
104601
|
class ValueRelation : public Relation {
|
|
104460
104602
|
public:
|
|
104461
|
-
ValueRelation(ClientContext &context, const vector<vector<Value>> &values,
|
|
104603
|
+
ValueRelation(const std::shared_ptr<ClientContext> &context, const vector<vector<Value>> &values,
|
|
104604
|
+
vector<string> names, string alias = "values");
|
|
104605
|
+
ValueRelation(const std::shared_ptr<ClientContext> &context, const string &values, vector<string> names,
|
|
104462
104606
|
string alias = "values");
|
|
104463
|
-
ValueRelation(ClientContext &context, const string &values, vector<string> names, string alias = "values");
|
|
104464
104607
|
|
|
104465
104608
|
vector<vector<unique_ptr<ParsedExpression>>> expressions;
|
|
104466
104609
|
vector<string> names;
|
|
@@ -104495,7 +104638,7 @@ namespace duckdb {
|
|
|
104495
104638
|
|
|
104496
104639
|
class ViewRelation : public Relation {
|
|
104497
104640
|
public:
|
|
104498
|
-
ViewRelation(ClientContext &context, string schema_name, string view_name);
|
|
104641
|
+
ViewRelation(const std::shared_ptr<ClientContext> &context, string schema_name, string view_name);
|
|
104499
104642
|
|
|
104500
104643
|
string schema_name;
|
|
104501
104644
|
string view_name;
|
|
@@ -104690,7 +104833,7 @@ shared_ptr<Relation> Connection::Table(const string &schema_name, const string &
|
|
|
104690
104833
|
if (!table_info) {
|
|
104691
104834
|
throw Exception("Table does not exist!");
|
|
104692
104835
|
}
|
|
104693
|
-
return make_shared<TableRelation>(
|
|
104836
|
+
return make_shared<TableRelation>(context, move(table_info));
|
|
104694
104837
|
}
|
|
104695
104838
|
|
|
104696
104839
|
shared_ptr<Relation> Connection::View(const string &tname) {
|
|
@@ -104698,7 +104841,7 @@ shared_ptr<Relation> Connection::View(const string &tname) {
|
|
|
104698
104841
|
}
|
|
104699
104842
|
|
|
104700
104843
|
shared_ptr<Relation> Connection::View(const string &schema_name, const string &table_name) {
|
|
104701
|
-
return make_shared<ViewRelation>(
|
|
104844
|
+
return make_shared<ViewRelation>(context, schema_name, table_name);
|
|
104702
104845
|
}
|
|
104703
104846
|
|
|
104704
104847
|
shared_ptr<Relation> Connection::TableFunction(const string &fname) {
|
|
@@ -104709,11 +104852,11 @@ shared_ptr<Relation> Connection::TableFunction(const string &fname) {
|
|
|
104709
104852
|
|
|
104710
104853
|
shared_ptr<Relation> Connection::TableFunction(const string &fname, const vector<Value> &values,
|
|
104711
104854
|
const named_parameter_map_t &named_parameters) {
|
|
104712
|
-
return make_shared<TableFunctionRelation>(
|
|
104855
|
+
return make_shared<TableFunctionRelation>(context, fname, values, named_parameters);
|
|
104713
104856
|
}
|
|
104714
104857
|
|
|
104715
104858
|
shared_ptr<Relation> Connection::TableFunction(const string &fname, const vector<Value> &values) {
|
|
104716
|
-
return make_shared<TableFunctionRelation>(
|
|
104859
|
+
return make_shared<TableFunctionRelation>(context, fname, values);
|
|
104717
104860
|
}
|
|
104718
104861
|
|
|
104719
104862
|
shared_ptr<Relation> Connection::Values(const vector<vector<Value>> &values) {
|
|
@@ -104723,7 +104866,7 @@ shared_ptr<Relation> Connection::Values(const vector<vector<Value>> &values) {
|
|
|
104723
104866
|
|
|
104724
104867
|
shared_ptr<Relation> Connection::Values(const vector<vector<Value>> &values, const vector<string> &column_names,
|
|
104725
104868
|
const string &alias) {
|
|
104726
|
-
return make_shared<ValueRelation>(
|
|
104869
|
+
return make_shared<ValueRelation>(context, values, column_names, alias);
|
|
104727
104870
|
}
|
|
104728
104871
|
|
|
104729
104872
|
shared_ptr<Relation> Connection::Values(const string &values) {
|
|
@@ -104732,7 +104875,7 @@ shared_ptr<Relation> Connection::Values(const string &values) {
|
|
|
104732
104875
|
}
|
|
104733
104876
|
|
|
104734
104877
|
shared_ptr<Relation> Connection::Values(const string &values, const vector<string> &column_names, const string &alias) {
|
|
104735
|
-
return make_shared<ValueRelation>(
|
|
104878
|
+
return make_shared<ValueRelation>(context, values, column_names, alias);
|
|
104736
104879
|
}
|
|
104737
104880
|
|
|
104738
104881
|
shared_ptr<Relation> Connection::ReadCSV(const string &csv_file) {
|
|
@@ -104744,7 +104887,7 @@ shared_ptr<Relation> Connection::ReadCSV(const string &csv_file) {
|
|
|
104744
104887
|
for (idx_t i = 0; i < reader.sql_types.size(); i++) {
|
|
104745
104888
|
column_list.emplace_back(reader.col_names[i], reader.sql_types[i]);
|
|
104746
104889
|
}
|
|
104747
|
-
return make_shared<ReadCSVRelation>(
|
|
104890
|
+
return make_shared<ReadCSVRelation>(context, csv_file, move(column_list), true);
|
|
104748
104891
|
}
|
|
104749
104892
|
|
|
104750
104893
|
shared_ptr<Relation> Connection::ReadCSV(const string &csv_file, const vector<string> &columns) {
|
|
@@ -104757,19 +104900,19 @@ shared_ptr<Relation> Connection::ReadCSV(const string &csv_file, const vector<st
|
|
|
104757
104900
|
}
|
|
104758
104901
|
column_list.push_back(move(col_list[0]));
|
|
104759
104902
|
}
|
|
104760
|
-
return make_shared<ReadCSVRelation>(
|
|
104903
|
+
return make_shared<ReadCSVRelation>(context, csv_file, move(column_list));
|
|
104761
104904
|
}
|
|
104762
104905
|
|
|
104763
104906
|
unordered_set<string> Connection::GetTableNames(const string &query) {
|
|
104764
104907
|
return context->GetTableNames(query);
|
|
104765
104908
|
}
|
|
104766
104909
|
|
|
104767
|
-
shared_ptr<Relation> Connection::RelationFromQuery(const string &query, string alias, const string &error) {
|
|
104768
|
-
return RelationFromQuery(QueryRelation::ParseStatement(*context, query, error),
|
|
104910
|
+
shared_ptr<Relation> Connection::RelationFromQuery(const string &query, const string &alias, const string &error) {
|
|
104911
|
+
return RelationFromQuery(QueryRelation::ParseStatement(*context, query, error), alias);
|
|
104769
104912
|
}
|
|
104770
104913
|
|
|
104771
|
-
shared_ptr<Relation> Connection::RelationFromQuery(unique_ptr<SelectStatement> select_stmt, string alias) {
|
|
104772
|
-
return make_shared<QueryRelation>(
|
|
104914
|
+
shared_ptr<Relation> Connection::RelationFromQuery(unique_ptr<SelectStatement> select_stmt, const string &alias) {
|
|
104915
|
+
return make_shared<QueryRelation>(context, move(select_stmt), alias);
|
|
104773
104916
|
}
|
|
104774
104917
|
|
|
104775
104918
|
void Connection::BeginTransaction() {
|
|
@@ -114987,7 +115130,7 @@ AggregateRelation::AggregateRelation(shared_ptr<Relation> child_p,
|
|
|
114987
115130
|
: Relation(child_p->context, RelationType::AGGREGATE_RELATION), expressions(move(parsed_expressions)),
|
|
114988
115131
|
child(move(child_p)) {
|
|
114989
115132
|
// bind the expressions
|
|
114990
|
-
context.TryBindRelation(*this, this->columns);
|
|
115133
|
+
context.GetContext()->TryBindRelation(*this, this->columns);
|
|
114991
115134
|
}
|
|
114992
115135
|
|
|
114993
115136
|
AggregateRelation::AggregateRelation(shared_ptr<Relation> child_p,
|
|
@@ -114996,7 +115139,7 @@ AggregateRelation::AggregateRelation(shared_ptr<Relation> child_p,
|
|
|
114996
115139
|
: Relation(child_p->context, RelationType::AGGREGATE_RELATION), expressions(move(parsed_expressions)),
|
|
114997
115140
|
groups(move(groups_p)), child(move(child_p)) {
|
|
114998
115141
|
// bind the expressions
|
|
114999
|
-
context.TryBindRelation(*this, this->columns);
|
|
115142
|
+
context.GetContext()->TryBindRelation(*this, this->columns);
|
|
115000
115143
|
}
|
|
115001
115144
|
|
|
115002
115145
|
unique_ptr<QueryNode> AggregateRelation::GetQueryNode() {
|
|
@@ -115132,7 +115275,7 @@ namespace duckdb {
|
|
|
115132
115275
|
CreateTableRelation::CreateTableRelation(shared_ptr<Relation> child_p, string schema_name, string table_name)
|
|
115133
115276
|
: Relation(child_p->context, RelationType::CREATE_TABLE_RELATION), child(move(child_p)),
|
|
115134
115277
|
schema_name(move(schema_name)), table_name(move(table_name)) {
|
|
115135
|
-
context.TryBindRelation(*this, this->columns);
|
|
115278
|
+
context.GetContext()->TryBindRelation(*this, this->columns);
|
|
115136
115279
|
}
|
|
115137
115280
|
|
|
115138
115281
|
BoundStatement CreateTableRelation::Bind(Binder &binder) {
|
|
@@ -115205,7 +115348,7 @@ CreateViewRelation::CreateViewRelation(shared_ptr<Relation> child_p, string view
|
|
|
115205
115348
|
bool temporary_p)
|
|
115206
115349
|
: Relation(child_p->context, RelationType::CREATE_VIEW_RELATION), child(move(child_p)),
|
|
115207
115350
|
view_name(move(view_name_p)), replace(replace_p), temporary(temporary_p) {
|
|
115208
|
-
context.TryBindRelation(*this, this->columns);
|
|
115351
|
+
context.GetContext()->TryBindRelation(*this, this->columns);
|
|
115209
115352
|
}
|
|
115210
115353
|
|
|
115211
115354
|
BoundStatement CreateViewRelation::Bind(Binder &binder) {
|
|
@@ -115275,10 +115418,10 @@ namespace duckdb {
|
|
|
115275
115418
|
|
|
115276
115419
|
CrossProductRelation::CrossProductRelation(shared_ptr<Relation> left_p, shared_ptr<Relation> right_p)
|
|
115277
115420
|
: Relation(left_p->context, RelationType::CROSS_PRODUCT_RELATION), left(move(left_p)), right(move(right_p)) {
|
|
115278
|
-
if (
|
|
115421
|
+
if (left->context.GetContext() != right->context.GetContext()) {
|
|
115279
115422
|
throw Exception("Cannot combine LEFT and RIGHT relations of different connections!");
|
|
115280
115423
|
}
|
|
115281
|
-
context.TryBindRelation(*this, this->columns);
|
|
115424
|
+
context.GetContext()->TryBindRelation(*this, this->columns);
|
|
115282
115425
|
}
|
|
115283
115426
|
|
|
115284
115427
|
unique_ptr<QueryNode> CrossProductRelation::GetQueryNode() {
|
|
@@ -115323,7 +115466,7 @@ namespace duckdb {
|
|
|
115323
115466
|
|
|
115324
115467
|
class DeleteRelation : public Relation {
|
|
115325
115468
|
public:
|
|
115326
|
-
DeleteRelation(
|
|
115469
|
+
DeleteRelation(ClientContextWrapper &context, unique_ptr<ParsedExpression> condition, string schema_name,
|
|
115327
115470
|
string table_name);
|
|
115328
115471
|
|
|
115329
115472
|
vector<ColumnDefinition> columns;
|
|
@@ -115381,11 +115524,11 @@ public:
|
|
|
115381
115524
|
|
|
115382
115525
|
namespace duckdb {
|
|
115383
115526
|
|
|
115384
|
-
DeleteRelation::DeleteRelation(
|
|
115385
|
-
string table_name_p)
|
|
115527
|
+
DeleteRelation::DeleteRelation(ClientContextWrapper &context, unique_ptr<ParsedExpression> condition_p,
|
|
115528
|
+
string schema_name_p, string table_name_p)
|
|
115386
115529
|
: Relation(context, RelationType::DELETE_RELATION), condition(move(condition_p)), schema_name(move(schema_name_p)),
|
|
115387
115530
|
table_name(move(table_name_p)) {
|
|
115388
|
-
context.TryBindRelation(*this, this->columns);
|
|
115531
|
+
context.GetContext()->TryBindRelation(*this, this->columns);
|
|
115389
115532
|
}
|
|
115390
115533
|
|
|
115391
115534
|
BoundStatement DeleteRelation::Bind(Binder &binder) {
|
|
@@ -115458,7 +115601,7 @@ namespace duckdb {
|
|
|
115458
115601
|
DistinctRelation::DistinctRelation(shared_ptr<Relation> child_p)
|
|
115459
115602
|
: Relation(child_p->context, RelationType::DISTINCT_RELATION), child(move(child_p)) {
|
|
115460
115603
|
vector<ColumnDefinition> dummy_columns;
|
|
115461
|
-
context.TryBindRelation(*this, dummy_columns);
|
|
115604
|
+
context.GetContext()->TryBindRelation(*this, dummy_columns);
|
|
115462
115605
|
}
|
|
115463
115606
|
|
|
115464
115607
|
unique_ptr<QueryNode> DistinctRelation::GetQueryNode() {
|
|
@@ -115524,7 +115667,7 @@ namespace duckdb {
|
|
|
115524
115667
|
|
|
115525
115668
|
ExplainRelation::ExplainRelation(shared_ptr<Relation> child_p)
|
|
115526
115669
|
: Relation(child_p->context, RelationType::EXPLAIN_RELATION), child(move(child_p)) {
|
|
115527
|
-
context.TryBindRelation(*this, this->columns);
|
|
115670
|
+
context.GetContext()->TryBindRelation(*this, this->columns);
|
|
115528
115671
|
}
|
|
115529
115672
|
|
|
115530
115673
|
BoundStatement ExplainRelation::Bind(Binder &binder) {
|
|
@@ -115656,7 +115799,7 @@ namespace duckdb {
|
|
|
115656
115799
|
FilterRelation::FilterRelation(shared_ptr<Relation> child_p, unique_ptr<ParsedExpression> condition_p)
|
|
115657
115800
|
: Relation(child_p->context, RelationType::FILTER_RELATION), condition(move(condition_p)), child(move(child_p)) {
|
|
115658
115801
|
vector<ColumnDefinition> dummy_columns;
|
|
115659
|
-
context.TryBindRelation(*this, dummy_columns);
|
|
115802
|
+
context.GetContext()->TryBindRelation(*this, dummy_columns);
|
|
115660
115803
|
}
|
|
115661
115804
|
|
|
115662
115805
|
unique_ptr<QueryNode> FilterRelation::GetQueryNode() {
|
|
@@ -115781,7 +115924,7 @@ namespace duckdb {
|
|
|
115781
115924
|
InsertRelation::InsertRelation(shared_ptr<Relation> child_p, string schema_name, string table_name)
|
|
115782
115925
|
: Relation(child_p->context, RelationType::INSERT_RELATION), child(move(child_p)), schema_name(move(schema_name)),
|
|
115783
115926
|
table_name(move(table_name)) {
|
|
115784
|
-
context.TryBindRelation(*this, this->columns);
|
|
115927
|
+
context.GetContext()->TryBindRelation(*this, this->columns);
|
|
115785
115928
|
}
|
|
115786
115929
|
|
|
115787
115930
|
BoundStatement InsertRelation::Bind(Binder &binder) {
|
|
@@ -115855,20 +115998,20 @@ JoinRelation::JoinRelation(shared_ptr<Relation> left_p, shared_ptr<Relation> rig
|
|
|
115855
115998
|
unique_ptr<ParsedExpression> condition_p, JoinType type)
|
|
115856
115999
|
: Relation(left_p->context, RelationType::JOIN_RELATION), left(move(left_p)), right(move(right_p)),
|
|
115857
116000
|
condition(move(condition_p)), join_type(type) {
|
|
115858
|
-
if (
|
|
116001
|
+
if (left->context.GetContext() != right->context.GetContext()) {
|
|
115859
116002
|
throw Exception("Cannot combine LEFT and RIGHT relations of different connections!");
|
|
115860
116003
|
}
|
|
115861
|
-
context.TryBindRelation(*this, this->columns);
|
|
116004
|
+
context.GetContext()->TryBindRelation(*this, this->columns);
|
|
115862
116005
|
}
|
|
115863
116006
|
|
|
115864
116007
|
JoinRelation::JoinRelation(shared_ptr<Relation> left_p, shared_ptr<Relation> right_p, vector<string> using_columns_p,
|
|
115865
116008
|
JoinType type)
|
|
115866
116009
|
: Relation(left_p->context, RelationType::JOIN_RELATION), left(move(left_p)), right(move(right_p)),
|
|
115867
116010
|
using_columns(move(using_columns_p)), join_type(type) {
|
|
115868
|
-
if (
|
|
116011
|
+
if (left->context.GetContext() != right->context.GetContext()) {
|
|
115869
116012
|
throw Exception("Cannot combine LEFT and RIGHT relations of different connections!");
|
|
115870
116013
|
}
|
|
115871
|
-
context.TryBindRelation(*this, this->columns);
|
|
116014
|
+
context.GetContext()->TryBindRelation(*this, this->columns);
|
|
115872
116015
|
}
|
|
115873
116016
|
|
|
115874
116017
|
unique_ptr<QueryNode> JoinRelation::GetQueryNode() {
|
|
@@ -116035,7 +116178,7 @@ OrderRelation::OrderRelation(shared_ptr<Relation> child_p, vector<OrderByNode> o
|
|
|
116035
116178
|
: Relation(child_p->context, RelationType::ORDER_RELATION), orders(move(orders)), child(move(child_p)) {
|
|
116036
116179
|
// bind the expressions
|
|
116037
116180
|
vector<ColumnDefinition> dummy_columns;
|
|
116038
|
-
context.TryBindRelation(*this, dummy_columns);
|
|
116181
|
+
context.GetContext()->TryBindRelation(*this, dummy_columns);
|
|
116039
116182
|
}
|
|
116040
116183
|
|
|
116041
116184
|
unique_ptr<QueryNode> OrderRelation::GetQueryNode() {
|
|
@@ -116122,7 +116265,7 @@ ProjectionRelation::ProjectionRelation(shared_ptr<Relation> child_p,
|
|
|
116122
116265
|
}
|
|
116123
116266
|
}
|
|
116124
116267
|
// bind the expressions
|
|
116125
|
-
context.TryBindRelation(*this, this->columns);
|
|
116268
|
+
context.GetContext()->TryBindRelation(*this, this->columns);
|
|
116126
116269
|
}
|
|
116127
116270
|
|
|
116128
116271
|
unique_ptr<QueryNode> ProjectionRelation::GetQueryNode() {
|
|
@@ -116179,9 +116322,10 @@ string ProjectionRelation::ToString(idx_t depth) {
|
|
|
116179
116322
|
|
|
116180
116323
|
namespace duckdb {
|
|
116181
116324
|
|
|
116182
|
-
QueryRelation::QueryRelation(ClientContext &context, unique_ptr<SelectStatement> select_stmt_p,
|
|
116325
|
+
QueryRelation::QueryRelation(const std::shared_ptr<ClientContext> &context, unique_ptr<SelectStatement> select_stmt_p,
|
|
116326
|
+
string alias_p)
|
|
116183
116327
|
: Relation(context, RelationType::QUERY_RELATION), select_stmt(move(select_stmt_p)), alias(move(alias_p)) {
|
|
116184
|
-
context
|
|
116328
|
+
context->TryBindRelation(*this, this->columns);
|
|
116185
116329
|
}
|
|
116186
116330
|
|
|
116187
116331
|
QueryRelation::~QueryRelation() {
|
|
@@ -116240,8 +116384,8 @@ string QueryRelation::ToString(idx_t depth) {
|
|
|
116240
116384
|
|
|
116241
116385
|
namespace duckdb {
|
|
116242
116386
|
|
|
116243
|
-
ReadCSVRelation::ReadCSVRelation(ClientContext &context, string csv_file_p,
|
|
116244
|
-
bool auto_detect, string alias_p)
|
|
116387
|
+
ReadCSVRelation::ReadCSVRelation(const std::shared_ptr<ClientContext> &context, string csv_file_p,
|
|
116388
|
+
vector<ColumnDefinition> columns_p, bool auto_detect, string alias_p)
|
|
116245
116389
|
: Relation(context, RelationType::READ_CSV_RELATION), csv_file(move(csv_file_p)), auto_detect(auto_detect),
|
|
116246
116390
|
alias(move(alias_p)), columns(move(columns_p)) {
|
|
116247
116391
|
if (alias.empty()) {
|
|
@@ -116334,11 +116478,11 @@ namespace duckdb {
|
|
|
116334
116478
|
SetOpRelation::SetOpRelation(shared_ptr<Relation> left_p, shared_ptr<Relation> right_p, SetOperationType setop_type_p)
|
|
116335
116479
|
: Relation(left_p->context, RelationType::SET_OPERATION_RELATION), left(move(left_p)), right(move(right_p)),
|
|
116336
116480
|
setop_type(setop_type_p) {
|
|
116337
|
-
if (
|
|
116481
|
+
if (left->context.GetContext() != right->context.GetContext()) {
|
|
116338
116482
|
throw Exception("Cannot combine LEFT and RIGHT relations of different connections!");
|
|
116339
116483
|
}
|
|
116340
116484
|
vector<ColumnDefinition> dummy_columns;
|
|
116341
|
-
context.TryBindRelation(*this, dummy_columns);
|
|
116485
|
+
context.GetContext()->TryBindRelation(*this, dummy_columns);
|
|
116342
116486
|
}
|
|
116343
116487
|
|
|
116344
116488
|
unique_ptr<QueryNode> SetOpRelation::GetQueryNode() {
|
|
@@ -116423,7 +116567,7 @@ namespace duckdb {
|
|
|
116423
116567
|
SubqueryRelation::SubqueryRelation(shared_ptr<Relation> child_p, string alias_p)
|
|
116424
116568
|
: Relation(child_p->context, RelationType::SUBQUERY_RELATION), child(move(child_p)), alias(move(alias_p)) {
|
|
116425
116569
|
vector<ColumnDefinition> dummy_columns;
|
|
116426
|
-
context.TryBindRelation(*this, dummy_columns);
|
|
116570
|
+
context.GetContext()->TryBindRelation(*this, dummy_columns);
|
|
116427
116571
|
}
|
|
116428
116572
|
|
|
116429
116573
|
unique_ptr<QueryNode> SubqueryRelation::GetQueryNode() {
|
|
@@ -116457,19 +116601,20 @@ string SubqueryRelation::ToString(idx_t depth) {
|
|
|
116457
116601
|
|
|
116458
116602
|
namespace duckdb {
|
|
116459
116603
|
|
|
116460
|
-
TableFunctionRelation::TableFunctionRelation(ClientContext &context, string name_p,
|
|
116461
|
-
named_parameter_map_t named_parameters,
|
|
116604
|
+
TableFunctionRelation::TableFunctionRelation(const std::shared_ptr<ClientContext> &context, string name_p,
|
|
116605
|
+
vector<Value> parameters_p, named_parameter_map_t named_parameters,
|
|
116462
116606
|
shared_ptr<Relation> input_relation_p)
|
|
116463
116607
|
: Relation(context, RelationType::TABLE_FUNCTION_RELATION), name(move(name_p)), parameters(move(parameters_p)),
|
|
116464
116608
|
named_parameters(move(named_parameters)), input_relation(move(input_relation_p)) {
|
|
116465
|
-
context
|
|
116609
|
+
context->TryBindRelation(*this, this->columns);
|
|
116466
116610
|
}
|
|
116467
|
-
TableFunctionRelation::TableFunctionRelation(ClientContext &context, string name_p,
|
|
116611
|
+
TableFunctionRelation::TableFunctionRelation(const std::shared_ptr<ClientContext> &context, string name_p,
|
|
116612
|
+
vector<Value> parameters_p,
|
|
116468
116613
|
|
|
116469
116614
|
shared_ptr<Relation> input_relation_p)
|
|
116470
116615
|
: Relation(context, RelationType::TABLE_FUNCTION_RELATION), name(move(name_p)), parameters(move(parameters_p)),
|
|
116471
116616
|
input_relation(move(input_relation_p)) {
|
|
116472
|
-
context
|
|
116617
|
+
context->TryBindRelation(*this, this->columns);
|
|
116473
116618
|
}
|
|
116474
116619
|
|
|
116475
116620
|
unique_ptr<QueryNode> TableFunctionRelation::GetQueryNode() {
|
|
@@ -116552,7 +116697,7 @@ namespace duckdb {
|
|
|
116552
116697
|
|
|
116553
116698
|
class UpdateRelation : public Relation {
|
|
116554
116699
|
public:
|
|
116555
|
-
UpdateRelation(
|
|
116700
|
+
UpdateRelation(ClientContextWrapper &context, unique_ptr<ParsedExpression> condition, string schema_name,
|
|
116556
116701
|
string table_name, vector<string> update_columns, vector<unique_ptr<ParsedExpression>> expressions);
|
|
116557
116702
|
|
|
116558
116703
|
vector<ColumnDefinition> columns;
|
|
@@ -116578,7 +116723,7 @@ public:
|
|
|
116578
116723
|
|
|
116579
116724
|
namespace duckdb {
|
|
116580
116725
|
|
|
116581
|
-
TableRelation::TableRelation(ClientContext &context, unique_ptr<TableDescription> description)
|
|
116726
|
+
TableRelation::TableRelation(const std::shared_ptr<ClientContext> &context, unique_ptr<TableDescription> description)
|
|
116582
116727
|
: Relation(context, RelationType::TABLE_RELATION), description(move(description)) {
|
|
116583
116728
|
}
|
|
116584
116729
|
|
|
@@ -116623,15 +116768,15 @@ static unique_ptr<ParsedExpression> ParseCondition(ClientContext &context, const
|
|
|
116623
116768
|
void TableRelation::Update(const string &update_list, const string &condition) {
|
|
116624
116769
|
vector<string> update_columns;
|
|
116625
116770
|
vector<unique_ptr<ParsedExpression>> expressions;
|
|
116626
|
-
auto cond = ParseCondition(context, condition);
|
|
116627
|
-
Parser::ParseUpdateList(update_list, update_columns, expressions, context.GetParserOptions());
|
|
116771
|
+
auto cond = ParseCondition(*context.GetContext(), condition);
|
|
116772
|
+
Parser::ParseUpdateList(update_list, update_columns, expressions, context.GetContext()->GetParserOptions());
|
|
116628
116773
|
auto update = make_shared<UpdateRelation>(context, move(cond), description->schema, description->table,
|
|
116629
116774
|
move(update_columns), move(expressions));
|
|
116630
116775
|
update->Execute();
|
|
116631
116776
|
}
|
|
116632
116777
|
|
|
116633
116778
|
void TableRelation::Delete(const string &condition) {
|
|
116634
|
-
auto cond = ParseCondition(context, condition);
|
|
116779
|
+
auto cond = ParseCondition(*context.GetContext(), condition);
|
|
116635
116780
|
auto del = make_shared<DeleteRelation>(context, move(cond), description->schema, description->table);
|
|
116636
116781
|
del->Execute();
|
|
116637
116782
|
}
|
|
@@ -116680,13 +116825,13 @@ public:
|
|
|
116680
116825
|
|
|
116681
116826
|
namespace duckdb {
|
|
116682
116827
|
|
|
116683
|
-
UpdateRelation::UpdateRelation(
|
|
116684
|
-
string table_name_p, vector<string> update_columns_p,
|
|
116828
|
+
UpdateRelation::UpdateRelation(ClientContextWrapper &context, unique_ptr<ParsedExpression> condition_p,
|
|
116829
|
+
string schema_name_p, string table_name_p, vector<string> update_columns_p,
|
|
116685
116830
|
vector<unique_ptr<ParsedExpression>> expressions_p)
|
|
116686
116831
|
: Relation(context, RelationType::UPDATE_RELATION), condition(move(condition_p)), schema_name(move(schema_name_p)),
|
|
116687
116832
|
table_name(move(table_name_p)), update_columns(move(update_columns_p)), expressions(move(expressions_p)) {
|
|
116688
116833
|
D_ASSERT(update_columns.size() == expressions.size());
|
|
116689
|
-
context.TryBindRelation(*this, this->columns);
|
|
116834
|
+
context.GetContext()->TryBindRelation(*this, this->columns);
|
|
116690
116835
|
}
|
|
116691
116836
|
|
|
116692
116837
|
BoundStatement UpdateRelation::Bind(Binder &binder) {
|
|
@@ -116730,8 +116875,8 @@ string UpdateRelation::ToString(idx_t depth) {
|
|
|
116730
116875
|
|
|
116731
116876
|
namespace duckdb {
|
|
116732
116877
|
|
|
116733
|
-
ValueRelation::ValueRelation(ClientContext &context, const vector<vector<Value>> &values,
|
|
116734
|
-
string alias_p)
|
|
116878
|
+
ValueRelation::ValueRelation(const std::shared_ptr<ClientContext> &context, const vector<vector<Value>> &values,
|
|
116879
|
+
vector<string> names_p, string alias_p)
|
|
116735
116880
|
: Relation(context, RelationType::VALUE_LIST_RELATION), names(move(names_p)), alias(move(alias_p)) {
|
|
116736
116881
|
// create constant expressions for the values
|
|
116737
116882
|
for (idx_t row_idx = 0; row_idx < values.size(); row_idx++) {
|
|
@@ -116742,13 +116887,14 @@ ValueRelation::ValueRelation(ClientContext &context, const vector<vector<Value>>
|
|
|
116742
116887
|
}
|
|
116743
116888
|
this->expressions.push_back(move(expressions));
|
|
116744
116889
|
}
|
|
116745
|
-
context
|
|
116890
|
+
context->TryBindRelation(*this, this->columns);
|
|
116746
116891
|
}
|
|
116747
116892
|
|
|
116748
|
-
ValueRelation::ValueRelation(ClientContext &context, const string &values_list,
|
|
116893
|
+
ValueRelation::ValueRelation(const std::shared_ptr<ClientContext> &context, const string &values_list,
|
|
116894
|
+
vector<string> names_p, string alias_p)
|
|
116749
116895
|
: Relation(context, RelationType::VALUE_LIST_RELATION), names(move(names_p)), alias(move(alias_p)) {
|
|
116750
|
-
this->expressions = Parser::ParseValuesList(values_list, context
|
|
116751
|
-
context
|
|
116896
|
+
this->expressions = Parser::ParseValuesList(values_list, context->GetParserOptions());
|
|
116897
|
+
context->TryBindRelation(*this, this->columns);
|
|
116752
116898
|
}
|
|
116753
116899
|
|
|
116754
116900
|
unique_ptr<QueryNode> ValueRelation::GetQueryNode() {
|
|
@@ -116819,9 +116965,9 @@ string ValueRelation::ToString(idx_t depth) {
|
|
|
116819
116965
|
|
|
116820
116966
|
namespace duckdb {
|
|
116821
116967
|
|
|
116822
|
-
ViewRelation::ViewRelation(ClientContext &context, string schema_name_p, string view_name_p)
|
|
116968
|
+
ViewRelation::ViewRelation(const std::shared_ptr<ClientContext> &context, string schema_name_p, string view_name_p)
|
|
116823
116969
|
: Relation(context, RelationType::VIEW_RELATION), schema_name(move(schema_name_p)), view_name(move(view_name_p)) {
|
|
116824
|
-
context
|
|
116970
|
+
context->TryBindRelation(*this, this->columns);
|
|
116825
116971
|
}
|
|
116826
116972
|
|
|
116827
116973
|
unique_ptr<QueryNode> ViewRelation::GetQueryNode() {
|
|
@@ -116924,7 +117070,7 @@ namespace duckdb {
|
|
|
116924
117070
|
|
|
116925
117071
|
WriteCSVRelation::WriteCSVRelation(shared_ptr<Relation> child_p, string csv_file_p)
|
|
116926
117072
|
: Relation(child_p->context, RelationType::WRITE_CSV_RELATION), child(move(child_p)), csv_file(move(csv_file_p)) {
|
|
116927
|
-
context.TryBindRelation(*this, this->columns);
|
|
117073
|
+
context.GetContext()->TryBindRelation(*this, this->columns);
|
|
116928
117074
|
}
|
|
116929
117075
|
|
|
116930
117076
|
BoundStatement WriteCSVRelation::Bind(Binder &binder) {
|
|
@@ -116986,7 +117132,7 @@ shared_ptr<Relation> Relation::Project(const string &expression, const string &a
|
|
|
116986
117132
|
}
|
|
116987
117133
|
|
|
116988
117134
|
shared_ptr<Relation> Relation::Project(const string &select_list, const vector<string> &aliases) {
|
|
116989
|
-
auto expressions = Parser::ParseExpressionList(select_list, context.GetParserOptions());
|
|
117135
|
+
auto expressions = Parser::ParseExpressionList(select_list, context.GetContext()->GetParserOptions());
|
|
116990
117136
|
return make_shared<ProjectionRelation>(shared_from_this(), move(expressions), aliases);
|
|
116991
117137
|
}
|
|
116992
117138
|
|
|
@@ -117012,12 +117158,12 @@ static vector<unique_ptr<ParsedExpression>> StringListToExpressionList(ClientCon
|
|
|
117012
117158
|
}
|
|
117013
117159
|
|
|
117014
117160
|
shared_ptr<Relation> Relation::Project(const vector<string> &expressions, const vector<string> &aliases) {
|
|
117015
|
-
auto result_list = StringListToExpressionList(context, expressions);
|
|
117161
|
+
auto result_list = StringListToExpressionList(*context.GetContext(), expressions);
|
|
117016
117162
|
return make_shared<ProjectionRelation>(shared_from_this(), move(result_list), aliases);
|
|
117017
117163
|
}
|
|
117018
117164
|
|
|
117019
117165
|
shared_ptr<Relation> Relation::Filter(const string &expression) {
|
|
117020
|
-
auto expression_list = Parser::ParseExpressionList(expression, context.GetParserOptions());
|
|
117166
|
+
auto expression_list = Parser::ParseExpressionList(expression, context.GetContext()->GetParserOptions());
|
|
117021
117167
|
if (expression_list.size() != 1) {
|
|
117022
117168
|
throw ParserException("Expected a single expression as filter condition");
|
|
117023
117169
|
}
|
|
@@ -117026,7 +117172,7 @@ shared_ptr<Relation> Relation::Filter(const string &expression) {
|
|
|
117026
117172
|
|
|
117027
117173
|
shared_ptr<Relation> Relation::Filter(const vector<string> &expressions) {
|
|
117028
117174
|
// if there are multiple expressions, we AND them together
|
|
117029
|
-
auto expression_list = StringListToExpressionList(context, expressions);
|
|
117175
|
+
auto expression_list = StringListToExpressionList(*context.GetContext(), expressions);
|
|
117030
117176
|
D_ASSERT(!expression_list.empty());
|
|
117031
117177
|
|
|
117032
117178
|
auto expr = move(expression_list[0]);
|
|
@@ -117042,7 +117188,7 @@ shared_ptr<Relation> Relation::Limit(int64_t limit, int64_t offset) {
|
|
|
117042
117188
|
}
|
|
117043
117189
|
|
|
117044
117190
|
shared_ptr<Relation> Relation::Order(const string &expression) {
|
|
117045
|
-
auto order_list = Parser::ParseOrderList(expression, context.GetParserOptions());
|
|
117191
|
+
auto order_list = Parser::ParseOrderList(expression, context.GetContext()->GetParserOptions());
|
|
117046
117192
|
return make_shared<OrderRelation>(shared_from_this(), move(order_list));
|
|
117047
117193
|
}
|
|
117048
117194
|
|
|
@@ -117052,7 +117198,7 @@ shared_ptr<Relation> Relation::Order(const vector<string> &expressions) {
|
|
|
117052
117198
|
}
|
|
117053
117199
|
vector<OrderByNode> order_list;
|
|
117054
117200
|
for (auto &expression : expressions) {
|
|
117055
|
-
auto inner_list = Parser::ParseOrderList(expression, context.GetParserOptions());
|
|
117201
|
+
auto inner_list = Parser::ParseOrderList(expression, context.GetContext()->GetParserOptions());
|
|
117056
117202
|
if (inner_list.size() != 1) {
|
|
117057
117203
|
throw ParserException("Expected a single ORDER BY expression in the expression list");
|
|
117058
117204
|
}
|
|
@@ -117062,7 +117208,7 @@ shared_ptr<Relation> Relation::Order(const vector<string> &expressions) {
|
|
|
117062
117208
|
}
|
|
117063
117209
|
|
|
117064
117210
|
shared_ptr<Relation> Relation::Join(const shared_ptr<Relation> &other, const string &condition, JoinType type) {
|
|
117065
|
-
auto expression_list = Parser::ParseExpressionList(condition, context.GetParserOptions());
|
|
117211
|
+
auto expression_list = Parser::ParseExpressionList(condition, context.GetContext()->GetParserOptions());
|
|
117066
117212
|
D_ASSERT(!expression_list.empty());
|
|
117067
117213
|
|
|
117068
117214
|
if (expression_list.size() > 1 || expression_list[0]->type == ExpressionType::COLUMN_REF) {
|
|
@@ -117110,24 +117256,24 @@ shared_ptr<Relation> Relation::Alias(const string &alias) {
|
|
|
117110
117256
|
}
|
|
117111
117257
|
|
|
117112
117258
|
shared_ptr<Relation> Relation::Aggregate(const string &aggregate_list) {
|
|
117113
|
-
auto expression_list = Parser::ParseExpressionList(aggregate_list, context.GetParserOptions());
|
|
117259
|
+
auto expression_list = Parser::ParseExpressionList(aggregate_list, context.GetContext()->GetParserOptions());
|
|
117114
117260
|
return make_shared<AggregateRelation>(shared_from_this(), move(expression_list));
|
|
117115
117261
|
}
|
|
117116
117262
|
|
|
117117
117263
|
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());
|
|
117264
|
+
auto expression_list = Parser::ParseExpressionList(aggregate_list, context.GetContext()->GetParserOptions());
|
|
117265
|
+
auto groups = Parser::ParseExpressionList(group_list, context.GetContext()->GetParserOptions());
|
|
117120
117266
|
return make_shared<AggregateRelation>(shared_from_this(), move(expression_list), move(groups));
|
|
117121
117267
|
}
|
|
117122
117268
|
|
|
117123
117269
|
shared_ptr<Relation> Relation::Aggregate(const vector<string> &aggregates) {
|
|
117124
|
-
auto aggregate_list = StringListToExpressionList(context, aggregates);
|
|
117270
|
+
auto aggregate_list = StringListToExpressionList(*context.GetContext(), aggregates);
|
|
117125
117271
|
return make_shared<AggregateRelation>(shared_from_this(), move(aggregate_list));
|
|
117126
117272
|
}
|
|
117127
117273
|
|
|
117128
117274
|
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);
|
|
117275
|
+
auto aggregate_list = StringListToExpressionList(*context.GetContext(), aggregates);
|
|
117276
|
+
auto group_list = StringListToExpressionList(*context.GetContext(), groups);
|
|
117131
117277
|
return make_shared<AggregateRelation>(shared_from_this(), move(aggregate_list), move(group_list));
|
|
117132
117278
|
}
|
|
117133
117279
|
|
|
@@ -117142,7 +117288,7 @@ unique_ptr<TableRef> Relation::GetTableRef() {
|
|
|
117142
117288
|
}
|
|
117143
117289
|
|
|
117144
117290
|
unique_ptr<QueryResult> Relation::Execute() {
|
|
117145
|
-
return context.Execute(shared_from_this());
|
|
117291
|
+
return context.GetContext()->Execute(shared_from_this());
|
|
117146
117292
|
}
|
|
117147
117293
|
|
|
117148
117294
|
BoundStatement Relation::Bind(Binder &binder) {
|
|
@@ -117165,7 +117311,7 @@ void Relation::Insert(const string &schema_name, const string &table_name) {
|
|
|
117165
117311
|
|
|
117166
117312
|
void Relation::Insert(const vector<vector<Value>> &values) {
|
|
117167
117313
|
vector<string> column_names;
|
|
117168
|
-
auto rel = make_shared<ValueRelation>(context, values, move(column_names), "values");
|
|
117314
|
+
auto rel = make_shared<ValueRelation>(context.GetContext(), values, move(column_names), "values");
|
|
117169
117315
|
rel->Insert(GetAlias());
|
|
117170
117316
|
}
|
|
117171
117317
|
|
|
@@ -117199,7 +117345,7 @@ shared_ptr<Relation> Relation::CreateView(const string &name, bool replace, bool
|
|
|
117199
117345
|
}
|
|
117200
117346
|
|
|
117201
117347
|
unique_ptr<QueryResult> Relation::Query(const string &sql) {
|
|
117202
|
-
return context.Query(sql, false);
|
|
117348
|
+
return context.GetContext()->Query(sql, false);
|
|
117203
117349
|
}
|
|
117204
117350
|
|
|
117205
117351
|
unique_ptr<QueryResult> Relation::Query(const string &name, const string &sql) {
|
|
@@ -117222,11 +117368,12 @@ void Relation::Delete(const string &condition) {
|
|
|
117222
117368
|
|
|
117223
117369
|
shared_ptr<Relation> Relation::TableFunction(const std::string &fname, const vector<Value> &values,
|
|
117224
117370
|
const named_parameter_map_t &named_parameters) {
|
|
117225
|
-
return make_shared<TableFunctionRelation>(context, fname, values, named_parameters,
|
|
117371
|
+
return make_shared<TableFunctionRelation>(context.GetContext(), fname, values, named_parameters,
|
|
117372
|
+
shared_from_this());
|
|
117226
117373
|
}
|
|
117227
117374
|
|
|
117228
117375
|
shared_ptr<Relation> Relation::TableFunction(const std::string &fname, const vector<Value> &values) {
|
|
117229
|
-
return make_shared<TableFunctionRelation>(context, fname, values, shared_from_this());
|
|
117376
|
+
return make_shared<TableFunctionRelation>(context.GetContext(), fname, values, shared_from_this());
|
|
117230
117377
|
}
|
|
117231
117378
|
|
|
117232
117379
|
string Relation::ToString() {
|