duckdb 0.3.5-dev230.0 → 0.3.5-dev242.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 +178 -109
- package/src/duckdb.hpp +23 -9
- package/src/parquet-amalgamation.cpp +25118 -25118
package/src/duckdb.cpp
CHANGED
|
@@ -70264,11 +70264,10 @@ namespace duckdb {
|
|
|
70264
70264
|
|
|
70265
70265
|
class TableInOutFunctionState : public OperatorState {
|
|
70266
70266
|
public:
|
|
70267
|
-
TableInOutFunctionState()
|
|
70267
|
+
TableInOutFunctionState() {
|
|
70268
70268
|
}
|
|
70269
70269
|
|
|
70270
70270
|
unique_ptr<FunctionOperatorData> operator_data;
|
|
70271
|
-
bool initialized = false;
|
|
70272
70271
|
};
|
|
70273
70272
|
|
|
70274
70273
|
PhysicalTableInOutFunction::PhysicalTableInOutFunction(vector<LogicalType> types, TableFunction function_p,
|
|
@@ -70279,22 +70278,17 @@ PhysicalTableInOutFunction::PhysicalTableInOutFunction(vector<LogicalType> types
|
|
|
70279
70278
|
}
|
|
70280
70279
|
|
|
70281
70280
|
unique_ptr<OperatorState> PhysicalTableInOutFunction::GetOperatorState(ClientContext &context) const {
|
|
70282
|
-
|
|
70281
|
+
auto result = make_unique<TableInOutFunctionState>();
|
|
70282
|
+
if (function.init) {
|
|
70283
|
+
result->operator_data = function.init(context, bind_data.get(), column_ids, nullptr);
|
|
70284
|
+
}
|
|
70285
|
+
return move(result);
|
|
70283
70286
|
}
|
|
70284
70287
|
|
|
70285
70288
|
OperatorResultType PhysicalTableInOutFunction::Execute(ExecutionContext &context, DataChunk &input, DataChunk &chunk,
|
|
70286
70289
|
GlobalOperatorState &gstate, OperatorState &state_p) const {
|
|
70287
70290
|
auto &state = (TableInOutFunctionState &)state_p;
|
|
70288
|
-
|
|
70289
|
-
if (!state.initialized) {
|
|
70290
|
-
if (function.init) {
|
|
70291
|
-
state.operator_data = function.init(context.client, bind_data.get(), column_ids, nullptr);
|
|
70292
|
-
}
|
|
70293
|
-
state.initialized = true;
|
|
70294
|
-
}
|
|
70295
|
-
|
|
70296
|
-
function.function(context.client, bind_data.get(), state.operator_data.get(), &input, chunk);
|
|
70297
|
-
return OperatorResultType::NEED_MORE_INPUT;
|
|
70291
|
+
return function.in_out_function(context.client, bind_data.get(), state.operator_data.get(), input, chunk);
|
|
70298
70292
|
}
|
|
70299
70293
|
|
|
70300
70294
|
} // namespace duckdb
|
|
@@ -70320,7 +70314,7 @@ public:
|
|
|
70320
70314
|
PhysicalUnnest(vector<LogicalType> types, vector<unique_ptr<Expression>> select_list, idx_t estimated_cardinality,
|
|
70321
70315
|
PhysicalOperatorType type = PhysicalOperatorType::UNNEST);
|
|
70322
70316
|
|
|
70323
|
-
//! The projection list of the
|
|
70317
|
+
//! The projection list of the UNNEST
|
|
70324
70318
|
vector<unique_ptr<Expression>> select_list;
|
|
70325
70319
|
|
|
70326
70320
|
public:
|
|
@@ -70331,6 +70325,12 @@ public:
|
|
|
70331
70325
|
bool ParallelOperator() const override {
|
|
70332
70326
|
return true;
|
|
70333
70327
|
}
|
|
70328
|
+
|
|
70329
|
+
public:
|
|
70330
|
+
static unique_ptr<OperatorState> GetState(ClientContext &context);
|
|
70331
|
+
static OperatorResultType ExecuteInternal(ClientContext &context, DataChunk &input, DataChunk &chunk,
|
|
70332
|
+
OperatorState &state, const vector<unique_ptr<Expression>> &select_list,
|
|
70333
|
+
bool include_input = true);
|
|
70334
70334
|
};
|
|
70335
70335
|
|
|
70336
70336
|
} // namespace duckdb
|
|
@@ -70344,7 +70344,6 @@ public:
|
|
|
70344
70344
|
|
|
70345
70345
|
namespace duckdb {
|
|
70346
70346
|
|
|
70347
|
-
//! The operator state of the window
|
|
70348
70347
|
class UnnestOperatorState : public OperatorState {
|
|
70349
70348
|
public:
|
|
70350
70349
|
UnnestOperatorState() : parent_position(0), list_position(0), list_length(-1), first_fetch(true) {
|
|
@@ -70482,11 +70481,17 @@ static void UnnestVector(VectorData &vdata, Vector &source, idx_t list_size, idx
|
|
|
70482
70481
|
}
|
|
70483
70482
|
|
|
70484
70483
|
unique_ptr<OperatorState> PhysicalUnnest::GetOperatorState(ClientContext &context) const {
|
|
70484
|
+
return PhysicalUnnest::GetState(context);
|
|
70485
|
+
}
|
|
70486
|
+
|
|
70487
|
+
unique_ptr<OperatorState> PhysicalUnnest::GetState(ClientContext &context) {
|
|
70485
70488
|
return make_unique<UnnestOperatorState>();
|
|
70486
70489
|
}
|
|
70487
70490
|
|
|
70488
|
-
OperatorResultType PhysicalUnnest::
|
|
70489
|
-
|
|
70491
|
+
OperatorResultType PhysicalUnnest::ExecuteInternal(ClientContext &context, DataChunk &input, DataChunk &chunk,
|
|
70492
|
+
OperatorState &state_p,
|
|
70493
|
+
const vector<unique_ptr<Expression>> &select_list,
|
|
70494
|
+
bool include_input) {
|
|
70490
70495
|
auto &state = (UnnestOperatorState &)state_p;
|
|
70491
70496
|
do {
|
|
70492
70497
|
if (state.first_fetch) {
|
|
@@ -70565,12 +70570,17 @@ OperatorResultType PhysicalUnnest::Execute(ExecutionContext &context, DataChunk
|
|
|
70565
70570
|
// first cols are from child, last n cols from unnest
|
|
70566
70571
|
chunk.SetCardinality(this_chunk_len);
|
|
70567
70572
|
|
|
70568
|
-
|
|
70569
|
-
|
|
70573
|
+
idx_t output_offset = 0;
|
|
70574
|
+
if (include_input) {
|
|
70575
|
+
for (idx_t col_idx = 0; col_idx < input.ColumnCount(); col_idx++) {
|
|
70576
|
+
ConstantVector::Reference(chunk.data[col_idx], input.data[col_idx], state.parent_position,
|
|
70577
|
+
input.size());
|
|
70578
|
+
}
|
|
70579
|
+
output_offset = input.ColumnCount();
|
|
70570
70580
|
}
|
|
70571
70581
|
|
|
70572
70582
|
for (idx_t col_idx = 0; col_idx < state.list_data.ColumnCount(); col_idx++) {
|
|
70573
|
-
auto &result_vector = chunk.data[col_idx +
|
|
70583
|
+
auto &result_vector = chunk.data[col_idx + output_offset];
|
|
70574
70584
|
|
|
70575
70585
|
if (state.list_data.data[col_idx].GetType() == LogicalType::SQLNULL) {
|
|
70576
70586
|
// UNNEST(NULL)
|
|
@@ -70620,6 +70630,11 @@ OperatorResultType PhysicalUnnest::Execute(ExecutionContext &context, DataChunk
|
|
|
70620
70630
|
return OperatorResultType::HAVE_MORE_OUTPUT;
|
|
70621
70631
|
}
|
|
70622
70632
|
|
|
70633
|
+
OperatorResultType PhysicalUnnest::Execute(ExecutionContext &context, DataChunk &input, DataChunk &chunk,
|
|
70634
|
+
GlobalOperatorState &gstate, OperatorState &state) const {
|
|
70635
|
+
return ExecuteInternal(context.client, input, chunk, state, select_list);
|
|
70636
|
+
}
|
|
70637
|
+
|
|
70623
70638
|
} // namespace duckdb
|
|
70624
70639
|
|
|
70625
70640
|
|
|
@@ -70930,7 +70945,7 @@ void PhysicalTableScan::GetData(ExecutionContext &context, DataChunk &chunk, Glo
|
|
|
70930
70945
|
|
|
70931
70946
|
if (!gstate.parallel_state) {
|
|
70932
70947
|
// sequential scan
|
|
70933
|
-
function.function(context.client, bind_data.get(), state.operator_data.get(),
|
|
70948
|
+
function.function(context.client, bind_data.get(), state.operator_data.get(), chunk);
|
|
70934
70949
|
if (chunk.size() != 0) {
|
|
70935
70950
|
return;
|
|
70936
70951
|
}
|
|
@@ -70938,10 +70953,10 @@ void PhysicalTableScan::GetData(ExecutionContext &context, DataChunk &chunk, Glo
|
|
|
70938
70953
|
// parallel scan
|
|
70939
70954
|
do {
|
|
70940
70955
|
if (function.parallel_function) {
|
|
70941
|
-
function.parallel_function(context.client, bind_data.get(), state.operator_data.get(),
|
|
70956
|
+
function.parallel_function(context.client, bind_data.get(), state.operator_data.get(), chunk,
|
|
70942
70957
|
gstate.parallel_state.get());
|
|
70943
70958
|
} else {
|
|
70944
|
-
function.function(context.client, bind_data.get(), state.operator_data.get(),
|
|
70959
|
+
function.function(context.client, bind_data.get(), state.operator_data.get(), chunk);
|
|
70945
70960
|
}
|
|
70946
70961
|
|
|
70947
70962
|
if (chunk.size() == 0) {
|
|
@@ -72490,6 +72505,7 @@ void PerfectAggregateHashTable::Destroy() {
|
|
|
72490
72505
|
|
|
72491
72506
|
|
|
72492
72507
|
|
|
72508
|
+
|
|
72493
72509
|
namespace duckdb {
|
|
72494
72510
|
|
|
72495
72511
|
string PhysicalOperator::GetName() const {
|
|
@@ -101682,7 +101698,7 @@ private:
|
|
|
101682
101698
|
|
|
101683
101699
|
//! Scan Function for Single Thread Execution
|
|
101684
101700
|
static void ArrowScanFunction(ClientContext &context, const FunctionData *bind_data,
|
|
101685
|
-
FunctionOperatorData *operator_state, DataChunk
|
|
101701
|
+
FunctionOperatorData *operator_state, DataChunk &output);
|
|
101686
101702
|
|
|
101687
101703
|
//! -----Multi Thread Functions:-----
|
|
101688
101704
|
//! Initialize Parallel State
|
|
@@ -101698,7 +101714,7 @@ private:
|
|
|
101698
101714
|
static idx_t ArrowScanMaxThreads(ClientContext &context, const FunctionData *bind_data_p);
|
|
101699
101715
|
//! Scan Function for Parallel Execution
|
|
101700
101716
|
static void ArrowScanFunctionParallel(ClientContext &context, const FunctionData *bind_data,
|
|
101701
|
-
FunctionOperatorData *operator_state, DataChunk
|
|
101717
|
+
FunctionOperatorData *operator_state, DataChunk &output,
|
|
101702
101718
|
ParallelState *parallel_state_p);
|
|
101703
101719
|
//! Get next chunk for the running thread
|
|
101704
101720
|
static bool ArrowScanParallelStateNext(ClientContext &context, const FunctionData *bind_data_p,
|
|
@@ -102691,7 +102707,7 @@ void ArrowTableFunction::ArrowToDuckDB(ArrowScanState &scan_state,
|
|
|
102691
102707
|
}
|
|
102692
102708
|
|
|
102693
102709
|
void ArrowTableFunction::ArrowScanFunction(ClientContext &context, const FunctionData *bind_data,
|
|
102694
|
-
FunctionOperatorData *operator_state, DataChunk
|
|
102710
|
+
FunctionOperatorData *operator_state, DataChunk &output) {
|
|
102695
102711
|
|
|
102696
102712
|
auto &data = (ArrowScanFunctionData &)*bind_data;
|
|
102697
102713
|
auto &state = (ArrowScanState &)*operator_state;
|
|
@@ -102716,8 +102732,8 @@ void ArrowTableFunction::ArrowScanFunction(ClientContext &context, const Functio
|
|
|
102716
102732
|
}
|
|
102717
102733
|
|
|
102718
102734
|
void ArrowTableFunction::ArrowScanFunctionParallel(ClientContext &context, const FunctionData *bind_data,
|
|
102719
|
-
FunctionOperatorData *operator_state, DataChunk
|
|
102720
|
-
|
|
102735
|
+
FunctionOperatorData *operator_state, DataChunk &output,
|
|
102736
|
+
ParallelState *parallel_state_p) {
|
|
102721
102737
|
auto &data = (ArrowScanFunctionData &)*bind_data;
|
|
102722
102738
|
auto &state = (ArrowScanState &)*operator_state;
|
|
102723
102739
|
//! Out of tuples in this chunk
|
|
@@ -102861,7 +102877,7 @@ static unique_ptr<FunctionData> CheckpointBind(ClientContext &context, TableFunc
|
|
|
102861
102877
|
|
|
102862
102878
|
template <bool FORCE>
|
|
102863
102879
|
static void TemplatedCheckpointFunction(ClientContext &context, const FunctionData *bind_data_p,
|
|
102864
|
-
FunctionOperatorData *operator_state, DataChunk
|
|
102880
|
+
FunctionOperatorData *operator_state, DataChunk &output) {
|
|
102865
102881
|
auto &transaction_manager = TransactionManager::Get(context);
|
|
102866
102882
|
transaction_manager.Checkpoint(context, FORCE);
|
|
102867
102883
|
}
|
|
@@ -103375,7 +103391,7 @@ static unique_ptr<FunctionOperatorData> GlobFunctionInit(ClientContext &context,
|
|
|
103375
103391
|
}
|
|
103376
103392
|
|
|
103377
103393
|
static void GlobFunction(ClientContext &context, const FunctionData *bind_data_p, FunctionOperatorData *state_p,
|
|
103378
|
-
DataChunk
|
|
103394
|
+
DataChunk &output) {
|
|
103379
103395
|
auto &bind_data = (GlobFunctionBindData &)*bind_data_p;
|
|
103380
103396
|
auto &state = (GlobFunctionState &)*state_p;
|
|
103381
103397
|
|
|
@@ -103607,8 +103623,7 @@ static void ExtractFunctions(ChunkCollection &collection, ExpressionInfo &info,
|
|
|
103607
103623
|
}
|
|
103608
103624
|
|
|
103609
103625
|
static void PragmaDetailedProfilingOutputFunction(ClientContext &context, const FunctionData *bind_data_p,
|
|
103610
|
-
FunctionOperatorData *operator_state, DataChunk
|
|
103611
|
-
DataChunk &output) {
|
|
103626
|
+
FunctionOperatorData *operator_state, DataChunk &output) {
|
|
103612
103627
|
auto &state = (PragmaDetailedProfilingOutputOperatorData &)*operator_state;
|
|
103613
103628
|
auto &data = (PragmaDetailedProfilingOutputData &)*bind_data_p;
|
|
103614
103629
|
|
|
@@ -103736,8 +103751,7 @@ unique_ptr<FunctionOperatorData> PragmaLastProfilingOutputInit(ClientContext &co
|
|
|
103736
103751
|
}
|
|
103737
103752
|
|
|
103738
103753
|
static void PragmaLastProfilingOutputFunction(ClientContext &context, const FunctionData *bind_data_p,
|
|
103739
|
-
FunctionOperatorData *operator_state, DataChunk
|
|
103740
|
-
DataChunk &output) {
|
|
103754
|
+
FunctionOperatorData *operator_state, DataChunk &output) {
|
|
103741
103755
|
auto &state = (PragmaLastProfilingOutputOperatorData &)*operator_state;
|
|
103742
103756
|
auto &data = (PragmaLastProfilingOutputData &)*bind_data_p;
|
|
103743
103757
|
if (!state.initialized) {
|
|
@@ -103876,7 +103890,7 @@ static unique_ptr<FunctionOperatorData> RangeFunctionInit(ClientContext &context
|
|
|
103876
103890
|
}
|
|
103877
103891
|
|
|
103878
103892
|
static void RangeFunction(ClientContext &context, const FunctionData *bind_data_p, FunctionOperatorData *state_p,
|
|
103879
|
-
DataChunk
|
|
103893
|
+
DataChunk &output) {
|
|
103880
103894
|
auto &bind_data = (RangeFunctionBindData &)*bind_data_p;
|
|
103881
103895
|
auto &state = (RangeFunctionState &)*state_p;
|
|
103882
103896
|
|
|
@@ -103995,7 +104009,7 @@ static unique_ptr<FunctionOperatorData> RangeDateTimeInit(ClientContext &context
|
|
|
103995
104009
|
}
|
|
103996
104010
|
|
|
103997
104011
|
static void RangeDateTimeFunction(ClientContext &context, const FunctionData *bind_data_p,
|
|
103998
|
-
FunctionOperatorData *state_p, DataChunk
|
|
104012
|
+
FunctionOperatorData *state_p, DataChunk &output) {
|
|
103999
104013
|
auto &bind_data = (RangeDateTimeBindData &)*bind_data_p;
|
|
104000
104014
|
auto &state = (RangeDateTimeState &)*state_p;
|
|
104001
104015
|
if (state.finished) {
|
|
@@ -104180,7 +104194,7 @@ static unique_ptr<FunctionData> ReadCSVAutoBind(ClientContext &context, TableFun
|
|
|
104180
104194
|
}
|
|
104181
104195
|
|
|
104182
104196
|
static void ReadCSVFunction(ClientContext &context, const FunctionData *bind_data_p,
|
|
104183
|
-
FunctionOperatorData *operator_state, DataChunk
|
|
104197
|
+
FunctionOperatorData *operator_state, DataChunk &output) {
|
|
104184
104198
|
auto &bind_data = (ReadCSVData &)*bind_data_p;
|
|
104185
104199
|
auto &data = (ReadCSVOperatorData &)*operator_state;
|
|
104186
104200
|
do {
|
|
@@ -104313,7 +104327,7 @@ static unique_ptr<FunctionOperatorData> RepeatInit(ClientContext &context, const
|
|
|
104313
104327
|
}
|
|
104314
104328
|
|
|
104315
104329
|
static void RepeatFunction(ClientContext &context, const FunctionData *bind_data_p,
|
|
104316
|
-
FunctionOperatorData *operator_state, DataChunk
|
|
104330
|
+
FunctionOperatorData *operator_state, DataChunk &output) {
|
|
104317
104331
|
auto &bind_data = (RepeatFunctionData &)*bind_data_p;
|
|
104318
104332
|
auto &state = (RepeatOperatorData &)*operator_state;
|
|
104319
104333
|
|
|
@@ -104358,32 +104372,32 @@ static unique_ptr<FunctionData> SummaryFunctionBind(ClientContext &context, Tabl
|
|
|
104358
104372
|
return make_unique<TableFunctionData>();
|
|
104359
104373
|
}
|
|
104360
104374
|
|
|
104361
|
-
static
|
|
104362
|
-
|
|
104363
|
-
|
|
104364
|
-
output.SetCardinality(input->size());
|
|
104375
|
+
static OperatorResultType SummaryFunction(ClientContext &context, const FunctionData *bind_data_p,
|
|
104376
|
+
FunctionOperatorData *state_p, DataChunk &input, DataChunk &output) {
|
|
104377
|
+
output.SetCardinality(input.size());
|
|
104365
104378
|
|
|
104366
|
-
for (idx_t row_idx = 0; row_idx < input
|
|
104379
|
+
for (idx_t row_idx = 0; row_idx < input.size(); row_idx++) {
|
|
104367
104380
|
string summary_val = "[";
|
|
104368
104381
|
|
|
104369
|
-
for (idx_t col_idx = 0; col_idx < input
|
|
104370
|
-
summary_val += input
|
|
104371
|
-
if (col_idx < input
|
|
104382
|
+
for (idx_t col_idx = 0; col_idx < input.ColumnCount(); col_idx++) {
|
|
104383
|
+
summary_val += input.GetValue(col_idx, row_idx).ToString();
|
|
104384
|
+
if (col_idx < input.ColumnCount() - 1) {
|
|
104372
104385
|
summary_val += ", ";
|
|
104373
104386
|
}
|
|
104374
104387
|
}
|
|
104375
104388
|
summary_val += "]";
|
|
104376
104389
|
output.SetValue(0, row_idx, Value(summary_val));
|
|
104377
104390
|
}
|
|
104378
|
-
for (idx_t col_idx = 0; col_idx < input
|
|
104379
|
-
output.data[col_idx + 1].Reference(input
|
|
104391
|
+
for (idx_t col_idx = 0; col_idx < input.ColumnCount(); col_idx++) {
|
|
104392
|
+
output.data[col_idx + 1].Reference(input.data[col_idx]);
|
|
104380
104393
|
}
|
|
104394
|
+
return OperatorResultType::NEED_MORE_INPUT;
|
|
104381
104395
|
}
|
|
104382
104396
|
|
|
104383
104397
|
void SummaryTableFunction::RegisterFunction(BuiltinFunctions &set) {
|
|
104384
|
-
|
|
104385
|
-
|
|
104386
|
-
set.AddFunction(
|
|
104398
|
+
TableFunction summary_function("summary", {LogicalType::TABLE}, nullptr, SummaryFunctionBind);
|
|
104399
|
+
summary_function.in_out_function = SummaryFunction;
|
|
104400
|
+
set.AddFunction(summary_function);
|
|
104387
104401
|
}
|
|
104388
104402
|
|
|
104389
104403
|
} // namespace duckdb
|
|
@@ -104670,7 +104684,7 @@ void ColumnHelper::WriteColumns(idx_t start_index, idx_t start_col, idx_t end_co
|
|
|
104670
104684
|
} // anonymous namespace
|
|
104671
104685
|
|
|
104672
104686
|
void DuckDBColumnsFunction(ClientContext &context, const FunctionData *bind_data, FunctionOperatorData *operator_state,
|
|
104673
|
-
DataChunk
|
|
104687
|
+
DataChunk &output) {
|
|
104674
104688
|
auto &data = (DuckDBColumnsData &)*operator_state;
|
|
104675
104689
|
if (data.offset >= data.entries.size()) {
|
|
104676
104690
|
// finished returning values
|
|
@@ -104799,7 +104813,7 @@ unique_ptr<FunctionOperatorData> DuckDBConstraintsInit(ClientContext &context, c
|
|
|
104799
104813
|
}
|
|
104800
104814
|
|
|
104801
104815
|
void DuckDBConstraintsFunction(ClientContext &context, const FunctionData *bind_data,
|
|
104802
|
-
FunctionOperatorData *operator_state, DataChunk
|
|
104816
|
+
FunctionOperatorData *operator_state, DataChunk &output) {
|
|
104803
104817
|
auto &data = (DuckDBConstraintsData &)*operator_state;
|
|
104804
104818
|
if (data.offset >= data.entries.size()) {
|
|
104805
104819
|
// finished returning values
|
|
@@ -104997,7 +105011,7 @@ unique_ptr<FunctionOperatorData> DuckDBDependenciesInit(ClientContext &context,
|
|
|
104997
105011
|
}
|
|
104998
105012
|
|
|
104999
105013
|
void DuckDBDependenciesFunction(ClientContext &context, const FunctionData *bind_data,
|
|
105000
|
-
FunctionOperatorData *operator_state, DataChunk
|
|
105014
|
+
FunctionOperatorData *operator_state, DataChunk &output) {
|
|
105001
105015
|
auto &data = (DuckDBDependenciesData &)*operator_state;
|
|
105002
105016
|
if (data.offset >= data.entries.size()) {
|
|
105003
105017
|
// finished returning values
|
|
@@ -105493,7 +105507,7 @@ bool ExtractFunctionData(StandardEntry *entry, idx_t function_idx, DataChunk &ou
|
|
|
105493
105507
|
}
|
|
105494
105508
|
|
|
105495
105509
|
void DuckDBFunctionsFunction(ClientContext &context, const FunctionData *bind_data,
|
|
105496
|
-
FunctionOperatorData *operator_state, DataChunk
|
|
105510
|
+
FunctionOperatorData *operator_state, DataChunk &output) {
|
|
105497
105511
|
auto &data = (DuckDBFunctionsData &)*operator_state;
|
|
105498
105512
|
if (data.offset >= data.entries.size()) {
|
|
105499
105513
|
// finished returning values
|
|
@@ -105627,7 +105641,7 @@ unique_ptr<FunctionOperatorData> DuckDBIndexesInit(ClientContext &context, const
|
|
|
105627
105641
|
}
|
|
105628
105642
|
|
|
105629
105643
|
void DuckDBIndexesFunction(ClientContext &context, const FunctionData *bind_data, FunctionOperatorData *operator_state,
|
|
105630
|
-
DataChunk
|
|
105644
|
+
DataChunk &output) {
|
|
105631
105645
|
auto &data = (DuckDBIndexesData &)*operator_state;
|
|
105632
105646
|
if (data.offset >= data.entries.size()) {
|
|
105633
105647
|
// finished returning values
|
|
@@ -105712,7 +105726,7 @@ unique_ptr<FunctionOperatorData> DuckDBKeywordsInit(ClientContext &context, cons
|
|
|
105712
105726
|
}
|
|
105713
105727
|
|
|
105714
105728
|
void DuckDBKeywordsFunction(ClientContext &context, const FunctionData *bind_data, FunctionOperatorData *operator_state,
|
|
105715
|
-
DataChunk
|
|
105729
|
+
DataChunk &output) {
|
|
105716
105730
|
auto &data = (DuckDBKeywordsData &)*operator_state;
|
|
105717
105731
|
if (data.offset >= data.entries.size()) {
|
|
105718
105732
|
// finished returning values
|
|
@@ -105806,7 +105820,7 @@ unique_ptr<FunctionOperatorData> DuckDBSchemasInit(ClientContext &context, const
|
|
|
105806
105820
|
}
|
|
105807
105821
|
|
|
105808
105822
|
void DuckDBSchemasFunction(ClientContext &context, const FunctionData *bind_data, FunctionOperatorData *operator_state,
|
|
105809
|
-
DataChunk
|
|
105823
|
+
DataChunk &output) {
|
|
105810
105824
|
auto &data = (DuckDBSchemasData &)*operator_state;
|
|
105811
105825
|
if (data.offset >= data.entries.size()) {
|
|
105812
105826
|
// finished returning values
|
|
@@ -105918,7 +105932,7 @@ unique_ptr<FunctionOperatorData> DuckDBSequencesInit(ClientContext &context, con
|
|
|
105918
105932
|
}
|
|
105919
105933
|
|
|
105920
105934
|
void DuckDBSequencesFunction(ClientContext &context, const FunctionData *bind_data,
|
|
105921
|
-
FunctionOperatorData *operator_state, DataChunk
|
|
105935
|
+
FunctionOperatorData *operator_state, DataChunk &output) {
|
|
105922
105936
|
auto &data = (DuckDBSequencesData &)*operator_state;
|
|
105923
105937
|
if (data.offset >= data.entries.size()) {
|
|
105924
105938
|
// finished returning values
|
|
@@ -106043,7 +106057,7 @@ unique_ptr<FunctionOperatorData> DuckDBSettingsInit(ClientContext &context, cons
|
|
|
106043
106057
|
}
|
|
106044
106058
|
|
|
106045
106059
|
void DuckDBSettingsFunction(ClientContext &context, const FunctionData *bind_data, FunctionOperatorData *operator_state,
|
|
106046
|
-
DataChunk
|
|
106060
|
+
DataChunk &output) {
|
|
106047
106061
|
auto &data = (DuckDBSettingsData &)*operator_state;
|
|
106048
106062
|
if (data.offset >= data.settings.size()) {
|
|
106049
106063
|
// finished returning values
|
|
@@ -106177,7 +106191,7 @@ static idx_t CheckConstraintCount(TableCatalogEntry &table) {
|
|
|
106177
106191
|
}
|
|
106178
106192
|
|
|
106179
106193
|
void DuckDBTablesFunction(ClientContext &context, const FunctionData *bind_data, FunctionOperatorData *operator_state,
|
|
106180
|
-
DataChunk
|
|
106194
|
+
DataChunk &output) {
|
|
106181
106195
|
auto &data = (DuckDBTablesData &)*operator_state;
|
|
106182
106196
|
if (data.offset >= data.entries.size()) {
|
|
106183
106197
|
// finished returning values
|
|
@@ -106283,7 +106297,7 @@ unique_ptr<FunctionOperatorData> DuckDBTypesInit(ClientContext &context, const F
|
|
|
106283
106297
|
}
|
|
106284
106298
|
|
|
106285
106299
|
void DuckDBTypesFunction(ClientContext &context, const FunctionData *bind_data, FunctionOperatorData *operator_state,
|
|
106286
|
-
DataChunk
|
|
106300
|
+
DataChunk &output) {
|
|
106287
106301
|
auto &data = (DuckDBTypesData &)*operator_state;
|
|
106288
106302
|
if (data.offset >= data.types.size()) {
|
|
106289
106303
|
// finished returning values
|
|
@@ -106430,7 +106444,7 @@ unique_ptr<FunctionOperatorData> DuckDBViewsInit(ClientContext &context, const F
|
|
|
106430
106444
|
}
|
|
106431
106445
|
|
|
106432
106446
|
void DuckDBViewsFunction(ClientContext &context, const FunctionData *bind_data, FunctionOperatorData *operator_state,
|
|
106433
|
-
DataChunk
|
|
106447
|
+
DataChunk &output) {
|
|
106434
106448
|
auto &data = (DuckDBViewsData &)*operator_state;
|
|
106435
106449
|
if (data.offset >= data.entries.size()) {
|
|
106436
106450
|
// finished returning values
|
|
@@ -106514,7 +106528,7 @@ unique_ptr<FunctionOperatorData> PragmaCollateInit(ClientContext &context, const
|
|
|
106514
106528
|
}
|
|
106515
106529
|
|
|
106516
106530
|
static void PragmaCollateFunction(ClientContext &context, const FunctionData *bind_data,
|
|
106517
|
-
FunctionOperatorData *operator_state, DataChunk
|
|
106531
|
+
FunctionOperatorData *operator_state, DataChunk &output) {
|
|
106518
106532
|
auto &data = (PragmaCollateData &)*operator_state;
|
|
106519
106533
|
if (data.offset >= data.entries.size()) {
|
|
106520
106534
|
// finished returning values
|
|
@@ -106570,7 +106584,7 @@ unique_ptr<FunctionOperatorData> PragmaDatabaseListInit(ClientContext &context,
|
|
|
106570
106584
|
}
|
|
106571
106585
|
|
|
106572
106586
|
void PragmaDatabaseListFunction(ClientContext &context, const FunctionData *bind_data,
|
|
106573
|
-
FunctionOperatorData *operator_state, DataChunk
|
|
106587
|
+
FunctionOperatorData *operator_state, DataChunk &output) {
|
|
106574
106588
|
auto &data = (PragmaDatabaseListData &)*operator_state;
|
|
106575
106589
|
if (data.finished) {
|
|
106576
106590
|
return;
|
|
@@ -106643,7 +106657,7 @@ unique_ptr<FunctionOperatorData> PragmaDatabaseSizeInit(ClientContext &context,
|
|
|
106643
106657
|
}
|
|
106644
106658
|
|
|
106645
106659
|
void PragmaDatabaseSizeFunction(ClientContext &context, const FunctionData *bind_data,
|
|
106646
|
-
FunctionOperatorData *operator_state, DataChunk
|
|
106660
|
+
FunctionOperatorData *operator_state, DataChunk &output) {
|
|
106647
106661
|
auto &data = (PragmaDatabaseSizeData &)*operator_state;
|
|
106648
106662
|
if (data.finished) {
|
|
106649
106663
|
return;
|
|
@@ -106766,7 +106780,7 @@ void AddFunction(BaseScalarFunction &f, idx_t &count, DataChunk &output, bool is
|
|
|
106766
106780
|
}
|
|
106767
106781
|
|
|
106768
106782
|
static void PragmaFunctionsFunction(ClientContext &context, const FunctionData *bind_data,
|
|
106769
|
-
FunctionOperatorData *operator_state, DataChunk
|
|
106783
|
+
FunctionOperatorData *operator_state, DataChunk &output) {
|
|
106770
106784
|
auto &data = (PragmaFunctionsData &)*operator_state;
|
|
106771
106785
|
if (data.offset >= data.entries.size()) {
|
|
106772
106786
|
// finished returning values
|
|
@@ -106908,7 +106922,7 @@ unique_ptr<FunctionOperatorData> PragmaStorageInfoInit(ClientContext &context, c
|
|
|
106908
106922
|
}
|
|
106909
106923
|
|
|
106910
106924
|
static void PragmaStorageInfoFunction(ClientContext &context, const FunctionData *bind_data_p,
|
|
106911
|
-
FunctionOperatorData *operator_state, DataChunk
|
|
106925
|
+
FunctionOperatorData *operator_state, DataChunk &output) {
|
|
106912
106926
|
auto &bind_data = (PragmaStorageFunctionData &)*bind_data_p;
|
|
106913
106927
|
auto &data = (PragmaStorageOperatorData &)*operator_state;
|
|
106914
106928
|
idx_t count = 0;
|
|
@@ -107095,7 +107109,7 @@ static void PragmaTableInfoView(PragmaTableOperatorData &data, ViewCatalogEntry
|
|
|
107095
107109
|
}
|
|
107096
107110
|
|
|
107097
107111
|
static void PragmaTableInfoFunction(ClientContext &context, const FunctionData *bind_data_p,
|
|
107098
|
-
FunctionOperatorData *operator_state, DataChunk
|
|
107112
|
+
FunctionOperatorData *operator_state, DataChunk &output) {
|
|
107099
107113
|
auto &bind_data = (PragmaTableFunctionData &)*bind_data_p;
|
|
107100
107114
|
auto &state = (PragmaTableOperatorData &)*operator_state;
|
|
107101
107115
|
switch (bind_data.entry->type) {
|
|
@@ -107320,7 +107334,7 @@ unique_ptr<FunctionOperatorData> TestAllTypesInit(ClientContext &context, const
|
|
|
107320
107334
|
}
|
|
107321
107335
|
|
|
107322
107336
|
void TestAllTypesFunction(ClientContext &context, const FunctionData *bind_data, FunctionOperatorData *operator_state,
|
|
107323
|
-
DataChunk
|
|
107337
|
+
DataChunk &output) {
|
|
107324
107338
|
auto &data = (TestAllTypesData &)*operator_state;
|
|
107325
107339
|
if (data.offset >= data.entries.size()) {
|
|
107326
107340
|
// finished returning values
|
|
@@ -107529,7 +107543,7 @@ static unique_ptr<FunctionOperatorData> TableScanParallelInit(ClientContext &con
|
|
|
107529
107543
|
}
|
|
107530
107544
|
|
|
107531
107545
|
static void TableScanFunc(ClientContext &context, const FunctionData *bind_data_p, FunctionOperatorData *operator_state,
|
|
107532
|
-
DataChunk
|
|
107546
|
+
DataChunk &output) {
|
|
107533
107547
|
D_ASSERT(bind_data_p);
|
|
107534
107548
|
D_ASSERT(operator_state);
|
|
107535
107549
|
auto &bind_data = (TableScanBindData &)*bind_data_p;
|
|
@@ -107636,7 +107650,7 @@ static unique_ptr<FunctionOperatorData> IndexScanInit(ClientContext &context, co
|
|
|
107636
107650
|
}
|
|
107637
107651
|
|
|
107638
107652
|
static void IndexScanFunction(ClientContext &context, const FunctionData *bind_data_p,
|
|
107639
|
-
FunctionOperatorData *operator_state, DataChunk
|
|
107653
|
+
FunctionOperatorData *operator_state, DataChunk &output) {
|
|
107640
107654
|
auto &bind_data = (const TableScanBindData &)*bind_data_p;
|
|
107641
107655
|
auto &state = (IndexScanOperatorData &)*operator_state;
|
|
107642
107656
|
auto &transaction = Transaction::GetTransaction(context);
|
|
@@ -107840,51 +107854,67 @@ TableCatalogEntry *TableScanFunction::GetTableEntry(const TableFunction &functio
|
|
|
107840
107854
|
|
|
107841
107855
|
|
|
107842
107856
|
|
|
107857
|
+
|
|
107858
|
+
|
|
107859
|
+
|
|
107843
107860
|
namespace duckdb {
|
|
107844
107861
|
|
|
107845
|
-
struct
|
|
107846
|
-
explicit
|
|
107862
|
+
struct UnnestBindData : public FunctionData {
|
|
107863
|
+
explicit UnnestBindData(LogicalType input_type_p) : input_type(move(input_type_p)) {
|
|
107847
107864
|
}
|
|
107848
107865
|
|
|
107849
|
-
|
|
107866
|
+
LogicalType input_type;
|
|
107867
|
+
|
|
107868
|
+
public:
|
|
107869
|
+
unique_ptr<FunctionData> Copy() const override {
|
|
107870
|
+
return make_unique<UnnestBindData>(input_type);
|
|
107871
|
+
}
|
|
107872
|
+
|
|
107873
|
+
bool Equals(const FunctionData &other_p) const override {
|
|
107874
|
+
auto &other = (const UnnestBindData &)other_p;
|
|
107875
|
+
return input_type == other.input_type;
|
|
107876
|
+
}
|
|
107850
107877
|
};
|
|
107851
107878
|
|
|
107852
107879
|
struct UnnestOperatorData : public FunctionOperatorData {
|
|
107853
|
-
UnnestOperatorData()
|
|
107880
|
+
UnnestOperatorData() {
|
|
107854
107881
|
}
|
|
107855
107882
|
|
|
107856
|
-
|
|
107883
|
+
unique_ptr<OperatorState> operator_state;
|
|
107884
|
+
vector<unique_ptr<Expression>> select_list;
|
|
107857
107885
|
};
|
|
107858
107886
|
|
|
107859
107887
|
static unique_ptr<FunctionData> UnnestBind(ClientContext &context, TableFunctionBindInput &input,
|
|
107860
107888
|
vector<LogicalType> &return_types, vector<string> &names) {
|
|
107861
|
-
|
|
107862
|
-
|
|
107863
|
-
|
|
107864
|
-
|
|
107889
|
+
if (input.input_table_types.size() != 1 || input.input_table_types[0].id() != LogicalTypeId::LIST) {
|
|
107890
|
+
throw BinderException("UNNEST requires a single list as input");
|
|
107891
|
+
}
|
|
107892
|
+
return_types.push_back(ListType::GetChildType(input.input_table_types[0]));
|
|
107893
|
+
names.push_back(input.input_table_names[0]);
|
|
107894
|
+
return make_unique<UnnestBindData>(input.input_table_types[0]);
|
|
107865
107895
|
}
|
|
107866
107896
|
|
|
107867
|
-
static unique_ptr<FunctionOperatorData> UnnestInit(ClientContext &context, const FunctionData *
|
|
107897
|
+
static unique_ptr<FunctionOperatorData> UnnestInit(ClientContext &context, const FunctionData *bind_data_p,
|
|
107868
107898
|
const vector<column_t> &column_ids, TableFilterCollection *filters) {
|
|
107869
|
-
|
|
107899
|
+
auto &bind_data = (UnnestBindData &)*bind_data_p;
|
|
107900
|
+
auto result = make_unique<UnnestOperatorData>();
|
|
107901
|
+
result->operator_state = PhysicalUnnest::GetState(context);
|
|
107902
|
+
auto ref = make_unique<BoundReferenceExpression>(bind_data.input_type, 0);
|
|
107903
|
+
auto bound_unnest = make_unique<BoundUnnestExpression>(ListType::GetChildType(bind_data.input_type));
|
|
107904
|
+
bound_unnest->child = move(ref);
|
|
107905
|
+
result->select_list.push_back(move(bound_unnest));
|
|
107906
|
+
return move(result);
|
|
107870
107907
|
}
|
|
107871
107908
|
|
|
107872
|
-
static
|
|
107873
|
-
|
|
107874
|
-
auto &
|
|
107875
|
-
|
|
107876
|
-
|
|
107877
|
-
auto &list_value = ListValue::GetChildren(bind_data.value);
|
|
107878
|
-
idx_t count = 0;
|
|
107879
|
-
for (; state.current_count < list_value.size() && count < STANDARD_VECTOR_SIZE; state.current_count++) {
|
|
107880
|
-
output.data[0].SetValue(count, list_value[state.current_count]);
|
|
107881
|
-
count++;
|
|
107882
|
-
}
|
|
107883
|
-
output.SetCardinality(count);
|
|
107909
|
+
static OperatorResultType UnnestFunction(ClientContext &context, const FunctionData *bind_data_p,
|
|
107910
|
+
FunctionOperatorData *state_p, DataChunk &input, DataChunk &output) {
|
|
107911
|
+
auto &state = (UnnestOperatorData &)*state_p;
|
|
107912
|
+
return PhysicalUnnest::ExecuteInternal(context, input, output, *state.operator_state, state.select_list, false);
|
|
107884
107913
|
}
|
|
107885
107914
|
|
|
107886
107915
|
void UnnestTableFunction::RegisterFunction(BuiltinFunctions &set) {
|
|
107887
|
-
TableFunction unnest_function("unnest", {LogicalTypeId::
|
|
107916
|
+
TableFunction unnest_function("unnest", {LogicalTypeId::TABLE}, nullptr, UnnestBind, UnnestInit);
|
|
107917
|
+
unnest_function.in_out_function = UnnestFunction;
|
|
107888
107918
|
set.AddFunction(unnest_function);
|
|
107889
107919
|
}
|
|
107890
107920
|
|
|
@@ -107918,7 +107948,7 @@ static unique_ptr<FunctionOperatorData> PragmaVersionInit(ClientContext &context
|
|
|
107918
107948
|
}
|
|
107919
107949
|
|
|
107920
107950
|
static void PragmaVersionFunction(ClientContext &context, const FunctionData *bind_data,
|
|
107921
|
-
FunctionOperatorData *operator_state, DataChunk
|
|
107951
|
+
FunctionOperatorData *operator_state, DataChunk &output) {
|
|
107922
107952
|
auto &data = (PragmaVersionData &)*operator_state;
|
|
107923
107953
|
if (data.finished) {
|
|
107924
107954
|
// finished returning values
|
|
@@ -107994,12 +108024,13 @@ TableFunction::TableFunction(string name, vector<LogicalType> arguments, table_f
|
|
|
107994
108024
|
table_function_init_parallel_state_t init_parallel_state,
|
|
107995
108025
|
table_function_parallel_t parallel_function, table_function_init_parallel_t parallel_init,
|
|
107996
108026
|
table_function_parallel_state_next_t parallel_state_next, bool projection_pushdown,
|
|
107997
|
-
bool filter_pushdown, table_function_progress_t query_progress
|
|
108027
|
+
bool filter_pushdown, table_function_progress_t query_progress,
|
|
108028
|
+
table_in_out_function_t in_out_function)
|
|
107998
108029
|
: SimpleNamedParameterFunction(move(name), move(arguments)), bind(bind), init(init), function(function),
|
|
107999
|
-
statistics(statistics), cleanup(cleanup), dependency(dependency),
|
|
108000
|
-
pushdown_complex_filter(pushdown_complex_filter), to_string(to_string),
|
|
108001
|
-
init_parallel_state(init_parallel_state), parallel_function(parallel_function),
|
|
108002
|
-
parallel_state_next(parallel_state_next), table_scan_progress(query_progress),
|
|
108030
|
+
in_out_function(in_out_function), statistics(statistics), cleanup(cleanup), dependency(dependency),
|
|
108031
|
+
cardinality(cardinality), pushdown_complex_filter(pushdown_complex_filter), to_string(to_string),
|
|
108032
|
+
max_threads(max_threads), init_parallel_state(init_parallel_state), parallel_function(parallel_function),
|
|
108033
|
+
parallel_init(parallel_init), parallel_state_next(parallel_state_next), table_scan_progress(query_progress),
|
|
108003
108034
|
projection_pushdown(projection_pushdown), filter_pushdown(filter_pushdown) {
|
|
108004
108035
|
}
|
|
108005
108036
|
|
|
@@ -108012,10 +108043,12 @@ TableFunction::TableFunction(const vector<LogicalType> &arguments, table_functio
|
|
|
108012
108043
|
table_function_init_parallel_state_t init_parallel_state,
|
|
108013
108044
|
table_function_parallel_t parallel_function, table_function_init_parallel_t parallel_init,
|
|
108014
108045
|
table_function_parallel_state_next_t parallel_state_next, bool projection_pushdown,
|
|
108015
|
-
bool filter_pushdown, table_function_progress_t query_progress
|
|
108046
|
+
bool filter_pushdown, table_function_progress_t query_progress,
|
|
108047
|
+
table_in_out_function_t in_out_function)
|
|
108016
108048
|
: TableFunction(string(), arguments, function, bind, init, statistics, cleanup, dependency, cardinality,
|
|
108017
108049
|
pushdown_complex_filter, to_string, max_threads, init_parallel_state, parallel_function,
|
|
108018
|
-
parallel_init, parallel_state_next, projection_pushdown, filter_pushdown, query_progress
|
|
108050
|
+
parallel_init, parallel_state_next, projection_pushdown, filter_pushdown, query_progress,
|
|
108051
|
+
in_out_function) {
|
|
108019
108052
|
}
|
|
108020
108053
|
TableFunction::TableFunction() : SimpleNamedParameterFunction("", {}) {
|
|
108021
108054
|
}
|
|
@@ -110496,7 +110529,7 @@ unique_ptr<FunctionOperatorData> CTableFunctionInit(ClientContext &context, cons
|
|
|
110496
110529
|
}
|
|
110497
110530
|
|
|
110498
110531
|
void CTableFunction(ClientContext &context, const FunctionData *bind_data_p, FunctionOperatorData *operator_state,
|
|
110499
|
-
DataChunk
|
|
110532
|
+
DataChunk &output) {
|
|
110500
110533
|
auto &bind_data = (CTableBindData &)*bind_data_p;
|
|
110501
110534
|
auto &init_data = (CTableInitData &)*operator_state;
|
|
110502
110535
|
CTableInternalFunctionInfo function_info(bind_data, init_data);
|
|
@@ -163333,11 +163366,45 @@ unique_ptr<BoundTableRef> Binder::Bind(SubqueryRef &ref, CommonTableExpressionIn
|
|
|
163333
163366
|
|
|
163334
163367
|
|
|
163335
163368
|
|
|
163369
|
+
|
|
163370
|
+
|
|
163336
163371
|
namespace duckdb {
|
|
163337
163372
|
|
|
163338
|
-
bool
|
|
163339
|
-
|
|
163340
|
-
|
|
163373
|
+
static bool IsTableInTableOutFunction(TableFunctionCatalogEntry &table_function) {
|
|
163374
|
+
return table_function.functions.size() == 1 && table_function.functions[0].arguments.size() == 1 &&
|
|
163375
|
+
table_function.functions[0].arguments[0].id() == LogicalTypeId::TABLE;
|
|
163376
|
+
}
|
|
163377
|
+
|
|
163378
|
+
bool Binder::BindTableInTableOutFunction(vector<unique_ptr<ParsedExpression>> &expressions,
|
|
163379
|
+
unique_ptr<BoundSubqueryRef> &subquery, string &error) {
|
|
163380
|
+
auto binder = Binder::CreateBinder(this->context, this, true);
|
|
163381
|
+
if (expressions.size() == 1 && expressions[0]->type == ExpressionType::SUBQUERY) {
|
|
163382
|
+
// general case: argument is a subquery, bind it as part of the node
|
|
163383
|
+
auto &se = (SubqueryExpression &)*expressions[0];
|
|
163384
|
+
auto node = binder->BindNode(*se.subquery->node);
|
|
163385
|
+
subquery = make_unique<BoundSubqueryRef>(move(binder), move(node));
|
|
163386
|
+
return true;
|
|
163387
|
+
}
|
|
163388
|
+
// special case: non-subquery parameter to table-in table-out function
|
|
163389
|
+
// generate a subquery and bind that (i.e. UNNEST([1,2,3]) becomes UNNEST((SELECT [1,2,3]))
|
|
163390
|
+
auto select_node = make_unique<SelectNode>();
|
|
163391
|
+
select_node->select_list = move(expressions);
|
|
163392
|
+
select_node->from_table = make_unique<EmptyTableRef>();
|
|
163393
|
+
auto node = binder->BindNode(*select_node);
|
|
163394
|
+
subquery = make_unique<BoundSubqueryRef>(move(binder), move(node));
|
|
163395
|
+
return true;
|
|
163396
|
+
}
|
|
163397
|
+
|
|
163398
|
+
bool Binder::BindTableFunctionParameters(TableFunctionCatalogEntry &table_function,
|
|
163399
|
+
vector<unique_ptr<ParsedExpression>> &expressions,
|
|
163400
|
+
vector<LogicalType> &arguments, vector<Value> ¶meters,
|
|
163401
|
+
named_parameter_map_t &named_parameters,
|
|
163402
|
+
unique_ptr<BoundSubqueryRef> &subquery, string &error) {
|
|
163403
|
+
if (IsTableInTableOutFunction(table_function)) {
|
|
163404
|
+
// special case binding for table-in table-out function
|
|
163405
|
+
arguments.emplace_back(LogicalTypeId::TABLE);
|
|
163406
|
+
return BindTableInTableOutFunction(expressions, subquery, error);
|
|
163407
|
+
}
|
|
163341
163408
|
bool seen_subquery = false;
|
|
163342
163409
|
for (auto &child : expressions) {
|
|
163343
163410
|
string parameter_name;
|
|
@@ -163367,6 +163434,7 @@ bool Binder::BindFunctionParameters(vector<unique_ptr<ParsedExpression>> &expres
|
|
|
163367
163434
|
arguments.emplace_back(LogicalTypeId::TABLE);
|
|
163368
163435
|
continue;
|
|
163369
163436
|
}
|
|
163437
|
+
|
|
163370
163438
|
ConstantBinder binder(*this, context, "TABLE FUNCTION parameter");
|
|
163371
163439
|
LogicalType sql_type;
|
|
163372
163440
|
auto expr = binder.Bind(child, &sql_type);
|
|
@@ -163435,7 +163503,8 @@ unique_ptr<BoundTableRef> Binder::Bind(TableFunctionRef &ref) {
|
|
|
163435
163503
|
named_parameter_map_t named_parameters;
|
|
163436
163504
|
unique_ptr<BoundSubqueryRef> subquery;
|
|
163437
163505
|
string error;
|
|
163438
|
-
if (!
|
|
163506
|
+
if (!BindTableFunctionParameters(*function, fexpr->children, arguments, parameters, named_parameters, subquery,
|
|
163507
|
+
error)) {
|
|
163439
163508
|
throw BinderException(FormatError(ref, error));
|
|
163440
163509
|
}
|
|
163441
163510
|
|