duckdb 0.3.2-dev599.0 → 0.3.2-dev656.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 +1006 -1065
- package/src/duckdb.hpp +5874 -5650
package/src/duckdb.cpp
CHANGED
|
@@ -7200,7 +7200,7 @@ int ResultArrowArrayStreamWrapper::MyStreamGetSchema(struct ArrowArrayStream *st
|
|
|
7200
7200
|
}
|
|
7201
7201
|
if (result.type == QueryResultType::STREAM_RESULT) {
|
|
7202
7202
|
auto &stream_result = (StreamQueryResult &)result;
|
|
7203
|
-
if (!stream_result.
|
|
7203
|
+
if (!stream_result.IsOpen()) {
|
|
7204
7204
|
my_stream->last_error = "Query Stream is closed";
|
|
7205
7205
|
return -1;
|
|
7206
7206
|
}
|
|
@@ -7221,7 +7221,7 @@ int ResultArrowArrayStreamWrapper::MyStreamGetNext(struct ArrowArrayStream *stre
|
|
|
7221
7221
|
}
|
|
7222
7222
|
if (result.type == QueryResultType::STREAM_RESULT) {
|
|
7223
7223
|
auto &stream_result = (StreamQueryResult &)result;
|
|
7224
|
-
if (!stream_result.
|
|
7224
|
+
if (!stream_result.IsOpen()) {
|
|
7225
7225
|
my_stream->last_error = "Query Stream is closed";
|
|
7226
7226
|
return -1;
|
|
7227
7227
|
}
|
|
@@ -24080,51 +24080,43 @@ bool Printer::IsTerminal() {
|
|
|
24080
24080
|
|
|
24081
24081
|
namespace duckdb {
|
|
24082
24082
|
|
|
24083
|
-
|
|
24084
|
-
|
|
24085
|
-
WaitFor(std::chrono::milliseconds(show_progress_after));
|
|
24086
|
-
while (!stop) {
|
|
24087
|
-
int new_percentage;
|
|
24088
|
-
supported = executor->GetPipelinesProgress(new_percentage);
|
|
24089
|
-
current_percentage = new_percentage;
|
|
24090
|
-
if (supported && current_percentage > -1 && ClientConfig::GetConfig(executor->context).print_progress_bar) {
|
|
24091
|
-
Printer::PrintProgress(current_percentage, PROGRESS_BAR_STRING.c_str(), PROGRESS_BAR_WIDTH);
|
|
24092
|
-
}
|
|
24093
|
-
WaitFor(std::chrono::milliseconds(time_update_bar));
|
|
24094
|
-
}
|
|
24095
|
-
#endif
|
|
24083
|
+
ProgressBar::ProgressBar(Executor &executor, idx_t show_progress_after)
|
|
24084
|
+
: executor(executor), show_progress_after(show_progress_after), current_percentage(-1) {
|
|
24096
24085
|
}
|
|
24097
24086
|
|
|
24098
|
-
|
|
24087
|
+
double ProgressBar::GetCurrentPercentage() {
|
|
24099
24088
|
return current_percentage;
|
|
24100
24089
|
}
|
|
24101
24090
|
|
|
24102
24091
|
void ProgressBar::Start() {
|
|
24103
|
-
|
|
24104
|
-
Stop(false);
|
|
24105
|
-
stop = false;
|
|
24092
|
+
profiler.Start();
|
|
24106
24093
|
current_percentage = 0;
|
|
24107
|
-
|
|
24108
|
-
#endif
|
|
24094
|
+
supported = true;
|
|
24109
24095
|
}
|
|
24110
24096
|
|
|
24111
|
-
ProgressBar
|
|
24112
|
-
|
|
24113
|
-
|
|
24114
|
-
|
|
24115
|
-
|
|
24116
|
-
|
|
24117
|
-
if (
|
|
24118
|
-
|
|
24119
|
-
|
|
24120
|
-
|
|
24121
|
-
|
|
24122
|
-
|
|
24097
|
+
void ProgressBar::Update(bool final) {
|
|
24098
|
+
if (!supported) {
|
|
24099
|
+
return;
|
|
24100
|
+
}
|
|
24101
|
+
double new_percentage;
|
|
24102
|
+
supported = executor.GetPipelinesProgress(new_percentage);
|
|
24103
|
+
if (!supported) {
|
|
24104
|
+
return;
|
|
24105
|
+
}
|
|
24106
|
+
auto sufficient_time_elapsed = profiler.Elapsed() > show_progress_after / 1000.0;
|
|
24107
|
+
auto print_progress = ClientConfig::GetConfig(executor.context).print_progress_bar;
|
|
24108
|
+
if (new_percentage > current_percentage) {
|
|
24109
|
+
current_percentage = new_percentage;
|
|
24110
|
+
}
|
|
24111
|
+
if (supported && print_progress && sufficient_time_elapsed && current_percentage > -1 && print_progress) {
|
|
24112
|
+
if (final) {
|
|
24123
24113
|
Printer::FinishProgressBarPrint(PROGRESS_BAR_STRING.c_str(), PROGRESS_BAR_WIDTH);
|
|
24114
|
+
} else {
|
|
24115
|
+
Printer::PrintProgress(current_percentage, PROGRESS_BAR_STRING.c_str(), PROGRESS_BAR_WIDTH);
|
|
24124
24116
|
}
|
|
24125
24117
|
}
|
|
24126
|
-
#endif
|
|
24127
24118
|
}
|
|
24119
|
+
|
|
24128
24120
|
} // namespace duckdb
|
|
24129
24121
|
|
|
24130
24122
|
|
|
@@ -24857,7 +24849,7 @@ public:
|
|
|
24857
24849
|
idx_t AppendToBlock(RowDataBlock &block, BufferHandle &handle, vector<BlockAppendEntry> &append_entries,
|
|
24858
24850
|
idx_t remaining, idx_t entry_sizes[]);
|
|
24859
24851
|
vector<unique_ptr<BufferHandle>> Build(idx_t added_count, data_ptr_t key_locations[], idx_t entry_sizes[],
|
|
24860
|
-
const SelectionVector *sel =
|
|
24852
|
+
const SelectionVector *sel = FlatVector::IncrementalSelectionVector());
|
|
24861
24853
|
|
|
24862
24854
|
void Merge(RowDataCollection &other);
|
|
24863
24855
|
|
|
@@ -25172,7 +25164,7 @@ static void HeapGatherListVector(Vector &v, const idx_t vcount, const SelectionV
|
|
|
25172
25164
|
}
|
|
25173
25165
|
|
|
25174
25166
|
// now deserialize and add to listvector
|
|
25175
|
-
RowOperations::HeapGather(list_vec_to_append, next, FlatVector::
|
|
25167
|
+
RowOperations::HeapGather(list_vec_to_append, next, *FlatVector::IncrementalSelectionVector(), 0,
|
|
25176
25168
|
list_entry_locations, nullptr);
|
|
25177
25169
|
ListVector::Append(v, list_vec_to_append, next);
|
|
25178
25170
|
|
|
@@ -25339,7 +25331,7 @@ static void ComputeListEntrySizes(Vector &v, VectorData &vdata, idx_t entry_size
|
|
|
25339
25331
|
// compute and add to the total
|
|
25340
25332
|
std::fill_n(list_entry_sizes, next, 0);
|
|
25341
25333
|
RowOperations::ComputeEntrySizes(child_vector, list_entry_sizes, next, next,
|
|
25342
|
-
FlatVector::
|
|
25334
|
+
*FlatVector::IncrementalSelectionVector(), entry_offset);
|
|
25343
25335
|
for (idx_t list_idx = 0; list_idx < next; list_idx++) {
|
|
25344
25336
|
entry_sizes[i] += list_entry_sizes[list_idx];
|
|
25345
25337
|
}
|
|
@@ -25601,7 +25593,7 @@ static void HeapScatterListVector(Vector &v, idx_t vcount, const SelectionVector
|
|
|
25601
25593
|
// variable size list entries: compute entry sizes and set list entry locations
|
|
25602
25594
|
std::fill_n(list_entry_sizes, next, 0);
|
|
25603
25595
|
RowOperations::ComputeEntrySizes(child_vector, list_entry_sizes, next, next,
|
|
25604
|
-
FlatVector::
|
|
25596
|
+
*FlatVector::IncrementalSelectionVector(), entry_offset);
|
|
25605
25597
|
for (idx_t entry_idx = 0; entry_idx < next; entry_idx++) {
|
|
25606
25598
|
list_entry_locations[entry_idx] = key_locations[i];
|
|
25607
25599
|
key_locations[i] += list_entry_sizes[entry_idx];
|
|
@@ -25612,8 +25604,8 @@ static void HeapScatterListVector(Vector &v, idx_t vcount, const SelectionVector
|
|
|
25612
25604
|
|
|
25613
25605
|
// now serialize to the locations
|
|
25614
25606
|
RowOperations::HeapScatter(child_vector, ListVector::GetListSize(v),
|
|
25615
|
-
FlatVector::
|
|
25616
|
-
entry_offset);
|
|
25607
|
+
*FlatVector::IncrementalSelectionVector(), next, 0, list_entry_locations,
|
|
25608
|
+
nullptr, entry_offset);
|
|
25617
25609
|
|
|
25618
25610
|
// update for next iteration
|
|
25619
25611
|
entry_remaining -= next;
|
|
@@ -26084,7 +26076,7 @@ void RadixScatterListVector(Vector &v, VectorData &vdata, const SelectionVector
|
|
|
26084
26076
|
// denote that the list is not empty with a 1
|
|
26085
26077
|
key_locations[i][0] = 1;
|
|
26086
26078
|
key_locations[i]++;
|
|
26087
|
-
RowOperations::RadixScatter(child_vector, list_size, FlatVector::
|
|
26079
|
+
RowOperations::RadixScatter(child_vector, list_size, *FlatVector::IncrementalSelectionVector(), 1,
|
|
26088
26080
|
key_locations + i, false, true, false, prefix_len, width - 1,
|
|
26089
26081
|
list_entry.offset);
|
|
26090
26082
|
} else {
|
|
@@ -26115,7 +26107,7 @@ void RadixScatterListVector(Vector &v, VectorData &vdata, const SelectionVector
|
|
|
26115
26107
|
// denote that the list is not empty with a 1
|
|
26116
26108
|
key_locations[i][0] = 1;
|
|
26117
26109
|
key_locations[i]++;
|
|
26118
|
-
RowOperations::RadixScatter(child_vector, list_size, FlatVector::
|
|
26110
|
+
RowOperations::RadixScatter(child_vector, list_size, *FlatVector::IncrementalSelectionVector(), 1,
|
|
26119
26111
|
key_locations + i, false, true, false, prefix_len, width - 1,
|
|
26120
26112
|
list_entry.offset);
|
|
26121
26113
|
} else {
|
|
@@ -26158,7 +26150,7 @@ void RadixScatterStructVector(Vector &v, VectorData &vdata, idx_t vcount, const
|
|
|
26158
26150
|
}
|
|
26159
26151
|
// serialize the struct
|
|
26160
26152
|
auto &child_vector = *StructVector::GetEntries(v)[0];
|
|
26161
|
-
RowOperations::RadixScatter(child_vector, vcount, FlatVector::
|
|
26153
|
+
RowOperations::RadixScatter(child_vector, vcount, *FlatVector::IncrementalSelectionVector(), add_count,
|
|
26162
26154
|
key_locations, false, true, false, prefix_len, width, offset);
|
|
26163
26155
|
// invert bits if desc
|
|
26164
26156
|
if (desc) {
|
|
@@ -27779,7 +27771,7 @@ public:
|
|
|
27779
27771
|
|
|
27780
27772
|
private:
|
|
27781
27773
|
//! Selection vector and addresses for scattering the data to rows
|
|
27782
|
-
const SelectionVector &sel_ptr = FlatVector::
|
|
27774
|
+
const SelectionVector &sel_ptr = *FlatVector::IncrementalSelectionVector();
|
|
27783
27775
|
Vector addresses = Vector(LogicalType::POINTER);
|
|
27784
27776
|
};
|
|
27785
27777
|
|
|
@@ -30060,8 +30052,8 @@ void PayloadScanner::Scan(DataChunk &chunk) {
|
|
|
30060
30052
|
// Deserialize the payload data
|
|
30061
30053
|
for (idx_t col_idx = 0; col_idx < sorted_data.layout.ColumnCount(); col_idx++) {
|
|
30062
30054
|
const auto col_offset = sorted_data.layout.GetOffsets()[col_idx];
|
|
30063
|
-
RowOperations::Gather(addresses, FlatVector::
|
|
30064
|
-
FlatVector::
|
|
30055
|
+
RowOperations::Gather(addresses, *FlatVector::IncrementalSelectionVector(), chunk.data[col_idx],
|
|
30056
|
+
*FlatVector::IncrementalSelectionVector(), count, col_offset, col_idx);
|
|
30065
30057
|
}
|
|
30066
30058
|
chunk.SetCardinality(count);
|
|
30067
30059
|
chunk.Verify();
|
|
@@ -30394,54 +30386,6 @@ string StringUtil::CandidatesErrorMessage(const vector<string> &strings, const s
|
|
|
30394
30386
|
|
|
30395
30387
|
|
|
30396
30388
|
|
|
30397
|
-
//===----------------------------------------------------------------------===//
|
|
30398
|
-
// DuckDB
|
|
30399
|
-
//
|
|
30400
|
-
// duckdb/common/profiler.hpp
|
|
30401
|
-
//
|
|
30402
|
-
//
|
|
30403
|
-
//===----------------------------------------------------------------------===//
|
|
30404
|
-
|
|
30405
|
-
|
|
30406
|
-
|
|
30407
|
-
|
|
30408
|
-
|
|
30409
|
-
|
|
30410
|
-
namespace duckdb {
|
|
30411
|
-
|
|
30412
|
-
//! The profiler can be used to measure elapsed time
|
|
30413
|
-
template <typename T>
|
|
30414
|
-
class Profiler {
|
|
30415
|
-
public:
|
|
30416
|
-
//! Starts the timer
|
|
30417
|
-
void Start() {
|
|
30418
|
-
finished = false;
|
|
30419
|
-
start = Tick();
|
|
30420
|
-
}
|
|
30421
|
-
//! Finishes timing
|
|
30422
|
-
void End() {
|
|
30423
|
-
end = Tick();
|
|
30424
|
-
finished = true;
|
|
30425
|
-
}
|
|
30426
|
-
|
|
30427
|
-
//! Returns the elapsed time in seconds. If End() has been called, returns
|
|
30428
|
-
//! the total elapsed time. Otherwise returns how far along the timer is
|
|
30429
|
-
//! right now.
|
|
30430
|
-
double Elapsed() const {
|
|
30431
|
-
auto _end = finished ? end : Tick();
|
|
30432
|
-
return std::chrono::duration_cast<std::chrono::duration<double>>(_end - start).count();
|
|
30433
|
-
}
|
|
30434
|
-
|
|
30435
|
-
private:
|
|
30436
|
-
time_point<T> Tick() const {
|
|
30437
|
-
return T::now();
|
|
30438
|
-
}
|
|
30439
|
-
time_point<T> start;
|
|
30440
|
-
time_point<T> end;
|
|
30441
|
-
bool finished = false;
|
|
30442
|
-
};
|
|
30443
|
-
|
|
30444
|
-
} // namespace duckdb
|
|
30445
30389
|
|
|
30446
30390
|
|
|
30447
30391
|
|
|
@@ -30454,6 +30398,7 @@ private:
|
|
|
30454
30398
|
|
|
30455
30399
|
|
|
30456
30400
|
namespace duckdb {
|
|
30401
|
+
class ClientContext;
|
|
30457
30402
|
class ExpressionExecutor;
|
|
30458
30403
|
class PhysicalOperator;
|
|
30459
30404
|
class SQLStatement;
|
|
@@ -30545,7 +30490,7 @@ private:
|
|
|
30545
30490
|
//! Whether or not the profiler is enabled
|
|
30546
30491
|
bool enabled;
|
|
30547
30492
|
//! The timer used to time the execution time of the individual Physical Operators
|
|
30548
|
-
Profiler
|
|
30493
|
+
Profiler op;
|
|
30549
30494
|
//! The stack of Physical Operators that are currently active
|
|
30550
30495
|
const PhysicalOperator *active_operator;
|
|
30551
30496
|
//! A mapping of physical operators to recorded timings
|
|
@@ -30555,17 +30500,7 @@ private:
|
|
|
30555
30500
|
//! The QueryProfiler can be used to measure timings of queries
|
|
30556
30501
|
class QueryProfiler {
|
|
30557
30502
|
public:
|
|
30558
|
-
DUCKDB_API QueryProfiler()
|
|
30559
|
-
: automatic_print_format(ProfilerPrintFormat::NONE), enabled(false), detailed_enabled(false), running(false),
|
|
30560
|
-
query_requires_profiling(false), is_explain_analyze(false), stored_enabled(false),
|
|
30561
|
-
stored_automatic_print_format(ProfilerPrintFormat::NONE) {
|
|
30562
|
-
}
|
|
30563
|
-
|
|
30564
|
-
//! The format to automatically print query profiling information in (default: disabled)
|
|
30565
|
-
ProfilerPrintFormat automatic_print_format;
|
|
30566
|
-
//! The file to save query profiling information to, instead of printing it to the console (empty = print to
|
|
30567
|
-
//! console)
|
|
30568
|
-
string save_location;
|
|
30503
|
+
DUCKDB_API QueryProfiler(ClientContext &context);
|
|
30569
30504
|
|
|
30570
30505
|
public:
|
|
30571
30506
|
struct TreeNode {
|
|
@@ -30589,26 +30524,12 @@ private:
|
|
|
30589
30524
|
mutex flush_lock;
|
|
30590
30525
|
|
|
30591
30526
|
public:
|
|
30592
|
-
DUCKDB_API
|
|
30593
|
-
|
|
30594
|
-
|
|
30595
|
-
|
|
30527
|
+
DUCKDB_API bool IsEnabled() const;
|
|
30528
|
+
DUCKDB_API bool IsDetailedEnabled() const;
|
|
30529
|
+
DUCKDB_API ProfilerPrintFormat GetPrintFormat() const;
|
|
30530
|
+
DUCKDB_API string GetSaveLocation() const;
|
|
30596
30531
|
|
|
30597
|
-
DUCKDB_API
|
|
30598
|
-
detailed_enabled = true;
|
|
30599
|
-
}
|
|
30600
|
-
|
|
30601
|
-
DUCKDB_API void Disable() {
|
|
30602
|
-
enabled = false;
|
|
30603
|
-
}
|
|
30604
|
-
|
|
30605
|
-
DUCKDB_API bool IsEnabled() {
|
|
30606
|
-
return enabled;
|
|
30607
|
-
}
|
|
30608
|
-
|
|
30609
|
-
bool IsDetailedEnabled() const {
|
|
30610
|
-
return detailed_enabled;
|
|
30611
|
-
}
|
|
30532
|
+
DUCKDB_API static QueryProfiler &Get(ClientContext &context);
|
|
30612
30533
|
|
|
30613
30534
|
DUCKDB_API void StartQuery(string query, bool is_explain_analyze = false);
|
|
30614
30535
|
DUCKDB_API void EndQuery();
|
|
@@ -30637,13 +30558,12 @@ public:
|
|
|
30637
30558
|
void Finalize(TreeNode &node);
|
|
30638
30559
|
|
|
30639
30560
|
private:
|
|
30640
|
-
|
|
30641
|
-
|
|
30642
|
-
//! Whether or not detailed query profiling is enabled
|
|
30643
|
-
bool detailed_enabled;
|
|
30561
|
+
ClientContext &context;
|
|
30562
|
+
|
|
30644
30563
|
//! Whether or not the query profiler is running
|
|
30645
30564
|
bool running;
|
|
30646
30565
|
|
|
30566
|
+
//! Whether or not the query requires profiling
|
|
30647
30567
|
bool query_requires_profiling;
|
|
30648
30568
|
|
|
30649
30569
|
//! The root of the query tree
|
|
@@ -30651,14 +30571,11 @@ private:
|
|
|
30651
30571
|
//! The query string
|
|
30652
30572
|
string query;
|
|
30653
30573
|
//! The timer used to time the execution time of the entire query
|
|
30654
|
-
Profiler
|
|
30574
|
+
Profiler main_query;
|
|
30655
30575
|
//! A map of a Physical Operator pointer to a tree node
|
|
30656
30576
|
TreeMap tree_map;
|
|
30657
30577
|
|
|
30658
30578
|
bool is_explain_analyze;
|
|
30659
|
-
bool stored_enabled;
|
|
30660
|
-
ProfilerPrintFormat stored_automatic_print_format;
|
|
30661
|
-
string stored_save_location;
|
|
30662
30579
|
|
|
30663
30580
|
public:
|
|
30664
30581
|
const TreeMap &GetTreeMap() const {
|
|
@@ -30667,7 +30584,7 @@ public:
|
|
|
30667
30584
|
|
|
30668
30585
|
private:
|
|
30669
30586
|
//! The timer used to time the individual phases of the planning process
|
|
30670
|
-
Profiler
|
|
30587
|
+
Profiler phase_profiler;
|
|
30671
30588
|
//! A mapping of the phase names to the timings
|
|
30672
30589
|
using PhaseTimingStorage = unordered_map<string, double>;
|
|
30673
30590
|
PhaseTimingStorage phase_timings;
|
|
@@ -39228,7 +39145,7 @@ void Vector::Orrify(idx_t count, VectorData &data) {
|
|
|
39228
39145
|
break;
|
|
39229
39146
|
default:
|
|
39230
39147
|
Normalify(count);
|
|
39231
|
-
data.sel =
|
|
39148
|
+
data.sel = FlatVector::IncrementalSelectionVector(count, data.owned_sel);
|
|
39232
39149
|
data.data = FlatVector::GetData(*this);
|
|
39233
39150
|
data.validity = FlatVector::Validity(*this);
|
|
39234
39151
|
break;
|
|
@@ -39419,7 +39336,10 @@ void Vector::UTFVerify(const SelectionVector &sel, idx_t count) {
|
|
|
39419
39336
|
}
|
|
39420
39337
|
|
|
39421
39338
|
void Vector::UTFVerify(idx_t count) {
|
|
39422
|
-
|
|
39339
|
+
SelectionVector owned_sel;
|
|
39340
|
+
auto flat_sel = FlatVector::IncrementalSelectionVector(count, owned_sel);
|
|
39341
|
+
|
|
39342
|
+
UTFVerify(*flat_sel, count);
|
|
39423
39343
|
}
|
|
39424
39344
|
|
|
39425
39345
|
void Vector::Verify(const SelectionVector &sel, idx_t count) {
|
|
@@ -39559,15 +39479,9 @@ void Vector::Verify(const SelectionVector &sel, idx_t count) {
|
|
|
39559
39479
|
}
|
|
39560
39480
|
|
|
39561
39481
|
void Vector::Verify(idx_t count) {
|
|
39562
|
-
|
|
39563
|
-
|
|
39564
|
-
|
|
39565
|
-
selection_vector.set_index(i, i);
|
|
39566
|
-
}
|
|
39567
|
-
Verify(selection_vector, count);
|
|
39568
|
-
} else {
|
|
39569
|
-
Verify(FlatVector::INCREMENTAL_SELECTION_VECTOR, count);
|
|
39570
|
-
}
|
|
39482
|
+
SelectionVector owned_sel;
|
|
39483
|
+
auto flat_sel = FlatVector::IncrementalSelectionVector(count, owned_sel);
|
|
39484
|
+
Verify(*flat_sel, count);
|
|
39571
39485
|
}
|
|
39572
39486
|
|
|
39573
39487
|
void FlatVector::SetNull(Vector &vector, idx_t idx, bool is_null) {
|
|
@@ -39595,9 +39509,20 @@ void ConstantVector::SetNull(Vector &vector, bool is_null) {
|
|
|
39595
39509
|
}
|
|
39596
39510
|
}
|
|
39597
39511
|
|
|
39512
|
+
const SelectionVector *FlatVector::IncrementalSelectionVector(idx_t count, SelectionVector &owned_sel) {
|
|
39513
|
+
if (count <= STANDARD_VECTOR_SIZE) {
|
|
39514
|
+
return FlatVector::IncrementalSelectionVector();
|
|
39515
|
+
}
|
|
39516
|
+
owned_sel.Initialize(count);
|
|
39517
|
+
for (idx_t i = 0; i < count; i++) {
|
|
39518
|
+
owned_sel.set_index(i, i);
|
|
39519
|
+
}
|
|
39520
|
+
return &owned_sel;
|
|
39521
|
+
}
|
|
39522
|
+
|
|
39598
39523
|
const SelectionVector *ConstantVector::ZeroSelectionVector(idx_t count, SelectionVector &owned_sel) {
|
|
39599
39524
|
if (count <= STANDARD_VECTOR_SIZE) {
|
|
39600
|
-
return
|
|
39525
|
+
return ConstantVector::ZeroSelectionVector();
|
|
39601
39526
|
}
|
|
39602
39527
|
owned_sel.Initialize(count);
|
|
39603
39528
|
for (idx_t i = 0; i < count; i++) {
|
|
@@ -40210,459 +40135,31 @@ const LogicalType &VectorCache::GetType() const {
|
|
|
40210
40135
|
|
|
40211
40136
|
namespace duckdb {
|
|
40212
40137
|
|
|
40213
|
-
|
|
40214
|
-
|
|
40138
|
+
// We disable Wexit-time-destructors here
|
|
40139
|
+
// Otherwise we get a warning about the two selection vectors (ZERO/INCREMENTAL_SELECTION_VECTOR)
|
|
40140
|
+
// While the SelectionVector does have a non-trivial destructor
|
|
40141
|
+
// This only does a memory de-allocation if the selection vectors own their data (i.e. selection_data is not null)
|
|
40142
|
+
// In the case of the FlatVector/ConstantVector, they point towards static regions of memory
|
|
40143
|
+
// Hence in this case these cause no problems, as the destructors are non-trivial but effectively nops
|
|
40144
|
+
#ifdef __clang__
|
|
40145
|
+
#pragma clang diagnostic push
|
|
40146
|
+
#pragma clang diagnostic ignored "-Wexit-time-destructors"
|
|
40147
|
+
#endif
|
|
40148
|
+
|
|
40149
|
+
const SelectionVector *ConstantVector::ZeroSelectionVector() {
|
|
40150
|
+
static const SelectionVector ZERO_SELECTION_VECTOR = SelectionVector((sel_t *)ConstantVector::ZERO_VECTOR);
|
|
40151
|
+
return &ZERO_SELECTION_VECTOR;
|
|
40152
|
+
}
|
|
40153
|
+
|
|
40154
|
+
const SelectionVector *FlatVector::IncrementalSelectionVector() {
|
|
40155
|
+
static const SelectionVector INCREMENTAL_SELECTION_VECTOR;
|
|
40156
|
+
return &INCREMENTAL_SELECTION_VECTOR;
|
|
40157
|
+
}
|
|
40158
|
+
|
|
40215
40159
|
const sel_t ConstantVector::ZERO_VECTOR[STANDARD_VECTOR_SIZE] = {0};
|
|
40216
40160
|
|
|
40217
|
-
#
|
|
40218
|
-
|
|
40219
|
-
#elif STANDARD_VECTOR_SIZE == 4
|
|
40220
|
-
const sel_t FlatVector::INCREMENTAL_VECTOR[] = {0, 1, 2, 3};
|
|
40221
|
-
#elif STANDARD_VECTOR_SIZE == 8
|
|
40222
|
-
const sel_t FlatVector::INCREMENTAL_VECTOR[] = {0, 1, 2, 3, 4, 5, 6, 7};
|
|
40223
|
-
#elif STANDARD_VECTOR_SIZE == 16
|
|
40224
|
-
const sel_t FlatVector::INCREMENTAL_VECTOR[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
|
|
40225
|
-
#elif STANDARD_VECTOR_SIZE == 32
|
|
40226
|
-
const sel_t FlatVector::INCREMENTAL_VECTOR[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
|
40227
|
-
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31};
|
|
40228
|
-
#elif STANDARD_VECTOR_SIZE == 64
|
|
40229
|
-
const sel_t FlatVector::INCREMENTAL_VECTOR[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
|
40230
|
-
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
|
|
40231
|
-
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
|
|
40232
|
-
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63};
|
|
40233
|
-
#elif STANDARD_VECTOR_SIZE == 128
|
|
40234
|
-
const sel_t FlatVector::INCREMENTAL_VECTOR[] = {
|
|
40235
|
-
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
|
|
40236
|
-
22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
|
|
40237
|
-
44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
|
|
40238
|
-
66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
|
|
40239
|
-
88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
|
|
40240
|
-
110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127};
|
|
40241
|
-
#elif STANDARD_VECTOR_SIZE == 256
|
|
40242
|
-
const sel_t FlatVector::INCREMENTAL_VECTOR[] = {
|
|
40243
|
-
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
|
|
40244
|
-
22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
|
|
40245
|
-
44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
|
|
40246
|
-
66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
|
|
40247
|
-
88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
|
|
40248
|
-
110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131,
|
|
40249
|
-
132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153,
|
|
40250
|
-
154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
|
|
40251
|
-
176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197,
|
|
40252
|
-
198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219,
|
|
40253
|
-
220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241,
|
|
40254
|
-
242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255};
|
|
40255
|
-
#elif STANDARD_VECTOR_SIZE == 512
|
|
40256
|
-
const sel_t FlatVector::INCREMENTAL_VECTOR[] = {
|
|
40257
|
-
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
|
|
40258
|
-
23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
|
|
40259
|
-
46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
|
|
40260
|
-
69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
|
|
40261
|
-
92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
|
|
40262
|
-
115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137,
|
|
40263
|
-
138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160,
|
|
40264
|
-
161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183,
|
|
40265
|
-
184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206,
|
|
40266
|
-
207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229,
|
|
40267
|
-
230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252,
|
|
40268
|
-
253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275,
|
|
40269
|
-
276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298,
|
|
40270
|
-
299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321,
|
|
40271
|
-
322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
|
|
40272
|
-
345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367,
|
|
40273
|
-
368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390,
|
|
40274
|
-
391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413,
|
|
40275
|
-
414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436,
|
|
40276
|
-
437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459,
|
|
40277
|
-
460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482,
|
|
40278
|
-
483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505,
|
|
40279
|
-
506, 507, 508, 509, 510, 511};
|
|
40280
|
-
#elif STANDARD_VECTOR_SIZE == 1024
|
|
40281
|
-
const sel_t FlatVector::INCREMENTAL_VECTOR[] = {
|
|
40282
|
-
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
|
|
40283
|
-
19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
|
|
40284
|
-
38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
|
|
40285
|
-
57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
|
|
40286
|
-
76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
|
|
40287
|
-
95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
|
|
40288
|
-
114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132,
|
|
40289
|
-
133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151,
|
|
40290
|
-
152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170,
|
|
40291
|
-
171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
|
|
40292
|
-
190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208,
|
|
40293
|
-
209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227,
|
|
40294
|
-
228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246,
|
|
40295
|
-
247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265,
|
|
40296
|
-
266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
|
|
40297
|
-
285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303,
|
|
40298
|
-
304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322,
|
|
40299
|
-
323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341,
|
|
40300
|
-
342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360,
|
|
40301
|
-
361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379,
|
|
40302
|
-
380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398,
|
|
40303
|
-
399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417,
|
|
40304
|
-
418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436,
|
|
40305
|
-
437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455,
|
|
40306
|
-
456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474,
|
|
40307
|
-
475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493,
|
|
40308
|
-
494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512,
|
|
40309
|
-
513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531,
|
|
40310
|
-
532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550,
|
|
40311
|
-
551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569,
|
|
40312
|
-
570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588,
|
|
40313
|
-
589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607,
|
|
40314
|
-
608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626,
|
|
40315
|
-
627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645,
|
|
40316
|
-
646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664,
|
|
40317
|
-
665, 666, 667, 668, 669, 670, 671, 672, 673, 674, 675, 676, 677, 678, 679, 680, 681, 682, 683,
|
|
40318
|
-
684, 685, 686, 687, 688, 689, 690, 691, 692, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702,
|
|
40319
|
-
703, 704, 705, 706, 707, 708, 709, 710, 711, 712, 713, 714, 715, 716, 717, 718, 719, 720, 721,
|
|
40320
|
-
722, 723, 724, 725, 726, 727, 728, 729, 730, 731, 732, 733, 734, 735, 736, 737, 738, 739, 740,
|
|
40321
|
-
741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 757, 758, 759,
|
|
40322
|
-
760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 778,
|
|
40323
|
-
779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 795, 796, 797,
|
|
40324
|
-
798, 799, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, 815, 816,
|
|
40325
|
-
817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835,
|
|
40326
|
-
836, 837, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854,
|
|
40327
|
-
855, 856, 857, 858, 859, 860, 861, 862, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873,
|
|
40328
|
-
874, 875, 876, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 890, 891, 892,
|
|
40329
|
-
893, 894, 895, 896, 897, 898, 899, 900, 901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911,
|
|
40330
|
-
912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 930,
|
|
40331
|
-
931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949,
|
|
40332
|
-
950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968,
|
|
40333
|
-
969, 970, 971, 972, 973, 974, 975, 976, 977, 978, 979, 980, 981, 982, 983, 984, 985, 986, 987,
|
|
40334
|
-
988, 989, 990, 991, 992, 993, 994, 995, 996, 997, 998, 999, 1000, 1001, 1002, 1003, 1004, 1005, 1006,
|
|
40335
|
-
1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019, 1020, 1021, 1022, 1023};
|
|
40336
|
-
#elif STANDARD_VECTOR_SIZE == 2048
|
|
40337
|
-
const sel_t FlatVector::INCREMENTAL_VECTOR[] = {
|
|
40338
|
-
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
|
|
40339
|
-
19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
|
|
40340
|
-
38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
|
|
40341
|
-
57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
|
|
40342
|
-
76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
|
|
40343
|
-
95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
|
|
40344
|
-
114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132,
|
|
40345
|
-
133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151,
|
|
40346
|
-
152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170,
|
|
40347
|
-
171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
|
|
40348
|
-
190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208,
|
|
40349
|
-
209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227,
|
|
40350
|
-
228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246,
|
|
40351
|
-
247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265,
|
|
40352
|
-
266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
|
|
40353
|
-
285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303,
|
|
40354
|
-
304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322,
|
|
40355
|
-
323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341,
|
|
40356
|
-
342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360,
|
|
40357
|
-
361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379,
|
|
40358
|
-
380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398,
|
|
40359
|
-
399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417,
|
|
40360
|
-
418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436,
|
|
40361
|
-
437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455,
|
|
40362
|
-
456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474,
|
|
40363
|
-
475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493,
|
|
40364
|
-
494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512,
|
|
40365
|
-
513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531,
|
|
40366
|
-
532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550,
|
|
40367
|
-
551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569,
|
|
40368
|
-
570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588,
|
|
40369
|
-
589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607,
|
|
40370
|
-
608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626,
|
|
40371
|
-
627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645,
|
|
40372
|
-
646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664,
|
|
40373
|
-
665, 666, 667, 668, 669, 670, 671, 672, 673, 674, 675, 676, 677, 678, 679, 680, 681, 682, 683,
|
|
40374
|
-
684, 685, 686, 687, 688, 689, 690, 691, 692, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702,
|
|
40375
|
-
703, 704, 705, 706, 707, 708, 709, 710, 711, 712, 713, 714, 715, 716, 717, 718, 719, 720, 721,
|
|
40376
|
-
722, 723, 724, 725, 726, 727, 728, 729, 730, 731, 732, 733, 734, 735, 736, 737, 738, 739, 740,
|
|
40377
|
-
741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 757, 758, 759,
|
|
40378
|
-
760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 778,
|
|
40379
|
-
779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 795, 796, 797,
|
|
40380
|
-
798, 799, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, 815, 816,
|
|
40381
|
-
817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835,
|
|
40382
|
-
836, 837, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854,
|
|
40383
|
-
855, 856, 857, 858, 859, 860, 861, 862, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873,
|
|
40384
|
-
874, 875, 876, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 890, 891, 892,
|
|
40385
|
-
893, 894, 895, 896, 897, 898, 899, 900, 901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911,
|
|
40386
|
-
912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 930,
|
|
40387
|
-
931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949,
|
|
40388
|
-
950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968,
|
|
40389
|
-
969, 970, 971, 972, 973, 974, 975, 976, 977, 978, 979, 980, 981, 982, 983, 984, 985, 986, 987,
|
|
40390
|
-
988, 989, 990, 991, 992, 993, 994, 995, 996, 997, 998, 999, 1000, 1001, 1002, 1003, 1004, 1005, 1006,
|
|
40391
|
-
1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019, 1020, 1021, 1022, 1023, 1024, 1025,
|
|
40392
|
-
1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044,
|
|
40393
|
-
1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063,
|
|
40394
|
-
1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082,
|
|
40395
|
-
1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101,
|
|
40396
|
-
1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1120,
|
|
40397
|
-
1121, 1122, 1123, 1124, 1125, 1126, 1127, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137, 1138, 1139,
|
|
40398
|
-
1140, 1141, 1142, 1143, 1144, 1145, 1146, 1147, 1148, 1149, 1150, 1151, 1152, 1153, 1154, 1155, 1156, 1157, 1158,
|
|
40399
|
-
1159, 1160, 1161, 1162, 1163, 1164, 1165, 1166, 1167, 1168, 1169, 1170, 1171, 1172, 1173, 1174, 1175, 1176, 1177,
|
|
40400
|
-
1178, 1179, 1180, 1181, 1182, 1183, 1184, 1185, 1186, 1187, 1188, 1189, 1190, 1191, 1192, 1193, 1194, 1195, 1196,
|
|
40401
|
-
1197, 1198, 1199, 1200, 1201, 1202, 1203, 1204, 1205, 1206, 1207, 1208, 1209, 1210, 1211, 1212, 1213, 1214, 1215,
|
|
40402
|
-
1216, 1217, 1218, 1219, 1220, 1221, 1222, 1223, 1224, 1225, 1226, 1227, 1228, 1229, 1230, 1231, 1232, 1233, 1234,
|
|
40403
|
-
1235, 1236, 1237, 1238, 1239, 1240, 1241, 1242, 1243, 1244, 1245, 1246, 1247, 1248, 1249, 1250, 1251, 1252, 1253,
|
|
40404
|
-
1254, 1255, 1256, 1257, 1258, 1259, 1260, 1261, 1262, 1263, 1264, 1265, 1266, 1267, 1268, 1269, 1270, 1271, 1272,
|
|
40405
|
-
1273, 1274, 1275, 1276, 1277, 1278, 1279, 1280, 1281, 1282, 1283, 1284, 1285, 1286, 1287, 1288, 1289, 1290, 1291,
|
|
40406
|
-
1292, 1293, 1294, 1295, 1296, 1297, 1298, 1299, 1300, 1301, 1302, 1303, 1304, 1305, 1306, 1307, 1308, 1309, 1310,
|
|
40407
|
-
1311, 1312, 1313, 1314, 1315, 1316, 1317, 1318, 1319, 1320, 1321, 1322, 1323, 1324, 1325, 1326, 1327, 1328, 1329,
|
|
40408
|
-
1330, 1331, 1332, 1333, 1334, 1335, 1336, 1337, 1338, 1339, 1340, 1341, 1342, 1343, 1344, 1345, 1346, 1347, 1348,
|
|
40409
|
-
1349, 1350, 1351, 1352, 1353, 1354, 1355, 1356, 1357, 1358, 1359, 1360, 1361, 1362, 1363, 1364, 1365, 1366, 1367,
|
|
40410
|
-
1368, 1369, 1370, 1371, 1372, 1373, 1374, 1375, 1376, 1377, 1378, 1379, 1380, 1381, 1382, 1383, 1384, 1385, 1386,
|
|
40411
|
-
1387, 1388, 1389, 1390, 1391, 1392, 1393, 1394, 1395, 1396, 1397, 1398, 1399, 1400, 1401, 1402, 1403, 1404, 1405,
|
|
40412
|
-
1406, 1407, 1408, 1409, 1410, 1411, 1412, 1413, 1414, 1415, 1416, 1417, 1418, 1419, 1420, 1421, 1422, 1423, 1424,
|
|
40413
|
-
1425, 1426, 1427, 1428, 1429, 1430, 1431, 1432, 1433, 1434, 1435, 1436, 1437, 1438, 1439, 1440, 1441, 1442, 1443,
|
|
40414
|
-
1444, 1445, 1446, 1447, 1448, 1449, 1450, 1451, 1452, 1453, 1454, 1455, 1456, 1457, 1458, 1459, 1460, 1461, 1462,
|
|
40415
|
-
1463, 1464, 1465, 1466, 1467, 1468, 1469, 1470, 1471, 1472, 1473, 1474, 1475, 1476, 1477, 1478, 1479, 1480, 1481,
|
|
40416
|
-
1482, 1483, 1484, 1485, 1486, 1487, 1488, 1489, 1490, 1491, 1492, 1493, 1494, 1495, 1496, 1497, 1498, 1499, 1500,
|
|
40417
|
-
1501, 1502, 1503, 1504, 1505, 1506, 1507, 1508, 1509, 1510, 1511, 1512, 1513, 1514, 1515, 1516, 1517, 1518, 1519,
|
|
40418
|
-
1520, 1521, 1522, 1523, 1524, 1525, 1526, 1527, 1528, 1529, 1530, 1531, 1532, 1533, 1534, 1535, 1536, 1537, 1538,
|
|
40419
|
-
1539, 1540, 1541, 1542, 1543, 1544, 1545, 1546, 1547, 1548, 1549, 1550, 1551, 1552, 1553, 1554, 1555, 1556, 1557,
|
|
40420
|
-
1558, 1559, 1560, 1561, 1562, 1563, 1564, 1565, 1566, 1567, 1568, 1569, 1570, 1571, 1572, 1573, 1574, 1575, 1576,
|
|
40421
|
-
1577, 1578, 1579, 1580, 1581, 1582, 1583, 1584, 1585, 1586, 1587, 1588, 1589, 1590, 1591, 1592, 1593, 1594, 1595,
|
|
40422
|
-
1596, 1597, 1598, 1599, 1600, 1601, 1602, 1603, 1604, 1605, 1606, 1607, 1608, 1609, 1610, 1611, 1612, 1613, 1614,
|
|
40423
|
-
1615, 1616, 1617, 1618, 1619, 1620, 1621, 1622, 1623, 1624, 1625, 1626, 1627, 1628, 1629, 1630, 1631, 1632, 1633,
|
|
40424
|
-
1634, 1635, 1636, 1637, 1638, 1639, 1640, 1641, 1642, 1643, 1644, 1645, 1646, 1647, 1648, 1649, 1650, 1651, 1652,
|
|
40425
|
-
1653, 1654, 1655, 1656, 1657, 1658, 1659, 1660, 1661, 1662, 1663, 1664, 1665, 1666, 1667, 1668, 1669, 1670, 1671,
|
|
40426
|
-
1672, 1673, 1674, 1675, 1676, 1677, 1678, 1679, 1680, 1681, 1682, 1683, 1684, 1685, 1686, 1687, 1688, 1689, 1690,
|
|
40427
|
-
1691, 1692, 1693, 1694, 1695, 1696, 1697, 1698, 1699, 1700, 1701, 1702, 1703, 1704, 1705, 1706, 1707, 1708, 1709,
|
|
40428
|
-
1710, 1711, 1712, 1713, 1714, 1715, 1716, 1717, 1718, 1719, 1720, 1721, 1722, 1723, 1724, 1725, 1726, 1727, 1728,
|
|
40429
|
-
1729, 1730, 1731, 1732, 1733, 1734, 1735, 1736, 1737, 1738, 1739, 1740, 1741, 1742, 1743, 1744, 1745, 1746, 1747,
|
|
40430
|
-
1748, 1749, 1750, 1751, 1752, 1753, 1754, 1755, 1756, 1757, 1758, 1759, 1760, 1761, 1762, 1763, 1764, 1765, 1766,
|
|
40431
|
-
1767, 1768, 1769, 1770, 1771, 1772, 1773, 1774, 1775, 1776, 1777, 1778, 1779, 1780, 1781, 1782, 1783, 1784, 1785,
|
|
40432
|
-
1786, 1787, 1788, 1789, 1790, 1791, 1792, 1793, 1794, 1795, 1796, 1797, 1798, 1799, 1800, 1801, 1802, 1803, 1804,
|
|
40433
|
-
1805, 1806, 1807, 1808, 1809, 1810, 1811, 1812, 1813, 1814, 1815, 1816, 1817, 1818, 1819, 1820, 1821, 1822, 1823,
|
|
40434
|
-
1824, 1825, 1826, 1827, 1828, 1829, 1830, 1831, 1832, 1833, 1834, 1835, 1836, 1837, 1838, 1839, 1840, 1841, 1842,
|
|
40435
|
-
1843, 1844, 1845, 1846, 1847, 1848, 1849, 1850, 1851, 1852, 1853, 1854, 1855, 1856, 1857, 1858, 1859, 1860, 1861,
|
|
40436
|
-
1862, 1863, 1864, 1865, 1866, 1867, 1868, 1869, 1870, 1871, 1872, 1873, 1874, 1875, 1876, 1877, 1878, 1879, 1880,
|
|
40437
|
-
1881, 1882, 1883, 1884, 1885, 1886, 1887, 1888, 1889, 1890, 1891, 1892, 1893, 1894, 1895, 1896, 1897, 1898, 1899,
|
|
40438
|
-
1900, 1901, 1902, 1903, 1904, 1905, 1906, 1907, 1908, 1909, 1910, 1911, 1912, 1913, 1914, 1915, 1916, 1917, 1918,
|
|
40439
|
-
1919, 1920, 1921, 1922, 1923, 1924, 1925, 1926, 1927, 1928, 1929, 1930, 1931, 1932, 1933, 1934, 1935, 1936, 1937,
|
|
40440
|
-
1938, 1939, 1940, 1941, 1942, 1943, 1944, 1945, 1946, 1947, 1948, 1949, 1950, 1951, 1952, 1953, 1954, 1955, 1956,
|
|
40441
|
-
1957, 1958, 1959, 1960, 1961, 1962, 1963, 1964, 1965, 1966, 1967, 1968, 1969, 1970, 1971, 1972, 1973, 1974, 1975,
|
|
40442
|
-
1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
|
|
40443
|
-
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013,
|
|
40444
|
-
2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025, 2026, 2027, 2028, 2029, 2030, 2031, 2032,
|
|
40445
|
-
2033, 2034, 2035, 2036, 2037, 2038, 2039, 2040, 2041, 2042, 2043, 2044, 2045, 2046, 2047};
|
|
40446
|
-
#elif STANDARD_VECTOR_SIZE == 4096
|
|
40447
|
-
const sel_t FlatVector::INCREMENTAL_VECTOR[] = {
|
|
40448
|
-
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
|
|
40449
|
-
19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
|
|
40450
|
-
38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
|
|
40451
|
-
57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
|
|
40452
|
-
76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
|
|
40453
|
-
95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
|
|
40454
|
-
114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132,
|
|
40455
|
-
133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151,
|
|
40456
|
-
152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170,
|
|
40457
|
-
171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
|
|
40458
|
-
190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208,
|
|
40459
|
-
209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227,
|
|
40460
|
-
228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246,
|
|
40461
|
-
247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265,
|
|
40462
|
-
266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
|
|
40463
|
-
285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303,
|
|
40464
|
-
304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322,
|
|
40465
|
-
323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341,
|
|
40466
|
-
342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360,
|
|
40467
|
-
361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379,
|
|
40468
|
-
380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398,
|
|
40469
|
-
399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417,
|
|
40470
|
-
418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436,
|
|
40471
|
-
437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455,
|
|
40472
|
-
456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474,
|
|
40473
|
-
475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493,
|
|
40474
|
-
494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512,
|
|
40475
|
-
513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531,
|
|
40476
|
-
532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550,
|
|
40477
|
-
551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569,
|
|
40478
|
-
570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588,
|
|
40479
|
-
589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607,
|
|
40480
|
-
608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626,
|
|
40481
|
-
627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645,
|
|
40482
|
-
646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664,
|
|
40483
|
-
665, 666, 667, 668, 669, 670, 671, 672, 673, 674, 675, 676, 677, 678, 679, 680, 681, 682, 683,
|
|
40484
|
-
684, 685, 686, 687, 688, 689, 690, 691, 692, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702,
|
|
40485
|
-
703, 704, 705, 706, 707, 708, 709, 710, 711, 712, 713, 714, 715, 716, 717, 718, 719, 720, 721,
|
|
40486
|
-
722, 723, 724, 725, 726, 727, 728, 729, 730, 731, 732, 733, 734, 735, 736, 737, 738, 739, 740,
|
|
40487
|
-
741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 757, 758, 759,
|
|
40488
|
-
760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 778,
|
|
40489
|
-
779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 795, 796, 797,
|
|
40490
|
-
798, 799, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, 815, 816,
|
|
40491
|
-
817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835,
|
|
40492
|
-
836, 837, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854,
|
|
40493
|
-
855, 856, 857, 858, 859, 860, 861, 862, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873,
|
|
40494
|
-
874, 875, 876, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 890, 891, 892,
|
|
40495
|
-
893, 894, 895, 896, 897, 898, 899, 900, 901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911,
|
|
40496
|
-
912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 930,
|
|
40497
|
-
931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949,
|
|
40498
|
-
950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968,
|
|
40499
|
-
969, 970, 971, 972, 973, 974, 975, 976, 977, 978, 979, 980, 981, 982, 983, 984, 985, 986, 987,
|
|
40500
|
-
988, 989, 990, 991, 992, 993, 994, 995, 996, 997, 998, 999, 1000, 1001, 1002, 1003, 1004, 1005, 1006,
|
|
40501
|
-
1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019, 1020, 1021, 1022, 1023, 1024, 1025,
|
|
40502
|
-
1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044,
|
|
40503
|
-
1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063,
|
|
40504
|
-
1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082,
|
|
40505
|
-
1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101,
|
|
40506
|
-
1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1120,
|
|
40507
|
-
1121, 1122, 1123, 1124, 1125, 1126, 1127, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137, 1138, 1139,
|
|
40508
|
-
1140, 1141, 1142, 1143, 1144, 1145, 1146, 1147, 1148, 1149, 1150, 1151, 1152, 1153, 1154, 1155, 1156, 1157, 1158,
|
|
40509
|
-
1159, 1160, 1161, 1162, 1163, 1164, 1165, 1166, 1167, 1168, 1169, 1170, 1171, 1172, 1173, 1174, 1175, 1176, 1177,
|
|
40510
|
-
1178, 1179, 1180, 1181, 1182, 1183, 1184, 1185, 1186, 1187, 1188, 1189, 1190, 1191, 1192, 1193, 1194, 1195, 1196,
|
|
40511
|
-
1197, 1198, 1199, 1200, 1201, 1202, 1203, 1204, 1205, 1206, 1207, 1208, 1209, 1210, 1211, 1212, 1213, 1214, 1215,
|
|
40512
|
-
1216, 1217, 1218, 1219, 1220, 1221, 1222, 1223, 1224, 1225, 1226, 1227, 1228, 1229, 1230, 1231, 1232, 1233, 1234,
|
|
40513
|
-
1235, 1236, 1237, 1238, 1239, 1240, 1241, 1242, 1243, 1244, 1245, 1246, 1247, 1248, 1249, 1250, 1251, 1252, 1253,
|
|
40514
|
-
1254, 1255, 1256, 1257, 1258, 1259, 1260, 1261, 1262, 1263, 1264, 1265, 1266, 1267, 1268, 1269, 1270, 1271, 1272,
|
|
40515
|
-
1273, 1274, 1275, 1276, 1277, 1278, 1279, 1280, 1281, 1282, 1283, 1284, 1285, 1286, 1287, 1288, 1289, 1290, 1291,
|
|
40516
|
-
1292, 1293, 1294, 1295, 1296, 1297, 1298, 1299, 1300, 1301, 1302, 1303, 1304, 1305, 1306, 1307, 1308, 1309, 1310,
|
|
40517
|
-
1311, 1312, 1313, 1314, 1315, 1316, 1317, 1318, 1319, 1320, 1321, 1322, 1323, 1324, 1325, 1326, 1327, 1328, 1329,
|
|
40518
|
-
1330, 1331, 1332, 1333, 1334, 1335, 1336, 1337, 1338, 1339, 1340, 1341, 1342, 1343, 1344, 1345, 1346, 1347, 1348,
|
|
40519
|
-
1349, 1350, 1351, 1352, 1353, 1354, 1355, 1356, 1357, 1358, 1359, 1360, 1361, 1362, 1363, 1364, 1365, 1366, 1367,
|
|
40520
|
-
1368, 1369, 1370, 1371, 1372, 1373, 1374, 1375, 1376, 1377, 1378, 1379, 1380, 1381, 1382, 1383, 1384, 1385, 1386,
|
|
40521
|
-
1387, 1388, 1389, 1390, 1391, 1392, 1393, 1394, 1395, 1396, 1397, 1398, 1399, 1400, 1401, 1402, 1403, 1404, 1405,
|
|
40522
|
-
1406, 1407, 1408, 1409, 1410, 1411, 1412, 1413, 1414, 1415, 1416, 1417, 1418, 1419, 1420, 1421, 1422, 1423, 1424,
|
|
40523
|
-
1425, 1426, 1427, 1428, 1429, 1430, 1431, 1432, 1433, 1434, 1435, 1436, 1437, 1438, 1439, 1440, 1441, 1442, 1443,
|
|
40524
|
-
1444, 1445, 1446, 1447, 1448, 1449, 1450, 1451, 1452, 1453, 1454, 1455, 1456, 1457, 1458, 1459, 1460, 1461, 1462,
|
|
40525
|
-
1463, 1464, 1465, 1466, 1467, 1468, 1469, 1470, 1471, 1472, 1473, 1474, 1475, 1476, 1477, 1478, 1479, 1480, 1481,
|
|
40526
|
-
1482, 1483, 1484, 1485, 1486, 1487, 1488, 1489, 1490, 1491, 1492, 1493, 1494, 1495, 1496, 1497, 1498, 1499, 1500,
|
|
40527
|
-
1501, 1502, 1503, 1504, 1505, 1506, 1507, 1508, 1509, 1510, 1511, 1512, 1513, 1514, 1515, 1516, 1517, 1518, 1519,
|
|
40528
|
-
1520, 1521, 1522, 1523, 1524, 1525, 1526, 1527, 1528, 1529, 1530, 1531, 1532, 1533, 1534, 1535, 1536, 1537, 1538,
|
|
40529
|
-
1539, 1540, 1541, 1542, 1543, 1544, 1545, 1546, 1547, 1548, 1549, 1550, 1551, 1552, 1553, 1554, 1555, 1556, 1557,
|
|
40530
|
-
1558, 1559, 1560, 1561, 1562, 1563, 1564, 1565, 1566, 1567, 1568, 1569, 1570, 1571, 1572, 1573, 1574, 1575, 1576,
|
|
40531
|
-
1577, 1578, 1579, 1580, 1581, 1582, 1583, 1584, 1585, 1586, 1587, 1588, 1589, 1590, 1591, 1592, 1593, 1594, 1595,
|
|
40532
|
-
1596, 1597, 1598, 1599, 1600, 1601, 1602, 1603, 1604, 1605, 1606, 1607, 1608, 1609, 1610, 1611, 1612, 1613, 1614,
|
|
40533
|
-
1615, 1616, 1617, 1618, 1619, 1620, 1621, 1622, 1623, 1624, 1625, 1626, 1627, 1628, 1629, 1630, 1631, 1632, 1633,
|
|
40534
|
-
1634, 1635, 1636, 1637, 1638, 1639, 1640, 1641, 1642, 1643, 1644, 1645, 1646, 1647, 1648, 1649, 1650, 1651, 1652,
|
|
40535
|
-
1653, 1654, 1655, 1656, 1657, 1658, 1659, 1660, 1661, 1662, 1663, 1664, 1665, 1666, 1667, 1668, 1669, 1670, 1671,
|
|
40536
|
-
1672, 1673, 1674, 1675, 1676, 1677, 1678, 1679, 1680, 1681, 1682, 1683, 1684, 1685, 1686, 1687, 1688, 1689, 1690,
|
|
40537
|
-
1691, 1692, 1693, 1694, 1695, 1696, 1697, 1698, 1699, 1700, 1701, 1702, 1703, 1704, 1705, 1706, 1707, 1708, 1709,
|
|
40538
|
-
1710, 1711, 1712, 1713, 1714, 1715, 1716, 1717, 1718, 1719, 1720, 1721, 1722, 1723, 1724, 1725, 1726, 1727, 1728,
|
|
40539
|
-
1729, 1730, 1731, 1732, 1733, 1734, 1735, 1736, 1737, 1738, 1739, 1740, 1741, 1742, 1743, 1744, 1745, 1746, 1747,
|
|
40540
|
-
1748, 1749, 1750, 1751, 1752, 1753, 1754, 1755, 1756, 1757, 1758, 1759, 1760, 1761, 1762, 1763, 1764, 1765, 1766,
|
|
40541
|
-
1767, 1768, 1769, 1770, 1771, 1772, 1773, 1774, 1775, 1776, 1777, 1778, 1779, 1780, 1781, 1782, 1783, 1784, 1785,
|
|
40542
|
-
1786, 1787, 1788, 1789, 1790, 1791, 1792, 1793, 1794, 1795, 1796, 1797, 1798, 1799, 1800, 1801, 1802, 1803, 1804,
|
|
40543
|
-
1805, 1806, 1807, 1808, 1809, 1810, 1811, 1812, 1813, 1814, 1815, 1816, 1817, 1818, 1819, 1820, 1821, 1822, 1823,
|
|
40544
|
-
1824, 1825, 1826, 1827, 1828, 1829, 1830, 1831, 1832, 1833, 1834, 1835, 1836, 1837, 1838, 1839, 1840, 1841, 1842,
|
|
40545
|
-
1843, 1844, 1845, 1846, 1847, 1848, 1849, 1850, 1851, 1852, 1853, 1854, 1855, 1856, 1857, 1858, 1859, 1860, 1861,
|
|
40546
|
-
1862, 1863, 1864, 1865, 1866, 1867, 1868, 1869, 1870, 1871, 1872, 1873, 1874, 1875, 1876, 1877, 1878, 1879, 1880,
|
|
40547
|
-
1881, 1882, 1883, 1884, 1885, 1886, 1887, 1888, 1889, 1890, 1891, 1892, 1893, 1894, 1895, 1896, 1897, 1898, 1899,
|
|
40548
|
-
1900, 1901, 1902, 1903, 1904, 1905, 1906, 1907, 1908, 1909, 1910, 1911, 1912, 1913, 1914, 1915, 1916, 1917, 1918,
|
|
40549
|
-
1919, 1920, 1921, 1922, 1923, 1924, 1925, 1926, 1927, 1928, 1929, 1930, 1931, 1932, 1933, 1934, 1935, 1936, 1937,
|
|
40550
|
-
1938, 1939, 1940, 1941, 1942, 1943, 1944, 1945, 1946, 1947, 1948, 1949, 1950, 1951, 1952, 1953, 1954, 1955, 1956,
|
|
40551
|
-
1957, 1958, 1959, 1960, 1961, 1962, 1963, 1964, 1965, 1966, 1967, 1968, 1969, 1970, 1971, 1972, 1973, 1974, 1975,
|
|
40552
|
-
1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
|
|
40553
|
-
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013,
|
|
40554
|
-
2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025, 2026, 2027, 2028, 2029, 2030, 2031, 2032,
|
|
40555
|
-
2033, 2034, 2035, 2036, 2037, 2038, 2039, 2040, 2041, 2042, 2043, 2044, 2045, 2046, 2047, 2048, 2049, 2050, 2051,
|
|
40556
|
-
2052, 2053, 2054, 2055, 2056, 2057, 2058, 2059, 2060, 2061, 2062, 2063, 2064, 2065, 2066, 2067, 2068, 2069, 2070,
|
|
40557
|
-
2071, 2072, 2073, 2074, 2075, 2076, 2077, 2078, 2079, 2080, 2081, 2082, 2083, 2084, 2085, 2086, 2087, 2088, 2089,
|
|
40558
|
-
2090, 2091, 2092, 2093, 2094, 2095, 2096, 2097, 2098, 2099, 2100, 2101, 2102, 2103, 2104, 2105, 2106, 2107, 2108,
|
|
40559
|
-
2109, 2110, 2111, 2112, 2113, 2114, 2115, 2116, 2117, 2118, 2119, 2120, 2121, 2122, 2123, 2124, 2125, 2126, 2127,
|
|
40560
|
-
2128, 2129, 2130, 2131, 2132, 2133, 2134, 2135, 2136, 2137, 2138, 2139, 2140, 2141, 2142, 2143, 2144, 2145, 2146,
|
|
40561
|
-
2147, 2148, 2149, 2150, 2151, 2152, 2153, 2154, 2155, 2156, 2157, 2158, 2159, 2160, 2161, 2162, 2163, 2164, 2165,
|
|
40562
|
-
2166, 2167, 2168, 2169, 2170, 2171, 2172, 2173, 2174, 2175, 2176, 2177, 2178, 2179, 2180, 2181, 2182, 2183, 2184,
|
|
40563
|
-
2185, 2186, 2187, 2188, 2189, 2190, 2191, 2192, 2193, 2194, 2195, 2196, 2197, 2198, 2199, 2200, 2201, 2202, 2203,
|
|
40564
|
-
2204, 2205, 2206, 2207, 2208, 2209, 2210, 2211, 2212, 2213, 2214, 2215, 2216, 2217, 2218, 2219, 2220, 2221, 2222,
|
|
40565
|
-
2223, 2224, 2225, 2226, 2227, 2228, 2229, 2230, 2231, 2232, 2233, 2234, 2235, 2236, 2237, 2238, 2239, 2240, 2241,
|
|
40566
|
-
2242, 2243, 2244, 2245, 2246, 2247, 2248, 2249, 2250, 2251, 2252, 2253, 2254, 2255, 2256, 2257, 2258, 2259, 2260,
|
|
40567
|
-
2261, 2262, 2263, 2264, 2265, 2266, 2267, 2268, 2269, 2270, 2271, 2272, 2273, 2274, 2275, 2276, 2277, 2278, 2279,
|
|
40568
|
-
2280, 2281, 2282, 2283, 2284, 2285, 2286, 2287, 2288, 2289, 2290, 2291, 2292, 2293, 2294, 2295, 2296, 2297, 2298,
|
|
40569
|
-
2299, 2300, 2301, 2302, 2303, 2304, 2305, 2306, 2307, 2308, 2309, 2310, 2311, 2312, 2313, 2314, 2315, 2316, 2317,
|
|
40570
|
-
2318, 2319, 2320, 2321, 2322, 2323, 2324, 2325, 2326, 2327, 2328, 2329, 2330, 2331, 2332, 2333, 2334, 2335, 2336,
|
|
40571
|
-
2337, 2338, 2339, 2340, 2341, 2342, 2343, 2344, 2345, 2346, 2347, 2348, 2349, 2350, 2351, 2352, 2353, 2354, 2355,
|
|
40572
|
-
2356, 2357, 2358, 2359, 2360, 2361, 2362, 2363, 2364, 2365, 2366, 2367, 2368, 2369, 2370, 2371, 2372, 2373, 2374,
|
|
40573
|
-
2375, 2376, 2377, 2378, 2379, 2380, 2381, 2382, 2383, 2384, 2385, 2386, 2387, 2388, 2389, 2390, 2391, 2392, 2393,
|
|
40574
|
-
2394, 2395, 2396, 2397, 2398, 2399, 2400, 2401, 2402, 2403, 2404, 2405, 2406, 2407, 2408, 2409, 2410, 2411, 2412,
|
|
40575
|
-
2413, 2414, 2415, 2416, 2417, 2418, 2419, 2420, 2421, 2422, 2423, 2424, 2425, 2426, 2427, 2428, 2429, 2430, 2431,
|
|
40576
|
-
2432, 2433, 2434, 2435, 2436, 2437, 2438, 2439, 2440, 2441, 2442, 2443, 2444, 2445, 2446, 2447, 2448, 2449, 2450,
|
|
40577
|
-
2451, 2452, 2453, 2454, 2455, 2456, 2457, 2458, 2459, 2460, 2461, 2462, 2463, 2464, 2465, 2466, 2467, 2468, 2469,
|
|
40578
|
-
2470, 2471, 2472, 2473, 2474, 2475, 2476, 2477, 2478, 2479, 2480, 2481, 2482, 2483, 2484, 2485, 2486, 2487, 2488,
|
|
40579
|
-
2489, 2490, 2491, 2492, 2493, 2494, 2495, 2496, 2497, 2498, 2499, 2500, 2501, 2502, 2503, 2504, 2505, 2506, 2507,
|
|
40580
|
-
2508, 2509, 2510, 2511, 2512, 2513, 2514, 2515, 2516, 2517, 2518, 2519, 2520, 2521, 2522, 2523, 2524, 2525, 2526,
|
|
40581
|
-
2527, 2528, 2529, 2530, 2531, 2532, 2533, 2534, 2535, 2536, 2537, 2538, 2539, 2540, 2541, 2542, 2543, 2544, 2545,
|
|
40582
|
-
2546, 2547, 2548, 2549, 2550, 2551, 2552, 2553, 2554, 2555, 2556, 2557, 2558, 2559, 2560, 2561, 2562, 2563, 2564,
|
|
40583
|
-
2565, 2566, 2567, 2568, 2569, 2570, 2571, 2572, 2573, 2574, 2575, 2576, 2577, 2578, 2579, 2580, 2581, 2582, 2583,
|
|
40584
|
-
2584, 2585, 2586, 2587, 2588, 2589, 2590, 2591, 2592, 2593, 2594, 2595, 2596, 2597, 2598, 2599, 2600, 2601, 2602,
|
|
40585
|
-
2603, 2604, 2605, 2606, 2607, 2608, 2609, 2610, 2611, 2612, 2613, 2614, 2615, 2616, 2617, 2618, 2619, 2620, 2621,
|
|
40586
|
-
2622, 2623, 2624, 2625, 2626, 2627, 2628, 2629, 2630, 2631, 2632, 2633, 2634, 2635, 2636, 2637, 2638, 2639, 2640,
|
|
40587
|
-
2641, 2642, 2643, 2644, 2645, 2646, 2647, 2648, 2649, 2650, 2651, 2652, 2653, 2654, 2655, 2656, 2657, 2658, 2659,
|
|
40588
|
-
2660, 2661, 2662, 2663, 2664, 2665, 2666, 2667, 2668, 2669, 2670, 2671, 2672, 2673, 2674, 2675, 2676, 2677, 2678,
|
|
40589
|
-
2679, 2680, 2681, 2682, 2683, 2684, 2685, 2686, 2687, 2688, 2689, 2690, 2691, 2692, 2693, 2694, 2695, 2696, 2697,
|
|
40590
|
-
2698, 2699, 2700, 2701, 2702, 2703, 2704, 2705, 2706, 2707, 2708, 2709, 2710, 2711, 2712, 2713, 2714, 2715, 2716,
|
|
40591
|
-
2717, 2718, 2719, 2720, 2721, 2722, 2723, 2724, 2725, 2726, 2727, 2728, 2729, 2730, 2731, 2732, 2733, 2734, 2735,
|
|
40592
|
-
2736, 2737, 2738, 2739, 2740, 2741, 2742, 2743, 2744, 2745, 2746, 2747, 2748, 2749, 2750, 2751, 2752, 2753, 2754,
|
|
40593
|
-
2755, 2756, 2757, 2758, 2759, 2760, 2761, 2762, 2763, 2764, 2765, 2766, 2767, 2768, 2769, 2770, 2771, 2772, 2773,
|
|
40594
|
-
2774, 2775, 2776, 2777, 2778, 2779, 2780, 2781, 2782, 2783, 2784, 2785, 2786, 2787, 2788, 2789, 2790, 2791, 2792,
|
|
40595
|
-
2793, 2794, 2795, 2796, 2797, 2798, 2799, 2800, 2801, 2802, 2803, 2804, 2805, 2806, 2807, 2808, 2809, 2810, 2811,
|
|
40596
|
-
2812, 2813, 2814, 2815, 2816, 2817, 2818, 2819, 2820, 2821, 2822, 2823, 2824, 2825, 2826, 2827, 2828, 2829, 2830,
|
|
40597
|
-
2831, 2832, 2833, 2834, 2835, 2836, 2837, 2838, 2839, 2840, 2841, 2842, 2843, 2844, 2845, 2846, 2847, 2848, 2849,
|
|
40598
|
-
2850, 2851, 2852, 2853, 2854, 2855, 2856, 2857, 2858, 2859, 2860, 2861, 2862, 2863, 2864, 2865, 2866, 2867, 2868,
|
|
40599
|
-
2869, 2870, 2871, 2872, 2873, 2874, 2875, 2876, 2877, 2878, 2879, 2880, 2881, 2882, 2883, 2884, 2885, 2886, 2887,
|
|
40600
|
-
2888, 2889, 2890, 2891, 2892, 2893, 2894, 2895, 2896, 2897, 2898, 2899, 2900, 2901, 2902, 2903, 2904, 2905, 2906,
|
|
40601
|
-
2907, 2908, 2909, 2910, 2911, 2912, 2913, 2914, 2915, 2916, 2917, 2918, 2919, 2920, 2921, 2922, 2923, 2924, 2925,
|
|
40602
|
-
2926, 2927, 2928, 2929, 2930, 2931, 2932, 2933, 2934, 2935, 2936, 2937, 2938, 2939, 2940, 2941, 2942, 2943, 2944,
|
|
40603
|
-
2945, 2946, 2947, 2948, 2949, 2950, 2951, 2952, 2953, 2954, 2955, 2956, 2957, 2958, 2959, 2960, 2961, 2962, 2963,
|
|
40604
|
-
2964, 2965, 2966, 2967, 2968, 2969, 2970, 2971, 2972, 2973, 2974, 2975, 2976, 2977, 2978, 2979, 2980, 2981, 2982,
|
|
40605
|
-
2983, 2984, 2985, 2986, 2987, 2988, 2989, 2990, 2991, 2992, 2993, 2994, 2995, 2996, 2997, 2998, 2999, 3000, 3001,
|
|
40606
|
-
3002, 3003, 3004, 3005, 3006, 3007, 3008, 3009, 3010, 3011, 3012, 3013, 3014, 3015, 3016, 3017, 3018, 3019, 3020,
|
|
40607
|
-
3021, 3022, 3023, 3024, 3025, 3026, 3027, 3028, 3029, 3030, 3031, 3032, 3033, 3034, 3035, 3036, 3037, 3038, 3039,
|
|
40608
|
-
3040, 3041, 3042, 3043, 3044, 3045, 3046, 3047, 3048, 3049, 3050, 3051, 3052, 3053, 3054, 3055, 3056, 3057, 3058,
|
|
40609
|
-
3059, 3060, 3061, 3062, 3063, 3064, 3065, 3066, 3067, 3068, 3069, 3070, 3071, 3072, 3073, 3074, 3075, 3076, 3077,
|
|
40610
|
-
3078, 3079, 3080, 3081, 3082, 3083, 3084, 3085, 3086, 3087, 3088, 3089, 3090, 3091, 3092, 3093, 3094, 3095, 3096,
|
|
40611
|
-
3097, 3098, 3099, 3100, 3101, 3102, 3103, 3104, 3105, 3106, 3107, 3108, 3109, 3110, 3111, 3112, 3113, 3114, 3115,
|
|
40612
|
-
3116, 3117, 3118, 3119, 3120, 3121, 3122, 3123, 3124, 3125, 3126, 3127, 3128, 3129, 3130, 3131, 3132, 3133, 3134,
|
|
40613
|
-
3135, 3136, 3137, 3138, 3139, 3140, 3141, 3142, 3143, 3144, 3145, 3146, 3147, 3148, 3149, 3150, 3151, 3152, 3153,
|
|
40614
|
-
3154, 3155, 3156, 3157, 3158, 3159, 3160, 3161, 3162, 3163, 3164, 3165, 3166, 3167, 3168, 3169, 3170, 3171, 3172,
|
|
40615
|
-
3173, 3174, 3175, 3176, 3177, 3178, 3179, 3180, 3181, 3182, 3183, 3184, 3185, 3186, 3187, 3188, 3189, 3190, 3191,
|
|
40616
|
-
3192, 3193, 3194, 3195, 3196, 3197, 3198, 3199, 3200, 3201, 3202, 3203, 3204, 3205, 3206, 3207, 3208, 3209, 3210,
|
|
40617
|
-
3211, 3212, 3213, 3214, 3215, 3216, 3217, 3218, 3219, 3220, 3221, 3222, 3223, 3224, 3225, 3226, 3227, 3228, 3229,
|
|
40618
|
-
3230, 3231, 3232, 3233, 3234, 3235, 3236, 3237, 3238, 3239, 3240, 3241, 3242, 3243, 3244, 3245, 3246, 3247, 3248,
|
|
40619
|
-
3249, 3250, 3251, 3252, 3253, 3254, 3255, 3256, 3257, 3258, 3259, 3260, 3261, 3262, 3263, 3264, 3265, 3266, 3267,
|
|
40620
|
-
3268, 3269, 3270, 3271, 3272, 3273, 3274, 3275, 3276, 3277, 3278, 3279, 3280, 3281, 3282, 3283, 3284, 3285, 3286,
|
|
40621
|
-
3287, 3288, 3289, 3290, 3291, 3292, 3293, 3294, 3295, 3296, 3297, 3298, 3299, 3300, 3301, 3302, 3303, 3304, 3305,
|
|
40622
|
-
3306, 3307, 3308, 3309, 3310, 3311, 3312, 3313, 3314, 3315, 3316, 3317, 3318, 3319, 3320, 3321, 3322, 3323, 3324,
|
|
40623
|
-
3325, 3326, 3327, 3328, 3329, 3330, 3331, 3332, 3333, 3334, 3335, 3336, 3337, 3338, 3339, 3340, 3341, 3342, 3343,
|
|
40624
|
-
3344, 3345, 3346, 3347, 3348, 3349, 3350, 3351, 3352, 3353, 3354, 3355, 3356, 3357, 3358, 3359, 3360, 3361, 3362,
|
|
40625
|
-
3363, 3364, 3365, 3366, 3367, 3368, 3369, 3370, 3371, 3372, 3373, 3374, 3375, 3376, 3377, 3378, 3379, 3380, 3381,
|
|
40626
|
-
3382, 3383, 3384, 3385, 3386, 3387, 3388, 3389, 3390, 3391, 3392, 3393, 3394, 3395, 3396, 3397, 3398, 3399, 3400,
|
|
40627
|
-
3401, 3402, 3403, 3404, 3405, 3406, 3407, 3408, 3409, 3410, 3411, 3412, 3413, 3414, 3415, 3416, 3417, 3418, 3419,
|
|
40628
|
-
3420, 3421, 3422, 3423, 3424, 3425, 3426, 3427, 3428, 3429, 3430, 3431, 3432, 3433, 3434, 3435, 3436, 3437, 3438,
|
|
40629
|
-
3439, 3440, 3441, 3442, 3443, 3444, 3445, 3446, 3447, 3448, 3449, 3450, 3451, 3452, 3453, 3454, 3455, 3456, 3457,
|
|
40630
|
-
3458, 3459, 3460, 3461, 3462, 3463, 3464, 3465, 3466, 3467, 3468, 3469, 3470, 3471, 3472, 3473, 3474, 3475, 3476,
|
|
40631
|
-
3477, 3478, 3479, 3480, 3481, 3482, 3483, 3484, 3485, 3486, 3487, 3488, 3489, 3490, 3491, 3492, 3493, 3494, 3495,
|
|
40632
|
-
3496, 3497, 3498, 3499, 3500, 3501, 3502, 3503, 3504, 3505, 3506, 3507, 3508, 3509, 3510, 3511, 3512, 3513, 3514,
|
|
40633
|
-
3515, 3516, 3517, 3518, 3519, 3520, 3521, 3522, 3523, 3524, 3525, 3526, 3527, 3528, 3529, 3530, 3531, 3532, 3533,
|
|
40634
|
-
3534, 3535, 3536, 3537, 3538, 3539, 3540, 3541, 3542, 3543, 3544, 3545, 3546, 3547, 3548, 3549, 3550, 3551, 3552,
|
|
40635
|
-
3553, 3554, 3555, 3556, 3557, 3558, 3559, 3560, 3561, 3562, 3563, 3564, 3565, 3566, 3567, 3568, 3569, 3570, 3571,
|
|
40636
|
-
3572, 3573, 3574, 3575, 3576, 3577, 3578, 3579, 3580, 3581, 3582, 3583, 3584, 3585, 3586, 3587, 3588, 3589, 3590,
|
|
40637
|
-
3591, 3592, 3593, 3594, 3595, 3596, 3597, 3598, 3599, 3600, 3601, 3602, 3603, 3604, 3605, 3606, 3607, 3608, 3609,
|
|
40638
|
-
3610, 3611, 3612, 3613, 3614, 3615, 3616, 3617, 3618, 3619, 3620, 3621, 3622, 3623, 3624, 3625, 3626, 3627, 3628,
|
|
40639
|
-
3629, 3630, 3631, 3632, 3633, 3634, 3635, 3636, 3637, 3638, 3639, 3640, 3641, 3642, 3643, 3644, 3645, 3646, 3647,
|
|
40640
|
-
3648, 3649, 3650, 3651, 3652, 3653, 3654, 3655, 3656, 3657, 3658, 3659, 3660, 3661, 3662, 3663, 3664, 3665, 3666,
|
|
40641
|
-
3667, 3668, 3669, 3670, 3671, 3672, 3673, 3674, 3675, 3676, 3677, 3678, 3679, 3680, 3681, 3682, 3683, 3684, 3685,
|
|
40642
|
-
3686, 3687, 3688, 3689, 3690, 3691, 3692, 3693, 3694, 3695, 3696, 3697, 3698, 3699, 3700, 3701, 3702, 3703, 3704,
|
|
40643
|
-
3705, 3706, 3707, 3708, 3709, 3710, 3711, 3712, 3713, 3714, 3715, 3716, 3717, 3718, 3719, 3720, 3721, 3722, 3723,
|
|
40644
|
-
3724, 3725, 3726, 3727, 3728, 3729, 3730, 3731, 3732, 3733, 3734, 3735, 3736, 3737, 3738, 3739, 3740, 3741, 3742,
|
|
40645
|
-
3743, 3744, 3745, 3746, 3747, 3748, 3749, 3750, 3751, 3752, 3753, 3754, 3755, 3756, 3757, 3758, 3759, 3760, 3761,
|
|
40646
|
-
3762, 3763, 3764, 3765, 3766, 3767, 3768, 3769, 3770, 3771, 3772, 3773, 3774, 3775, 3776, 3777, 3778, 3779, 3780,
|
|
40647
|
-
3781, 3782, 3783, 3784, 3785, 3786, 3787, 3788, 3789, 3790, 3791, 3792, 3793, 3794, 3795, 3796, 3797, 3798, 3799,
|
|
40648
|
-
3800, 3801, 3802, 3803, 3804, 3805, 3806, 3807, 3808, 3809, 3810, 3811, 3812, 3813, 3814, 3815, 3816, 3817, 3818,
|
|
40649
|
-
3819, 3820, 3821, 3822, 3823, 3824, 3825, 3826, 3827, 3828, 3829, 3830, 3831, 3832, 3833, 3834, 3835, 3836, 3837,
|
|
40650
|
-
3838, 3839, 3840, 3841, 3842, 3843, 3844, 3845, 3846, 3847, 3848, 3849, 3850, 3851, 3852, 3853, 3854, 3855, 3856,
|
|
40651
|
-
3857, 3858, 3859, 3860, 3861, 3862, 3863, 3864, 3865, 3866, 3867, 3868, 3869, 3870, 3871, 3872, 3873, 3874, 3875,
|
|
40652
|
-
3876, 3877, 3878, 3879, 3880, 3881, 3882, 3883, 3884, 3885, 3886, 3887, 3888, 3889, 3890, 3891, 3892, 3893, 3894,
|
|
40653
|
-
3895, 3896, 3897, 3898, 3899, 3900, 3901, 3902, 3903, 3904, 3905, 3906, 3907, 3908, 3909, 3910, 3911, 3912, 3913,
|
|
40654
|
-
3914, 3915, 3916, 3917, 3918, 3919, 3920, 3921, 3922, 3923, 3924, 3925, 3926, 3927, 3928, 3929, 3930, 3931, 3932,
|
|
40655
|
-
3933, 3934, 3935, 3936, 3937, 3938, 3939, 3940, 3941, 3942, 3943, 3944, 3945, 3946, 3947, 3948, 3949, 3950, 3951,
|
|
40656
|
-
3952, 3953, 3954, 3955, 3956, 3957, 3958, 3959, 3960, 3961, 3962, 3963, 3964, 3965, 3966, 3967, 3968, 3969, 3970,
|
|
40657
|
-
3971, 3972, 3973, 3974, 3975, 3976, 3977, 3978, 3979, 3980, 3981, 3982, 3983, 3984, 3985, 3986, 3987, 3988, 3989,
|
|
40658
|
-
3990, 3991, 3992, 3993, 3994, 3995, 3996, 3997, 3998, 3999, 4000, 4001, 4002, 4003, 4004, 4005, 4006, 4007, 4008,
|
|
40659
|
-
4009, 4010, 4011, 4012, 4013, 4014, 4015, 4016, 4017, 4018, 4019, 4020, 4021, 4022, 4023, 4024, 4025, 4026, 4027,
|
|
40660
|
-
4028, 4029, 4030, 4031, 4032, 4033, 4034, 4035, 4036, 4037, 4038, 4039, 4040, 4041, 4042, 4043, 4044, 4045, 4046,
|
|
40661
|
-
4047, 4048, 4049, 4050, 4051, 4052, 4053, 4054, 4055, 4056, 4057, 4058, 4059, 4060, 4061, 4062, 4063, 4064, 4065,
|
|
40662
|
-
4066, 4067, 4068, 4069, 4070, 4071, 4072, 4073, 4074, 4075, 4076, 4077, 4078, 4079, 4080, 4081, 4082, 4083, 4084,
|
|
40663
|
-
4085, 4086, 4087, 4088, 4089, 4090, 4091, 4092, 4093, 4094, 4095};
|
|
40664
|
-
#else
|
|
40665
|
-
#error Unsupported VECTOR_SIZE!
|
|
40161
|
+
#ifdef __clang__
|
|
40162
|
+
#pragma clang diagnostic pop
|
|
40666
40163
|
#endif
|
|
40667
40164
|
|
|
40668
40165
|
} // namespace duckdb
|
|
@@ -40841,31 +40338,40 @@ constexpr const LogicalTypeId LogicalType::VARCHAR;
|
|
|
40841
40338
|
|
|
40842
40339
|
constexpr const LogicalTypeId LogicalType::BLOB;
|
|
40843
40340
|
constexpr const LogicalTypeId LogicalType::INTERVAL;
|
|
40341
|
+
constexpr const LogicalTypeId LogicalType::ROW_TYPE;
|
|
40844
40342
|
|
|
40845
40343
|
// TODO these are incomplete and should maybe not exist as such
|
|
40846
40344
|
constexpr const LogicalTypeId LogicalType::TABLE;
|
|
40847
40345
|
|
|
40848
40346
|
constexpr const LogicalTypeId LogicalType::ANY;
|
|
40849
40347
|
|
|
40850
|
-
const vector<LogicalType> LogicalType::
|
|
40851
|
-
|
|
40852
|
-
|
|
40853
|
-
|
|
40854
|
-
|
|
40855
|
-
|
|
40856
|
-
|
|
40857
|
-
|
|
40858
|
-
|
|
40859
|
-
|
|
40860
|
-
|
|
40861
|
-
|
|
40862
|
-
|
|
40863
|
-
|
|
40864
|
-
|
|
40865
|
-
|
|
40866
|
-
|
|
40867
|
-
|
|
40868
|
-
|
|
40348
|
+
const vector<LogicalType> LogicalType::Numeric() {
|
|
40349
|
+
vector<LogicalType> types = {LogicalType::TINYINT, LogicalType::SMALLINT, LogicalType::INTEGER,
|
|
40350
|
+
LogicalType::BIGINT, LogicalType::HUGEINT, LogicalType::FLOAT,
|
|
40351
|
+
LogicalType::DOUBLE, LogicalTypeId::DECIMAL, LogicalType::UTINYINT,
|
|
40352
|
+
LogicalType::USMALLINT, LogicalType::UINTEGER, LogicalType::UBIGINT};
|
|
40353
|
+
return types;
|
|
40354
|
+
}
|
|
40355
|
+
|
|
40356
|
+
const vector<LogicalType> LogicalType::Integral() {
|
|
40357
|
+
vector<LogicalType> types = {LogicalType::TINYINT, LogicalType::SMALLINT, LogicalType::INTEGER,
|
|
40358
|
+
LogicalType::BIGINT, LogicalType::HUGEINT, LogicalType::UTINYINT,
|
|
40359
|
+
LogicalType::USMALLINT, LogicalType::UINTEGER, LogicalType::UBIGINT};
|
|
40360
|
+
return types;
|
|
40361
|
+
}
|
|
40362
|
+
|
|
40363
|
+
const vector<LogicalType> LogicalType::AllTypes() {
|
|
40364
|
+
vector<LogicalType> types = {
|
|
40365
|
+
LogicalType::BOOLEAN, LogicalType::TINYINT, LogicalType::SMALLINT, LogicalType::INTEGER,
|
|
40366
|
+
LogicalType::BIGINT, LogicalType::DATE, LogicalType::TIMESTAMP, LogicalType::DOUBLE,
|
|
40367
|
+
LogicalType::FLOAT, LogicalType::VARCHAR, LogicalType::BLOB, LogicalType::INTERVAL,
|
|
40368
|
+
LogicalType::HUGEINT, LogicalTypeId::DECIMAL, LogicalType::UTINYINT, LogicalType::USMALLINT,
|
|
40369
|
+
LogicalType::UINTEGER, LogicalType::UBIGINT, LogicalType::TIME, LogicalTypeId::LIST,
|
|
40370
|
+
LogicalTypeId::STRUCT, LogicalType::DATE_TZ, LogicalType::TIME_TZ, LogicalType::TIMESTAMP_TZ,
|
|
40371
|
+
LogicalTypeId::MAP, LogicalType::UUID};
|
|
40372
|
+
return types;
|
|
40373
|
+
}
|
|
40374
|
+
|
|
40869
40375
|
const PhysicalType ROW_TYPE = PhysicalType::INT64;
|
|
40870
40376
|
|
|
40871
40377
|
// LCOV_EXCL_START
|
|
@@ -42038,12 +41544,15 @@ static bool TemplatedBooleanOperation(const Value &left, const Value &right) {
|
|
|
42038
41544
|
const auto &left_type = left.type();
|
|
42039
41545
|
const auto &right_type = right.type();
|
|
42040
41546
|
if (left_type != right_type) {
|
|
42041
|
-
|
|
42042
|
-
|
|
42043
|
-
|
|
42044
|
-
|
|
41547
|
+
Value left_copy = left;
|
|
41548
|
+
Value right_copy = right;
|
|
41549
|
+
|
|
41550
|
+
LogicalType comparison_type = BoundComparisonExpression::BindComparison(left_type, right_type);
|
|
41551
|
+
if (!left_copy.TryCastAs(comparison_type) || !right_copy.TryCastAs(comparison_type)) {
|
|
42045
41552
|
return false;
|
|
42046
41553
|
}
|
|
41554
|
+
D_ASSERT(left_copy.type() == right_copy.type());
|
|
41555
|
+
return TemplatedBooleanOperation<OP>(left_copy, right_copy);
|
|
42047
41556
|
}
|
|
42048
41557
|
switch (left_type.InternalType()) {
|
|
42049
41558
|
case PhysicalType::BOOL:
|
|
@@ -43234,8 +42743,9 @@ static idx_t DistinctSelectConstant(Vector &left, Vector &right, const Selection
|
|
|
43234
42743
|
template <class LEFT_TYPE, class RIGHT_TYPE, class OP, bool DENSE>
|
|
43235
42744
|
static idx_t DistinctSelect(Vector &left, Vector &right, idx_t vcount, const SelectionVector *sel, idx_t count,
|
|
43236
42745
|
SelectionVector *true_sel, SelectionVector *false_sel) {
|
|
42746
|
+
SelectionVector owned_sel;
|
|
43237
42747
|
if (!sel) {
|
|
43238
|
-
sel =
|
|
42748
|
+
sel = FlatVector::IncrementalSelectionVector(count, owned_sel);
|
|
43239
42749
|
}
|
|
43240
42750
|
if (left.GetVectorType() == VectorType::CONSTANT_VECTOR && right.GetVectorType() == VectorType::CONSTANT_VECTOR) {
|
|
43241
42751
|
return DistinctSelectConstant<LEFT_TYPE, RIGHT_TYPE, OP>(left, right, sel, count, true_sel, false_sel);
|
|
@@ -43571,8 +43081,9 @@ template <class OP, bool DENSE, class OPNESTED>
|
|
|
43571
43081
|
static idx_t DistinctSelectNested(Vector &left, Vector &right, idx_t vcount, const SelectionVector *sel, idx_t count,
|
|
43572
43082
|
SelectionVector *true_sel, SelectionVector *false_sel) {
|
|
43573
43083
|
// We need multiple, real selections
|
|
43084
|
+
SelectionVector owned_sel;
|
|
43574
43085
|
if (!sel) {
|
|
43575
|
-
sel =
|
|
43086
|
+
sel = FlatVector::IncrementalSelectionVector(count, owned_sel);
|
|
43576
43087
|
}
|
|
43577
43088
|
|
|
43578
43089
|
SelectionVector true_vec;
|
|
@@ -45499,8 +45010,9 @@ void VectorOperations::Copy(const Vector &source, Vector &target, idx_t source_c
|
|
|
45499
45010
|
break;
|
|
45500
45011
|
}
|
|
45501
45012
|
case VectorType::FLAT_VECTOR: {
|
|
45502
|
-
|
|
45503
|
-
|
|
45013
|
+
SelectionVector owned_sel;
|
|
45014
|
+
auto sel = FlatVector::IncrementalSelectionVector(source_count, owned_sel);
|
|
45015
|
+
VectorOperations::Copy(source, target, *sel, source_count, source_offset, target_offset);
|
|
45504
45016
|
break;
|
|
45505
45017
|
}
|
|
45506
45018
|
case VectorType::SEQUENCE_VECTOR: {
|
|
@@ -45509,8 +45021,9 @@ void VectorOperations::Copy(const Vector &source, Vector &target, idx_t source_c
|
|
|
45509
45021
|
Vector flattened(source.GetType());
|
|
45510
45022
|
VectorOperations::GenerateSequence(flattened, source_count, start, increment);
|
|
45511
45023
|
|
|
45512
|
-
|
|
45513
|
-
|
|
45024
|
+
SelectionVector owned_sel;
|
|
45025
|
+
auto sel = FlatVector::IncrementalSelectionVector(source_count, owned_sel);
|
|
45026
|
+
VectorOperations::Copy(flattened, target, *sel, source_count, source_offset, target_offset);
|
|
45514
45027
|
break;
|
|
45515
45028
|
}
|
|
45516
45029
|
default:
|
|
@@ -46739,7 +46252,7 @@ idx_t GroupedAggregateHashTable::FindOrCreateGroupsInternal(DataChunk &groups, V
|
|
|
46739
46252
|
auto hash_salts_ptr = FlatVector::GetData<uint16_t>(hash_salts);
|
|
46740
46253
|
|
|
46741
46254
|
// we start out with all entries [0, 1, 2, ..., groups.size()]
|
|
46742
|
-
const SelectionVector *sel_vector =
|
|
46255
|
+
const SelectionVector *sel_vector = FlatVector::IncrementalSelectionVector();
|
|
46743
46256
|
|
|
46744
46257
|
idx_t remaining_entries = groups.size();
|
|
46745
46258
|
|
|
@@ -46870,8 +46383,8 @@ void GroupedAggregateHashTable::FlushMove(Vector &source_addresses, Vector &sour
|
|
|
46870
46383
|
for (idx_t i = 0; i < groups.ColumnCount(); i++) {
|
|
46871
46384
|
auto &column = groups.data[i];
|
|
46872
46385
|
const auto col_offset = layout.GetOffsets()[i];
|
|
46873
|
-
RowOperations::Gather(source_addresses, FlatVector::
|
|
46874
|
-
FlatVector::
|
|
46386
|
+
RowOperations::Gather(source_addresses, *FlatVector::IncrementalSelectionVector(), column,
|
|
46387
|
+
*FlatVector::IncrementalSelectionVector(), count, col_offset, i);
|
|
46875
46388
|
}
|
|
46876
46389
|
|
|
46877
46390
|
SelectionVector new_groups(STANDARD_VECTOR_SIZE);
|
|
@@ -46998,8 +46511,8 @@ idx_t GroupedAggregateHashTable::Scan(idx_t &scan_position, DataChunk &result) {
|
|
|
46998
46511
|
for (idx_t i = 0; i < group_cols; i++) {
|
|
46999
46512
|
auto &column = result.data[i];
|
|
47000
46513
|
const auto col_offset = layout.GetOffsets()[i];
|
|
47001
|
-
RowOperations::Gather(addresses, FlatVector::
|
|
47002
|
-
FlatVector::
|
|
46514
|
+
RowOperations::Gather(addresses, *FlatVector::IncrementalSelectionVector(), column,
|
|
46515
|
+
*FlatVector::IncrementalSelectionVector(), result.size(), col_offset, i);
|
|
47003
46516
|
}
|
|
47004
46517
|
|
|
47005
46518
|
RowOperations::FinalizeStates(layout, addresses, result, group_cols);
|
|
@@ -48006,8 +47519,9 @@ static idx_t NestedSelectOperation(Vector &left, Vector &right, const SelectionV
|
|
|
48006
47519
|
// a selection vector in a single pass. But to implement progressive comparisons,
|
|
48007
47520
|
// we have to make multiple passes, so we need to keep track of the original input positions
|
|
48008
47521
|
// and then scatter the output selections when we are done.
|
|
47522
|
+
SelectionVector owned_sel;
|
|
48009
47523
|
if (!sel) {
|
|
48010
|
-
sel =
|
|
47524
|
+
sel = FlatVector::IncrementalSelectionVector(vcount, owned_sel);
|
|
48011
47525
|
}
|
|
48012
47526
|
|
|
48013
47527
|
VectorData lvdata, rvdata;
|
|
@@ -48027,7 +47541,9 @@ static idx_t NestedSelectOperation(Vector &left, Vector &right, const SelectionV
|
|
|
48027
47541
|
|
|
48028
47542
|
// If everything was NULL, fill in false_sel with sel
|
|
48029
47543
|
if (count == 0) {
|
|
48030
|
-
|
|
47544
|
+
SelectionVector owned_flat_sel;
|
|
47545
|
+
auto flat_sel = FlatVector::IncrementalSelectionVector(vcount, owned_sel);
|
|
47546
|
+
ScatterSelection(false_sel, no_match_count, sel, *flat_sel);
|
|
48031
47547
|
return count;
|
|
48032
47548
|
}
|
|
48033
47549
|
|
|
@@ -48761,8 +48277,10 @@ idx_t ExpressionExecutor::DefaultSelect(const Expression &expr, ExpressionState
|
|
|
48761
48277
|
|
|
48762
48278
|
VectorData idata;
|
|
48763
48279
|
intermediate.Orrify(count, idata);
|
|
48280
|
+
|
|
48281
|
+
SelectionVector owned_sel;
|
|
48764
48282
|
if (!sel) {
|
|
48765
|
-
sel =
|
|
48283
|
+
sel = FlatVector::IncrementalSelectionVector(count, owned_sel);
|
|
48766
48284
|
}
|
|
48767
48285
|
if (!idata.validity.AllValid()) {
|
|
48768
48286
|
return DefaultSelectSwitch<false>(idata, sel, count, true_sel, false_sel);
|
|
@@ -50636,7 +50154,7 @@ idx_t JoinHashTable::PrepareKeys(DataChunk &keys, unique_ptr<VectorData[]> &key_
|
|
|
50636
50154
|
key_data = keys.Orrify();
|
|
50637
50155
|
|
|
50638
50156
|
// figure out which keys are NULL, and create a selection vector out of them
|
|
50639
|
-
current_sel =
|
|
50157
|
+
current_sel = FlatVector::IncrementalSelectionVector();
|
|
50640
50158
|
idx_t added_count = keys.size();
|
|
50641
50159
|
if (build_side && IsRightOuterJoin(join_type)) {
|
|
50642
50160
|
// in case of a right or full outer join, we cannot remove NULL keys from the build side
|
|
@@ -50944,7 +50462,7 @@ void ScanStructure::GatherResult(Vector &result, const SelectionVector &result_v
|
|
|
50944
50462
|
|
|
50945
50463
|
void ScanStructure::GatherResult(Vector &result, const SelectionVector &sel_vector, const idx_t count,
|
|
50946
50464
|
const idx_t col_idx) {
|
|
50947
|
-
GatherResult(result, FlatVector::
|
|
50465
|
+
GatherResult(result, *FlatVector::IncrementalSelectionVector(), sel_vector, count, col_idx);
|
|
50948
50466
|
}
|
|
50949
50467
|
|
|
50950
50468
|
void ScanStructure::NextInnerJoin(DataChunk &keys, DataChunk &left, DataChunk &result) {
|
|
@@ -51267,7 +50785,7 @@ void JoinHashTable::ScanFullOuter(DataChunk &result, JoinHTScanState &state) {
|
|
|
51267
50785
|
result.SetCardinality(found_entries);
|
|
51268
50786
|
if (found_entries > 0) {
|
|
51269
50787
|
idx_t left_column_count = result.ColumnCount() - build_types.size();
|
|
51270
|
-
const auto &sel_vector = FlatVector::
|
|
50788
|
+
const auto &sel_vector = *FlatVector::IncrementalSelectionVector();
|
|
51271
50789
|
// set the left side as a constant NULL
|
|
51272
50790
|
for (idx_t i = 0; i < left_column_count; i++) {
|
|
51273
50791
|
Vector &vec = result.data[i];
|
|
@@ -53082,8 +52600,9 @@ void PhysicalSimpleAggregate::Combine(ExecutionContext &context, GlobalSinkState
|
|
|
53082
52600
|
aggregate.function.combine(source_state, dest_state, 1);
|
|
53083
52601
|
}
|
|
53084
52602
|
|
|
52603
|
+
auto &client_profiler = QueryProfiler::Get(context.client);
|
|
53085
52604
|
context.thread.profiler.Flush(this, &source.child_executor, "child_executor", 0);
|
|
53086
|
-
|
|
52605
|
+
client_profiler.Flush(context.thread.profiler);
|
|
53087
52606
|
}
|
|
53088
52607
|
|
|
53089
52608
|
SinkFinalizeType PhysicalSimpleAggregate::Finalize(Pipeline &pipeline, Event &event, ClientContext &context,
|
|
@@ -54888,7 +54407,8 @@ SinkResultType PhysicalExplainAnalyze::Sink(ExecutionContext &context, GlobalSin
|
|
|
54888
54407
|
SinkFinalizeType PhysicalExplainAnalyze::Finalize(Pipeline &pipeline, Event &event, ClientContext &context,
|
|
54889
54408
|
GlobalSinkState &gstate_p) const {
|
|
54890
54409
|
auto &gstate = (ExplainAnalyzeStateGlobalState &)gstate_p;
|
|
54891
|
-
|
|
54410
|
+
auto &profiler = QueryProfiler::Get(context);
|
|
54411
|
+
gstate.analyzed_plan = profiler.ToString();
|
|
54892
54412
|
return SinkFinalizeType::READY;
|
|
54893
54413
|
}
|
|
54894
54414
|
|
|
@@ -55412,7 +54932,10 @@ public:
|
|
|
55412
54932
|
static void LoadExternalExtension(DatabaseInstance &db, const string &extension);
|
|
55413
54933
|
|
|
55414
54934
|
private:
|
|
55415
|
-
static const vector<string>
|
|
54935
|
+
static const vector<string> PathComponents();
|
|
54936
|
+
|
|
54937
|
+
private:
|
|
54938
|
+
static ExtensionLoadResult LoadExtensionInternal(DuckDB &db, const std::string &extension, bool initial_load);
|
|
55416
54939
|
};
|
|
55417
54940
|
|
|
55418
54941
|
} // namespace duckdb
|
|
@@ -57666,8 +57189,9 @@ SinkResultType PhysicalHashJoin::Sink(ExecutionContext &context, GlobalSinkState
|
|
|
57666
57189
|
|
|
57667
57190
|
void PhysicalHashJoin::Combine(ExecutionContext &context, GlobalSinkState &gstate, LocalSinkState &lstate) const {
|
|
57668
57191
|
auto &state = (HashJoinLocalState &)lstate;
|
|
57192
|
+
auto &client_profiler = QueryProfiler::Get(context.client);
|
|
57669
57193
|
context.thread.profiler.Flush(this, &state.build_executor, "build_executor", 1);
|
|
57670
|
-
|
|
57194
|
+
client_profiler.Flush(context.thread.profiler);
|
|
57671
57195
|
}
|
|
57672
57196
|
|
|
57673
57197
|
//===--------------------------------------------------------------------===//
|
|
@@ -58081,7 +57605,7 @@ void PhysicalIndexJoin::Output(ExecutionContext &context, DataChunk &input, Data
|
|
|
58081
57605
|
}
|
|
58082
57606
|
state.rhs_chunk.Reset();
|
|
58083
57607
|
ColumnFetchState fetch_state;
|
|
58084
|
-
Vector row_ids(
|
|
57608
|
+
Vector row_ids(LogicalType::ROW_TYPE, (data_ptr_t)&fetch_rows[0]);
|
|
58085
57609
|
tbl->Fetch(transaction, state.rhs_chunk, fetch_ids, row_ids, output_sel_idx, fetch_state);
|
|
58086
57610
|
}
|
|
58087
57611
|
|
|
@@ -58431,8 +57955,10 @@ SinkResultType PhysicalNestedLoopJoin::Sink(ExecutionContext &context, GlobalSin
|
|
|
58431
57955
|
|
|
58432
57956
|
void PhysicalNestedLoopJoin::Combine(ExecutionContext &context, GlobalSinkState &gstate, LocalSinkState &lstate) const {
|
|
58433
57957
|
auto &state = (NestedLoopJoinLocalState &)lstate;
|
|
57958
|
+
auto &client_profiler = QueryProfiler::Get(context.client);
|
|
57959
|
+
|
|
58434
57960
|
context.thread.profiler.Flush(this, &state.rhs_executor, "rhs_executor", 1);
|
|
58435
|
-
|
|
57961
|
+
client_profiler.Flush(context.thread.profiler);
|
|
58436
57962
|
}
|
|
58437
57963
|
|
|
58438
57964
|
SinkFinalizeType PhysicalNestedLoopJoin::Finalize(Pipeline &pipeline, Event &event, ClientContext &context,
|
|
@@ -58864,8 +58390,10 @@ SinkResultType PhysicalPiecewiseMergeJoin::Sink(ExecutionContext &context, Globa
|
|
|
58864
58390
|
void PhysicalPiecewiseMergeJoin::Combine(ExecutionContext &context, GlobalSinkState &gstate,
|
|
58865
58391
|
LocalSinkState &lstate) const {
|
|
58866
58392
|
auto &state = (MergeJoinLocalState &)lstate;
|
|
58393
|
+
auto &client_profiler = QueryProfiler::Get(context.client);
|
|
58394
|
+
|
|
58867
58395
|
context.thread.profiler.Flush(this, &state.rhs_executor, "rhs_executor", 1);
|
|
58868
|
-
|
|
58396
|
+
client_profiler.Flush(context.thread.profiler);
|
|
58869
58397
|
}
|
|
58870
58398
|
|
|
58871
58399
|
//===--------------------------------------------------------------------===//
|
|
@@ -59450,12 +58978,13 @@ public:
|
|
|
59450
58978
|
: ExecutorTask(context), event(move(event_p)), context(context), state(state) {
|
|
59451
58979
|
}
|
|
59452
58980
|
|
|
59453
|
-
|
|
58981
|
+
TaskExecutionResult ExecuteTask(TaskExecutionMode mode) override {
|
|
59454
58982
|
// Initialize merge sorted and iterate until done
|
|
59455
58983
|
auto &global_sort_state = state.global_sort_state;
|
|
59456
58984
|
MergeSorter merge_sorter(global_sort_state, BufferManager::GetBufferManager(context));
|
|
59457
58985
|
merge_sorter.PerformInMergeRound();
|
|
59458
58986
|
event->FinishTask();
|
|
58987
|
+
return TaskExecutionResult::TASK_FINISHED;
|
|
59459
58988
|
}
|
|
59460
58989
|
|
|
59461
58990
|
private:
|
|
@@ -62791,8 +62320,9 @@ unique_ptr<LocalSinkState> PhysicalInsert::GetLocalSinkState(ExecutionContext &c
|
|
|
62791
62320
|
|
|
62792
62321
|
void PhysicalInsert::Combine(ExecutionContext &context, GlobalSinkState &gstate, LocalSinkState &lstate) const {
|
|
62793
62322
|
auto &state = (InsertLocalState &)lstate;
|
|
62323
|
+
auto &client_profiler = QueryProfiler::Get(context.client);
|
|
62794
62324
|
context.thread.profiler.Flush(this, &state.default_executor, "default_executor", 1);
|
|
62795
|
-
|
|
62325
|
+
client_profiler.Flush(context.thread.profiler);
|
|
62796
62326
|
}
|
|
62797
62327
|
|
|
62798
62328
|
//===--------------------------------------------------------------------===//
|
|
@@ -62998,8 +62528,9 @@ unique_ptr<LocalSinkState> PhysicalUpdate::GetLocalSinkState(ExecutionContext &c
|
|
|
62998
62528
|
|
|
62999
62529
|
void PhysicalUpdate::Combine(ExecutionContext &context, GlobalSinkState &gstate, LocalSinkState &lstate) const {
|
|
63000
62530
|
auto &state = (UpdateLocalState &)lstate;
|
|
62531
|
+
auto &client_profiler = QueryProfiler::Get(context.client);
|
|
63001
62532
|
context.thread.profiler.Flush(this, &state.default_executor, "default_executor", 1);
|
|
63002
|
-
|
|
62533
|
+
client_profiler.Flush(context.thread.profiler);
|
|
63003
62534
|
}
|
|
63004
62535
|
|
|
63005
62536
|
//===--------------------------------------------------------------------===//
|
|
@@ -65223,7 +64754,7 @@ void PerfectAggregateHashTable::Combine(PerfectAggregateHashTable &other) {
|
|
|
65223
64754
|
data_ptr_t target_ptr = data;
|
|
65224
64755
|
idx_t combine_count = 0;
|
|
65225
64756
|
idx_t reinit_count = 0;
|
|
65226
|
-
const auto &reinit_sel = FlatVector::
|
|
64757
|
+
const auto &reinit_sel = *FlatVector::IncrementalSelectionVector();
|
|
65227
64758
|
for (idx_t i = 0; i < total_groups; i++) {
|
|
65228
64759
|
auto has_entry_source = other.group_is_set[i];
|
|
65229
64760
|
// we only have any work to do if the source has an entry for this group
|
|
@@ -68995,25 +68526,27 @@ private:
|
|
|
68995
68526
|
};
|
|
68996
68527
|
|
|
68997
68528
|
unique_ptr<PhysicalOperator> PhysicalPlanGenerator::CreatePlan(unique_ptr<LogicalOperator> op) {
|
|
68529
|
+
auto &profiler = QueryProfiler::Get(context);
|
|
68530
|
+
|
|
68998
68531
|
// first resolve column references
|
|
68999
|
-
|
|
68532
|
+
profiler.StartPhase("column_binding");
|
|
69000
68533
|
ColumnBindingResolver resolver;
|
|
69001
68534
|
resolver.VisitOperator(*op);
|
|
69002
|
-
|
|
68535
|
+
profiler.EndPhase();
|
|
69003
68536
|
|
|
69004
68537
|
// now resolve types of all the operators
|
|
69005
|
-
|
|
68538
|
+
profiler.StartPhase("resolve_types");
|
|
69006
68539
|
op->ResolveOperatorTypes();
|
|
69007
|
-
|
|
68540
|
+
profiler.EndPhase();
|
|
69008
68541
|
|
|
69009
68542
|
// extract dependencies from the logical plan
|
|
69010
68543
|
DependencyExtractor extractor(dependencies);
|
|
69011
68544
|
extractor.VisitOperator(*op);
|
|
69012
68545
|
|
|
69013
68546
|
// then create the main physical plan
|
|
69014
|
-
|
|
68547
|
+
profiler.StartPhase("create_plan");
|
|
69015
68548
|
auto plan = CreatePlan(*op);
|
|
69016
|
-
|
|
68549
|
+
profiler.EndPhase();
|
|
69017
68550
|
return plan;
|
|
69018
68551
|
}
|
|
69019
68552
|
|
|
@@ -69375,6 +68908,7 @@ public:
|
|
|
69375
68908
|
idx_t radix_p)
|
|
69376
68909
|
: ExecutorTask(executor), event(move(event_p)), state(state_p), radix(radix_p) {
|
|
69377
68910
|
}
|
|
68911
|
+
|
|
69378
68912
|
static void FinalizeHT(RadixHTGlobalState &gstate, idx_t radix) {
|
|
69379
68913
|
D_ASSERT(gstate.partition_info.n_partitions <= gstate.finalized_hts.size());
|
|
69380
68914
|
D_ASSERT(gstate.finalized_hts[radix]);
|
|
@@ -69387,9 +68921,10 @@ public:
|
|
|
69387
68921
|
gstate.finalized_hts[radix]->Finalize();
|
|
69388
68922
|
}
|
|
69389
68923
|
|
|
69390
|
-
|
|
68924
|
+
TaskExecutionResult ExecuteTask(TaskExecutionMode mode) override {
|
|
69391
68925
|
FinalizeHT(state, radix);
|
|
69392
68926
|
event->FinishTask();
|
|
68927
|
+
return TaskExecutionResult::TASK_FINISHED;
|
|
69393
68928
|
}
|
|
69394
68929
|
|
|
69395
68930
|
private:
|
|
@@ -71375,7 +70910,7 @@ struct BitAndOperation {
|
|
|
71375
70910
|
|
|
71376
70911
|
void BitAndFun::RegisterFunction(BuiltinFunctions &set) {
|
|
71377
70912
|
AggregateFunctionSet bit_and("bit_and");
|
|
71378
|
-
for (auto &type : LogicalType::
|
|
70913
|
+
for (auto &type : LogicalType::Integral()) {
|
|
71379
70914
|
bit_and.AddFunction(GetBitfieldUnaryAggregate<BitAndOperation>(type));
|
|
71380
70915
|
}
|
|
71381
70916
|
set.AddFunction(bit_and);
|
|
@@ -71435,7 +70970,7 @@ struct BitOrOperation {
|
|
|
71435
70970
|
|
|
71436
70971
|
void BitOrFun::RegisterFunction(BuiltinFunctions &set) {
|
|
71437
70972
|
AggregateFunctionSet bit_or("bit_or");
|
|
71438
|
-
for (auto &type : LogicalType::
|
|
70973
|
+
for (auto &type : LogicalType::Integral()) {
|
|
71439
70974
|
bit_or.AddFunction(GetBitfieldUnaryAggregate<BitOrOperation>(type));
|
|
71440
70975
|
}
|
|
71441
70976
|
set.AddFunction(bit_or);
|
|
@@ -71495,7 +71030,7 @@ struct BitXorOperation {
|
|
|
71495
71030
|
|
|
71496
71031
|
void BitXorFun::RegisterFunction(BuiltinFunctions &set) {
|
|
71497
71032
|
AggregateFunctionSet bit_xor("bit_xor");
|
|
71498
|
-
for (auto &type : LogicalType::
|
|
71033
|
+
for (auto &type : LogicalType::Integral()) {
|
|
71499
71034
|
bit_xor.AddFunction(GetBitfieldUnaryAggregate<BitXorOperation>(type));
|
|
71500
71035
|
}
|
|
71501
71036
|
set.AddFunction(bit_xor);
|
|
@@ -72193,7 +71728,7 @@ unique_ptr<FunctionData> BindDecimalFirst(ClientContext &context, AggregateFunct
|
|
|
72193
71728
|
void FirstFun::RegisterFunction(BuiltinFunctions &set) {
|
|
72194
71729
|
AggregateFunctionSet first("first");
|
|
72195
71730
|
AggregateFunctionSet last("last");
|
|
72196
|
-
for (auto &type : LogicalType::
|
|
71731
|
+
for (auto &type : LogicalType::AllTypes()) {
|
|
72197
71732
|
if (type.id() == LogicalTypeId::DECIMAL) {
|
|
72198
71733
|
first.AddFunction(AggregateFunction({type}, type, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
|
72199
71734
|
BindDecimalFirst<false>, nullptr, nullptr, nullptr));
|
|
@@ -72833,7 +72368,7 @@ static AggregateFunction GetMinMaxFunction(const LogicalType &type) {
|
|
|
72833
72368
|
|
|
72834
72369
|
template <class OP, class OP_STRING, class OP_VECTOR>
|
|
72835
72370
|
static void AddMinMaxOperator(AggregateFunctionSet &set) {
|
|
72836
|
-
for (auto &type : LogicalType::
|
|
72371
|
+
for (auto &type : LogicalType::AllTypes()) {
|
|
72837
72372
|
if (type.id() == LogicalTypeId::VARCHAR || type.id() == LogicalTypeId::BLOB) {
|
|
72838
72373
|
set.AddFunction(
|
|
72839
72374
|
AggregateFunction::UnaryAggregateDestructor<MinMaxState<string_t>, string_t, string_t, OP_STRING>(
|
|
@@ -74558,7 +74093,7 @@ void ModeFun::RegisterFunction(BuiltinFunctions &set) {
|
|
|
74558
74093
|
mode.AddFunction(AggregateFunction({LogicalTypeId::DECIMAL}, LogicalTypeId::DECIMAL, nullptr, nullptr, nullptr,
|
|
74559
74094
|
nullptr, nullptr, nullptr, BindModeDecimal));
|
|
74560
74095
|
|
|
74561
|
-
for (const auto &type : LogicalType::
|
|
74096
|
+
for (const auto &type : LogicalType::Numeric()) {
|
|
74562
74097
|
if (type.id() != LogicalTypeId::DECIMAL) {
|
|
74563
74098
|
mode.AddFunction(GetModeAggregate(type));
|
|
74564
74099
|
}
|
|
@@ -78491,8 +78026,9 @@ struct PragmaFunctions {
|
|
|
78491
78026
|
namespace duckdb {
|
|
78492
78027
|
|
|
78493
78028
|
static void PragmaEnableProfilingStatement(ClientContext &context, const FunctionParameters ¶meters) {
|
|
78494
|
-
|
|
78495
|
-
|
|
78029
|
+
auto &config = ClientConfig::GetConfig(context);
|
|
78030
|
+
config.profiler_print_format = ProfilerPrintFormat::QUERY_TREE;
|
|
78031
|
+
config.enable_profiler = true;
|
|
78496
78032
|
}
|
|
78497
78033
|
|
|
78498
78034
|
void RegisterEnableProfiling(BuiltinFunctions &set) {
|
|
@@ -78504,8 +78040,9 @@ void RegisterEnableProfiling(BuiltinFunctions &set) {
|
|
|
78504
78040
|
}
|
|
78505
78041
|
|
|
78506
78042
|
static void PragmaDisableProfiling(ClientContext &context, const FunctionParameters ¶meters) {
|
|
78507
|
-
context
|
|
78508
|
-
|
|
78043
|
+
auto &config = ClientConfig::GetConfig(context);
|
|
78044
|
+
config.enable_profiler = false;
|
|
78045
|
+
config.profiler_print_format = ProfilerPrintFormat::NONE;
|
|
78509
78046
|
}
|
|
78510
78047
|
|
|
78511
78048
|
static void PragmaEnableProgressBar(ClientContext &context, const FunctionParameters ¶meters) {
|
|
@@ -84335,7 +83872,7 @@ unique_ptr<FunctionData> DecimalUnaryOpBind(ClientContext &context, ScalarFuncti
|
|
|
84335
83872
|
|
|
84336
83873
|
void AbsFun::RegisterFunction(BuiltinFunctions &set) {
|
|
84337
83874
|
ScalarFunctionSet abs("abs");
|
|
84338
|
-
for (auto &type : LogicalType::
|
|
83875
|
+
for (auto &type : LogicalType::Numeric()) {
|
|
84339
83876
|
if (type.id() == LogicalTypeId::DECIMAL) {
|
|
84340
83877
|
abs.AddFunction(ScalarFunction({type}, type, nullptr, false, DecimalUnaryOpBind<AbsOperator>));
|
|
84341
83878
|
} else {
|
|
@@ -84393,7 +83930,7 @@ struct SignOperator {
|
|
|
84393
83930
|
|
|
84394
83931
|
void SignFun::RegisterFunction(BuiltinFunctions &set) {
|
|
84395
83932
|
ScalarFunctionSet sign("sign");
|
|
84396
|
-
for (auto &type : LogicalType::
|
|
83933
|
+
for (auto &type : LogicalType::Numeric()) {
|
|
84397
83934
|
if (type.id() == LogicalTypeId::DECIMAL) {
|
|
84398
83935
|
continue;
|
|
84399
83936
|
} else {
|
|
@@ -84469,7 +84006,7 @@ struct CeilDecimalOperator {
|
|
|
84469
84006
|
|
|
84470
84007
|
void CeilFun::RegisterFunction(BuiltinFunctions &set) {
|
|
84471
84008
|
ScalarFunctionSet ceil("ceil");
|
|
84472
|
-
for (auto &type : LogicalType::
|
|
84009
|
+
for (auto &type : LogicalType::Numeric()) {
|
|
84473
84010
|
scalar_function_t func = nullptr;
|
|
84474
84011
|
bind_scalar_function_t bind_func = nullptr;
|
|
84475
84012
|
if (type.IsIntegral()) {
|
|
@@ -84525,7 +84062,7 @@ struct FloorDecimalOperator {
|
|
|
84525
84062
|
|
|
84526
84063
|
void FloorFun::RegisterFunction(BuiltinFunctions &set) {
|
|
84527
84064
|
ScalarFunctionSet floor("floor");
|
|
84528
|
-
for (auto &type : LogicalType::
|
|
84065
|
+
for (auto &type : LogicalType::Numeric()) {
|
|
84529
84066
|
scalar_function_t func = nullptr;
|
|
84530
84067
|
bind_scalar_function_t bind_func = nullptr;
|
|
84531
84068
|
if (type.IsIntegral()) {
|
|
@@ -84727,7 +84264,7 @@ unique_ptr<FunctionData> BindDecimalRoundPrecision(ClientContext &context, Scala
|
|
|
84727
84264
|
|
|
84728
84265
|
void RoundFun::RegisterFunction(BuiltinFunctions &set) {
|
|
84729
84266
|
ScalarFunctionSet round("round");
|
|
84730
|
-
for (auto &type : LogicalType::
|
|
84267
|
+
for (auto &type : LogicalType::Numeric()) {
|
|
84731
84268
|
scalar_function_t round_prec_func = nullptr;
|
|
84732
84269
|
scalar_function_t round_func = nullptr;
|
|
84733
84270
|
bind_scalar_function_t bind_func = nullptr;
|
|
@@ -85872,7 +85409,7 @@ ScalarFunction AddFun::GetFunction(const LogicalType &left_type, const LogicalTy
|
|
|
85872
85409
|
|
|
85873
85410
|
void AddFun::RegisterFunction(BuiltinFunctions &set) {
|
|
85874
85411
|
ScalarFunctionSet functions("+");
|
|
85875
|
-
for (auto &type : LogicalType::
|
|
85412
|
+
for (auto &type : LogicalType::Numeric()) {
|
|
85876
85413
|
// unary add function is a nop, but only exists for numeric types
|
|
85877
85414
|
functions.AddFunction(GetFunction(type));
|
|
85878
85415
|
// binary add function adds two numbers together
|
|
@@ -86073,7 +85610,7 @@ ScalarFunction SubtractFun::GetFunction(const LogicalType &left_type, const Logi
|
|
|
86073
85610
|
|
|
86074
85611
|
void SubtractFun::RegisterFunction(BuiltinFunctions &set) {
|
|
86075
85612
|
ScalarFunctionSet functions("-");
|
|
86076
|
-
for (auto &type : LogicalType::
|
|
85613
|
+
for (auto &type : LogicalType::Numeric()) {
|
|
86077
85614
|
// unary subtract function, negates the input (i.e. multiplies by -1)
|
|
86078
85615
|
functions.AddFunction(GetFunction(type));
|
|
86079
85616
|
// binary subtract function "a - b", subtracts b from a
|
|
@@ -86208,7 +85745,7 @@ unique_ptr<FunctionData> BindDecimalMultiply(ClientContext &context, ScalarFunct
|
|
|
86208
85745
|
|
|
86209
85746
|
void MultiplyFun::RegisterFunction(BuiltinFunctions &set) {
|
|
86210
85747
|
ScalarFunctionSet functions("*");
|
|
86211
|
-
for (auto &type : LogicalType::
|
|
85748
|
+
for (auto &type : LogicalType::Numeric()) {
|
|
86212
85749
|
if (type.id() == LogicalTypeId::DECIMAL) {
|
|
86213
85750
|
functions.AddFunction(ScalarFunction({type, type}, type, nullptr, false, BindDecimalMultiply));
|
|
86214
85751
|
} else if (TypeIsIntegral(type.InternalType()) && type.id() != LogicalTypeId::HUGEINT) {
|
|
@@ -86336,7 +85873,7 @@ static scalar_function_t GetBinaryFunctionIgnoreZero(const LogicalType &type) {
|
|
|
86336
85873
|
|
|
86337
85874
|
void DivideFun::RegisterFunction(BuiltinFunctions &set) {
|
|
86338
85875
|
ScalarFunctionSet functions("/");
|
|
86339
|
-
for (auto &type : LogicalType::
|
|
85876
|
+
for (auto &type : LogicalType::Numeric()) {
|
|
86340
85877
|
if (type.id() == LogicalTypeId::DECIMAL) {
|
|
86341
85878
|
continue;
|
|
86342
85879
|
} else {
|
|
@@ -86376,7 +85913,7 @@ hugeint_t ModuloOperator::Operation(hugeint_t left, hugeint_t right) {
|
|
|
86376
85913
|
|
|
86377
85914
|
void ModFun::RegisterFunction(BuiltinFunctions &set) {
|
|
86378
85915
|
ScalarFunctionSet functions("%");
|
|
86379
|
-
for (auto &type : LogicalType::
|
|
85916
|
+
for (auto &type : LogicalType::Numeric()) {
|
|
86380
85917
|
if (type.id() == LogicalTypeId::DECIMAL) {
|
|
86381
85918
|
continue;
|
|
86382
85919
|
} else {
|
|
@@ -86481,7 +86018,7 @@ struct BitwiseANDOperator {
|
|
|
86481
86018
|
|
|
86482
86019
|
void BitwiseAndFun::RegisterFunction(BuiltinFunctions &set) {
|
|
86483
86020
|
ScalarFunctionSet functions("&");
|
|
86484
|
-
for (auto &type : LogicalType::
|
|
86021
|
+
for (auto &type : LogicalType::Integral()) {
|
|
86485
86022
|
functions.AddFunction(
|
|
86486
86023
|
ScalarFunction({type, type}, type, GetScalarIntegerBinaryFunction<BitwiseANDOperator>(type)));
|
|
86487
86024
|
}
|
|
@@ -86500,7 +86037,7 @@ struct BitwiseOROperator {
|
|
|
86500
86037
|
|
|
86501
86038
|
void BitwiseOrFun::RegisterFunction(BuiltinFunctions &set) {
|
|
86502
86039
|
ScalarFunctionSet functions("|");
|
|
86503
|
-
for (auto &type : LogicalType::
|
|
86040
|
+
for (auto &type : LogicalType::Integral()) {
|
|
86504
86041
|
functions.AddFunction(
|
|
86505
86042
|
ScalarFunction({type, type}, type, GetScalarIntegerBinaryFunction<BitwiseOROperator>(type)));
|
|
86506
86043
|
}
|
|
@@ -86519,7 +86056,7 @@ struct BitwiseXOROperator {
|
|
|
86519
86056
|
|
|
86520
86057
|
void BitwiseXorFun::RegisterFunction(BuiltinFunctions &set) {
|
|
86521
86058
|
ScalarFunctionSet functions("xor");
|
|
86522
|
-
for (auto &type : LogicalType::
|
|
86059
|
+
for (auto &type : LogicalType::Integral()) {
|
|
86523
86060
|
functions.AddFunction(
|
|
86524
86061
|
ScalarFunction({type, type}, type, GetScalarIntegerBinaryFunction<BitwiseXOROperator>(type)));
|
|
86525
86062
|
}
|
|
@@ -86543,7 +86080,7 @@ struct BitwiseShiftLeftOperator {
|
|
|
86543
86080
|
|
|
86544
86081
|
void LeftShiftFun::RegisterFunction(BuiltinFunctions &set) {
|
|
86545
86082
|
ScalarFunctionSet functions("<<");
|
|
86546
|
-
for (auto &type : LogicalType::
|
|
86083
|
+
for (auto &type : LogicalType::Integral()) {
|
|
86547
86084
|
functions.AddFunction(
|
|
86548
86085
|
ScalarFunction({type, type}, type, GetScalarIntegerBinaryFunction<BitwiseShiftLeftOperator>(type)));
|
|
86549
86086
|
}
|
|
@@ -86562,7 +86099,7 @@ struct BitwiseShiftRightOperator {
|
|
|
86562
86099
|
|
|
86563
86100
|
void RightShiftFun::RegisterFunction(BuiltinFunctions &set) {
|
|
86564
86101
|
ScalarFunctionSet functions(">>");
|
|
86565
|
-
for (auto &type : LogicalType::
|
|
86102
|
+
for (auto &type : LogicalType::Integral()) {
|
|
86566
86103
|
functions.AddFunction(
|
|
86567
86104
|
ScalarFunction({type, type}, type, GetScalarIntegerBinaryFunction<BitwiseShiftRightOperator>(type)));
|
|
86568
86105
|
}
|
|
@@ -86581,7 +86118,7 @@ struct BitwiseNotOperator {
|
|
|
86581
86118
|
|
|
86582
86119
|
void BitwiseNotFun::RegisterFunction(BuiltinFunctions &set) {
|
|
86583
86120
|
ScalarFunctionSet functions("~");
|
|
86584
|
-
for (auto &type : LogicalType::
|
|
86121
|
+
for (auto &type : LogicalType::Integral()) {
|
|
86585
86122
|
functions.AddFunction(ScalarFunction({type}, type, GetScalarIntegerUnaryFunction<BitwiseNotOperator>(type)));
|
|
86586
86123
|
}
|
|
86587
86124
|
set.AddFunction(functions);
|
|
@@ -87685,7 +87222,7 @@ static void ConcatWSFunction(DataChunk &args, ExpressionState &state, Vector &re
|
|
|
87685
87222
|
}
|
|
87686
87223
|
}
|
|
87687
87224
|
switch (separator.GetVectorType()) {
|
|
87688
|
-
case VectorType::CONSTANT_VECTOR:
|
|
87225
|
+
case VectorType::CONSTANT_VECTOR: {
|
|
87689
87226
|
if (ConstantVector::IsNull(separator)) {
|
|
87690
87227
|
// constant NULL as separator: return constant NULL vector
|
|
87691
87228
|
result.SetVectorType(VectorType::CONSTANT_VECTOR);
|
|
@@ -87693,9 +87230,11 @@ static void ConcatWSFunction(DataChunk &args, ExpressionState &state, Vector &re
|
|
|
87693
87230
|
return;
|
|
87694
87231
|
}
|
|
87695
87232
|
// no null values
|
|
87696
|
-
|
|
87697
|
-
|
|
87233
|
+
SelectionVector owned_sel;
|
|
87234
|
+
auto sel = FlatVector::IncrementalSelectionVector(args.size(), owned_sel);
|
|
87235
|
+
TemplatedConcatWS(args, (string_t *)vdata.data, *vdata.sel, *sel, args.size(), result);
|
|
87698
87236
|
return;
|
|
87237
|
+
}
|
|
87699
87238
|
default: {
|
|
87700
87239
|
// default case: loop over nullmask and create a non-null selection vector
|
|
87701
87240
|
idx_t not_null_count = 0;
|
|
@@ -92135,8 +91674,7 @@ unique_ptr<FunctionData> BindSystemFunction(ClientContext &context, ScalarFuncti
|
|
|
92135
91674
|
|
|
92136
91675
|
static void CurrentQueryFunction(DataChunk &input, ExpressionState &state, Vector &result) {
|
|
92137
91676
|
auto &info = SystemBindData::GetFrom(state);
|
|
92138
|
-
|
|
92139
|
-
Value val(info.context.query);
|
|
91677
|
+
Value val(info.context.GetCurrentQuery());
|
|
92140
91678
|
result.Reference(val);
|
|
92141
91679
|
}
|
|
92142
91680
|
|
|
@@ -92378,6 +91916,21 @@ void ScalarFunction::NopFunction(DataChunk &input, ExpressionState &state, Vecto
|
|
|
92378
91916
|
|
|
92379
91917
|
|
|
92380
91918
|
|
|
91919
|
+
//===----------------------------------------------------------------------===//
|
|
91920
|
+
// DuckDB
|
|
91921
|
+
//
|
|
91922
|
+
// duckdb/common/thread.hpp
|
|
91923
|
+
//
|
|
91924
|
+
//
|
|
91925
|
+
//===----------------------------------------------------------------------===//
|
|
91926
|
+
|
|
91927
|
+
|
|
91928
|
+
|
|
91929
|
+
#include <thread>
|
|
91930
|
+
|
|
91931
|
+
namespace duckdb {
|
|
91932
|
+
using std::thread;
|
|
91933
|
+
}
|
|
92381
91934
|
|
|
92382
91935
|
#include <map>
|
|
92383
91936
|
#include <condition_variable>
|
|
@@ -92523,7 +92076,7 @@ private:
|
|
|
92523
92076
|
//! Gets Arrow Table's Cardinality
|
|
92524
92077
|
static unique_ptr<NodeStatistics> ArrowScanCardinality(ClientContext &context, const FunctionData *bind_data);
|
|
92525
92078
|
//! Gets the progress on the table scan, used for Progress Bars
|
|
92526
|
-
static
|
|
92079
|
+
static double ArrowProgress(ClientContext &context, const FunctionData *bind_data_p);
|
|
92527
92080
|
};
|
|
92528
92081
|
|
|
92529
92082
|
} // namespace duckdb
|
|
@@ -93622,12 +93175,12 @@ unique_ptr<NodeStatistics> ArrowTableFunction::ArrowScanCardinality(ClientContex
|
|
|
93622
93175
|
return make_unique<NodeStatistics>(bind_data.number_of_rows, bind_data.number_of_rows);
|
|
93623
93176
|
}
|
|
93624
93177
|
|
|
93625
|
-
|
|
93178
|
+
double ArrowTableFunction::ArrowProgress(ClientContext &context, const FunctionData *bind_data_p) {
|
|
93626
93179
|
auto &bind_data = (const ArrowScanFunctionData &)*bind_data_p;
|
|
93627
93180
|
if (bind_data.number_of_rows == 0) {
|
|
93628
93181
|
return 100;
|
|
93629
93182
|
}
|
|
93630
|
-
auto percentage = bind_data.lines_read * 100 / bind_data.number_of_rows;
|
|
93183
|
+
auto percentage = bind_data.lines_read * 100.0 / bind_data.number_of_rows;
|
|
93631
93184
|
return percentage;
|
|
93632
93185
|
}
|
|
93633
93186
|
|
|
@@ -95312,12 +94865,12 @@ static void ReadCSVAddNamedParameters(TableFunction &table_function) {
|
|
|
95312
94865
|
table_function.named_parameters["skip"] = LogicalType::BIGINT;
|
|
95313
94866
|
}
|
|
95314
94867
|
|
|
95315
|
-
|
|
94868
|
+
double CSVReaderProgress(ClientContext &context, const FunctionData *bind_data_p) {
|
|
95316
94869
|
auto &bind_data = (ReadCSVData &)*bind_data_p;
|
|
95317
94870
|
if (bind_data.file_size == 0) {
|
|
95318
94871
|
return 100;
|
|
95319
94872
|
}
|
|
95320
|
-
auto percentage = bind_data.bytes_read * 100 / bind_data.file_size;
|
|
94873
|
+
auto percentage = (bind_data.bytes_read * 100.0) / bind_data.file_size;
|
|
95321
94874
|
return percentage;
|
|
95322
94875
|
}
|
|
95323
94876
|
|
|
@@ -97207,7 +96760,7 @@ static unique_ptr<FunctionData> DuckDBTypesBind(ClientContext &context, vector<V
|
|
|
97207
96760
|
unique_ptr<FunctionOperatorData> DuckDBTypesInit(ClientContext &context, const FunctionData *bind_data,
|
|
97208
96761
|
const vector<column_t> &column_ids, TableFilterCollection *filters) {
|
|
97209
96762
|
auto result = make_unique<DuckDBTypesData>();
|
|
97210
|
-
result->types = LogicalType::
|
|
96763
|
+
result->types = LogicalType::AllTypes();
|
|
97211
96764
|
// FIXME: add user-defined types here (when we have them)
|
|
97212
96765
|
return move(result);
|
|
97213
96766
|
}
|
|
@@ -98531,14 +98084,14 @@ bool TableScanParallelStateNext(ClientContext &context, const FunctionData *bind
|
|
|
98531
98084
|
state.column_ids);
|
|
98532
98085
|
}
|
|
98533
98086
|
|
|
98534
|
-
|
|
98087
|
+
double TableScanProgress(ClientContext &context, const FunctionData *bind_data_p) {
|
|
98535
98088
|
auto &bind_data = (TableScanBindData &)*bind_data_p;
|
|
98536
98089
|
idx_t total_rows = bind_data.table->storage->GetTotalRows();
|
|
98537
98090
|
if (total_rows == 0 || total_rows < STANDARD_VECTOR_SIZE) {
|
|
98538
98091
|
//! Table is either empty or smaller than a vector size, so it is finished
|
|
98539
98092
|
return 100;
|
|
98540
98093
|
}
|
|
98541
|
-
auto percentage = (bind_data.chunk_count * STANDARD_VECTOR_SIZE * 100) / total_rows;
|
|
98094
|
+
auto percentage = double(bind_data.chunk_count * STANDARD_VECTOR_SIZE * 100.0) / total_rows;
|
|
98542
98095
|
if (percentage > 100) {
|
|
98543
98096
|
//! In case the last chunk has less elements than STANDARD_VECTOR_SIZE, if our percentage is over 100
|
|
98544
98097
|
//! It means we finished this table.
|
|
@@ -98564,7 +98117,7 @@ unique_ptr<NodeStatistics> TableScanCardinality(ClientContext &context, const Fu
|
|
|
98564
98117
|
// Index Scan
|
|
98565
98118
|
//===--------------------------------------------------------------------===//
|
|
98566
98119
|
struct IndexScanOperatorData : public FunctionOperatorData {
|
|
98567
|
-
explicit IndexScanOperatorData(data_ptr_t row_id_data) : row_ids(
|
|
98120
|
+
explicit IndexScanOperatorData(data_ptr_t row_id_data) : row_ids(LogicalType::ROW_TYPE, row_id_data) {
|
|
98568
98121
|
}
|
|
98569
98122
|
|
|
98570
98123
|
Vector row_ids;
|
|
@@ -101274,28 +100827,27 @@ private:
|
|
|
101274
100827
|
|
|
101275
100828
|
namespace duckdb {
|
|
101276
100829
|
|
|
101277
|
-
|
|
101278
|
-
|
|
101279
|
-
|
|
101280
|
-
|
|
101281
|
-
|
|
101282
|
-
|
|
101283
|
-
|
|
101284
|
-
|
|
101285
|
-
|
|
101286
|
-
|
|
100830
|
+
struct ActiveQueryContext {
|
|
100831
|
+
//! The query that is currently being executed
|
|
100832
|
+
string query;
|
|
100833
|
+
//! The currently open result
|
|
100834
|
+
BaseQueryResult *open_result = nullptr;
|
|
100835
|
+
//! Prepared statement data
|
|
100836
|
+
shared_ptr<PreparedStatementData> prepared;
|
|
100837
|
+
//! The query executor
|
|
100838
|
+
unique_ptr<Executor> executor;
|
|
100839
|
+
//! The progress bar
|
|
100840
|
+
unique_ptr<ProgressBar> progress_bar;
|
|
101287
100841
|
};
|
|
101288
100842
|
|
|
101289
100843
|
ClientContext::ClientContext(shared_ptr<DatabaseInstance> database)
|
|
101290
|
-
: profiler(make_unique<QueryProfiler>()), query_profiler_history(make_unique<QueryProfilerHistory>()),
|
|
101291
|
-
db(move(database)), transaction(db->GetTransactionManager(), *this), interrupted(false),
|
|
100844
|
+
: profiler(make_unique<QueryProfiler>(*this)), query_profiler_history(make_unique<QueryProfilerHistory>()),
|
|
100845
|
+
db(move(database)), transaction(db->GetTransactionManager(), *this), interrupted(false),
|
|
101292
100846
|
temporary_objects(make_unique<SchemaCatalogEntry>(&db->GetCatalog(), TEMP_SCHEMA, true)),
|
|
101293
100847
|
catalog_search_path(make_unique<CatalogSearchPath>(*this)),
|
|
101294
|
-
file_opener(make_unique<ClientContextFileOpener>(*this))
|
|
100848
|
+
file_opener(make_unique<ClientContextFileOpener>(*this)) {
|
|
101295
100849
|
std::random_device rd;
|
|
101296
100850
|
random_engine.seed(rd());
|
|
101297
|
-
|
|
101298
|
-
progress_bar = make_unique<ProgressBar>(&executor, config.wait_time);
|
|
101299
100851
|
}
|
|
101300
100852
|
|
|
101301
100853
|
ClientContext::~ClientContext() {
|
|
@@ -101322,87 +100874,162 @@ void ClientContext::Destroy() {
|
|
|
101322
100874
|
CleanupInternal(*lock);
|
|
101323
100875
|
}
|
|
101324
100876
|
|
|
101325
|
-
|
|
101326
|
-
|
|
101327
|
-
|
|
100877
|
+
unique_ptr<DataChunk> ClientContext::Fetch(ClientContextLock &lock, StreamQueryResult &result) {
|
|
100878
|
+
D_ASSERT(IsActiveResult(lock, &result));
|
|
100879
|
+
D_ASSERT(active_query->executor);
|
|
100880
|
+
return FetchInternal(lock, *active_query->executor, result);
|
|
101328
100881
|
}
|
|
101329
100882
|
|
|
101330
|
-
unique_ptr<DataChunk> ClientContext::
|
|
101331
|
-
|
|
101332
|
-
|
|
101333
|
-
throw InternalException("Fetch was called, but there is no open result (or the result was previously closed)");
|
|
101334
|
-
}
|
|
100883
|
+
unique_ptr<DataChunk> ClientContext::FetchInternal(ClientContextLock &lock, Executor &executor,
|
|
100884
|
+
BaseQueryResult &result) {
|
|
100885
|
+
bool invalidate_query = true;
|
|
101335
100886
|
try {
|
|
101336
100887
|
// fetch the chunk and return it
|
|
101337
|
-
auto chunk =
|
|
100888
|
+
auto chunk = executor.FetchChunk();
|
|
100889
|
+
if (!chunk || chunk->size() == 0) {
|
|
100890
|
+
CleanupInternal(lock, &result);
|
|
100891
|
+
}
|
|
101338
100892
|
return chunk;
|
|
100893
|
+
} catch (StandardException &ex) {
|
|
100894
|
+
// standard exceptions do not invalidate the current transaction
|
|
100895
|
+
result.error = ex.what();
|
|
100896
|
+
invalidate_query = false;
|
|
101339
100897
|
} catch (std::exception &ex) {
|
|
101340
|
-
|
|
100898
|
+
result.error = ex.what();
|
|
101341
100899
|
} catch (...) { // LCOV_EXCL_START
|
|
101342
|
-
|
|
100900
|
+
result.error = "Unhandled exception in FetchInternal";
|
|
101343
100901
|
} // LCOV_EXCL_STOP
|
|
101344
|
-
|
|
101345
|
-
CleanupInternal(
|
|
100902
|
+
result.success = false;
|
|
100903
|
+
CleanupInternal(lock, &result, invalidate_query);
|
|
101346
100904
|
return nullptr;
|
|
101347
100905
|
}
|
|
101348
100906
|
|
|
101349
|
-
|
|
100907
|
+
void ClientContext::BeginTransactionInternal(ClientContextLock &lock, bool requires_valid_transaction) {
|
|
100908
|
+
// check if we are on AutoCommit. In this case we should start a transaction
|
|
100909
|
+
D_ASSERT(!active_query);
|
|
100910
|
+
if (requires_valid_transaction && transaction.HasActiveTransaction() &&
|
|
100911
|
+
transaction.ActiveTransaction().IsInvalidated()) {
|
|
100912
|
+
throw Exception("Failed: transaction has been invalidated!");
|
|
100913
|
+
}
|
|
100914
|
+
active_query = make_unique<ActiveQueryContext>();
|
|
100915
|
+
if (transaction.IsAutoCommit()) {
|
|
100916
|
+
transaction.BeginTransaction();
|
|
100917
|
+
}
|
|
100918
|
+
}
|
|
100919
|
+
|
|
100920
|
+
void ClientContext::BeginQueryInternal(ClientContextLock &lock, const string &query) {
|
|
100921
|
+
BeginTransactionInternal(lock, false);
|
|
100922
|
+
LogQueryInternal(lock, query);
|
|
100923
|
+
active_query->query = query;
|
|
100924
|
+
query_progress = -1;
|
|
100925
|
+
ActiveTransaction().active_query = db->GetTransactionManager().GetQueryNumber();
|
|
100926
|
+
}
|
|
100927
|
+
|
|
100928
|
+
string ClientContext::EndQueryInternal(ClientContextLock &lock, bool success, bool invalidate_transaction) {
|
|
101350
100929
|
profiler->EndQuery();
|
|
101351
|
-
executor.Reset();
|
|
101352
100930
|
|
|
100931
|
+
D_ASSERT(active_query.get());
|
|
101353
100932
|
string error;
|
|
101354
|
-
|
|
101355
|
-
|
|
101356
|
-
|
|
101357
|
-
|
|
101358
|
-
|
|
101359
|
-
|
|
101360
|
-
|
|
101361
|
-
|
|
101362
|
-
|
|
101363
|
-
|
|
101364
|
-
|
|
101365
|
-
|
|
101366
|
-
|
|
100933
|
+
try {
|
|
100934
|
+
if (transaction.HasActiveTransaction()) {
|
|
100935
|
+
// Move the query profiler into the history
|
|
100936
|
+
auto &prev_profilers = query_profiler_history->GetPrevProfilers();
|
|
100937
|
+
prev_profilers.emplace_back(transaction.ActiveTransaction().active_query, move(profiler));
|
|
100938
|
+
// Reinitialize the query profiler
|
|
100939
|
+
profiler = make_unique<QueryProfiler>(*this);
|
|
100940
|
+
// Propagate settings of the saved query into the new profiler.
|
|
100941
|
+
profiler->Propagate(*prev_profilers.back().second);
|
|
100942
|
+
if (prev_profilers.size() >= query_profiler_history->GetPrevProfilersSize()) {
|
|
100943
|
+
prev_profilers.pop_front();
|
|
100944
|
+
}
|
|
100945
|
+
|
|
100946
|
+
ActiveTransaction().active_query = MAXIMUM_QUERY_ID;
|
|
101367
100947
|
if (transaction.IsAutoCommit()) {
|
|
101368
100948
|
if (success) {
|
|
101369
|
-
// query was successful: commit
|
|
101370
100949
|
transaction.Commit();
|
|
101371
100950
|
} else {
|
|
101372
|
-
// query was unsuccessful: rollback
|
|
101373
100951
|
transaction.Rollback();
|
|
101374
100952
|
}
|
|
100953
|
+
} else if (invalidate_transaction) {
|
|
100954
|
+
D_ASSERT(!success);
|
|
100955
|
+
ActiveTransaction().Invalidate();
|
|
101375
100956
|
}
|
|
101376
|
-
}
|
|
101377
|
-
|
|
101378
|
-
|
|
101379
|
-
|
|
101380
|
-
|
|
101381
|
-
}
|
|
100957
|
+
}
|
|
100958
|
+
} catch (std::exception &ex) {
|
|
100959
|
+
error = ex.what();
|
|
100960
|
+
} catch (...) { // LCOV_EXCL_START
|
|
100961
|
+
error = "Unhandled exception!";
|
|
100962
|
+
} // LCOV_EXCL_STOP
|
|
100963
|
+
active_query.reset();
|
|
100964
|
+
query_progress = -1;
|
|
101382
100965
|
return error;
|
|
101383
100966
|
}
|
|
101384
100967
|
|
|
101385
|
-
void ClientContext::CleanupInternal(ClientContextLock &lock) {
|
|
101386
|
-
if (!
|
|
101387
|
-
// no
|
|
100968
|
+
void ClientContext::CleanupInternal(ClientContextLock &lock, BaseQueryResult *result, bool invalidate_transaction) {
|
|
100969
|
+
if (!active_query) {
|
|
100970
|
+
// no query currently active
|
|
101388
100971
|
return;
|
|
101389
100972
|
}
|
|
100973
|
+
if (active_query->executor) {
|
|
100974
|
+
active_query->executor->CancelTasks();
|
|
100975
|
+
}
|
|
100976
|
+
active_query->progress_bar.reset();
|
|
101390
100977
|
|
|
101391
|
-
auto error =
|
|
101392
|
-
if (
|
|
100978
|
+
auto error = EndQueryInternal(lock, result ? result->success : false, invalidate_transaction);
|
|
100979
|
+
if (result && result->success) {
|
|
101393
100980
|
// if an error occurred while committing report it in the result
|
|
101394
|
-
|
|
101395
|
-
|
|
100981
|
+
result->error = error;
|
|
100982
|
+
result->success = error.empty();
|
|
101396
100983
|
}
|
|
100984
|
+
D_ASSERT(!active_query);
|
|
100985
|
+
}
|
|
101397
100986
|
|
|
101398
|
-
|
|
101399
|
-
|
|
100987
|
+
Executor &ClientContext::GetExecutor() {
|
|
100988
|
+
D_ASSERT(active_query);
|
|
100989
|
+
D_ASSERT(active_query->executor);
|
|
100990
|
+
return *active_query->executor;
|
|
100991
|
+
}
|
|
101400
100992
|
|
|
101401
|
-
|
|
100993
|
+
const string &ClientContext::GetCurrentQuery() {
|
|
100994
|
+
D_ASSERT(active_query);
|
|
100995
|
+
return active_query->query;
|
|
101402
100996
|
}
|
|
101403
100997
|
|
|
101404
|
-
unique_ptr<
|
|
101405
|
-
|
|
100998
|
+
unique_ptr<QueryResult> ClientContext::FetchResultInternal(ClientContextLock &lock, PendingQueryResult &pending,
|
|
100999
|
+
bool allow_stream_result) {
|
|
101000
|
+
D_ASSERT(active_query);
|
|
101001
|
+
D_ASSERT(active_query->open_result == &pending);
|
|
101002
|
+
D_ASSERT(active_query->prepared);
|
|
101003
|
+
auto &prepared = *active_query->prepared;
|
|
101004
|
+
bool create_stream_result = prepared.allow_stream_result && allow_stream_result;
|
|
101005
|
+
if (create_stream_result) {
|
|
101006
|
+
active_query->progress_bar.reset();
|
|
101007
|
+
query_progress = -1;
|
|
101008
|
+
|
|
101009
|
+
// successfully compiled SELECT clause and it is the last statement
|
|
101010
|
+
// return a StreamQueryResult so the client can call Fetch() on it and stream the result
|
|
101011
|
+
auto stream_result =
|
|
101012
|
+
make_unique<StreamQueryResult>(pending.statement_type, shared_from_this(), pending.types, pending.names);
|
|
101013
|
+
active_query->open_result = stream_result.get();
|
|
101014
|
+
return move(stream_result);
|
|
101015
|
+
}
|
|
101016
|
+
// create a materialized result by continuously fetching
|
|
101017
|
+
auto result = make_unique<MaterializedQueryResult>(pending.statement_type, pending.types, pending.names);
|
|
101018
|
+
while (true) {
|
|
101019
|
+
auto chunk = FetchInternal(lock, GetExecutor(), *result);
|
|
101020
|
+
if (!chunk || chunk->size() == 0) {
|
|
101021
|
+
break;
|
|
101022
|
+
}
|
|
101023
|
+
#ifdef DEBUG
|
|
101024
|
+
for (idx_t i = 0; i < chunk->ColumnCount(); i++) {
|
|
101025
|
+
if (pending.types[i].id() == LogicalTypeId::VARCHAR) {
|
|
101026
|
+
chunk->data[i].UTFVerify(chunk->size());
|
|
101027
|
+
}
|
|
101028
|
+
}
|
|
101029
|
+
#endif
|
|
101030
|
+
result->collection.Append(*chunk);
|
|
101031
|
+
}
|
|
101032
|
+
return move(result);
|
|
101406
101033
|
}
|
|
101407
101034
|
|
|
101408
101035
|
shared_ptr<PreparedStatementData> ClientContext::CreatePreparedStatement(ClientContextLock &lock, const string &query,
|
|
@@ -101410,11 +101037,12 @@ shared_ptr<PreparedStatementData> ClientContext::CreatePreparedStatement(ClientC
|
|
|
101410
101037
|
StatementType statement_type = statement->type;
|
|
101411
101038
|
auto result = make_shared<PreparedStatementData>(statement_type);
|
|
101412
101039
|
|
|
101413
|
-
profiler
|
|
101040
|
+
auto &profiler = QueryProfiler::Get(*this);
|
|
101041
|
+
profiler.StartPhase("planner");
|
|
101414
101042
|
Planner planner(*this);
|
|
101415
101043
|
planner.CreatePlan(move(statement));
|
|
101416
101044
|
D_ASSERT(planner.plan);
|
|
101417
|
-
profiler
|
|
101045
|
+
profiler.EndPhase();
|
|
101418
101046
|
|
|
101419
101047
|
auto plan = move(planner.plan);
|
|
101420
101048
|
#ifdef DEBUG
|
|
@@ -101430,22 +101058,22 @@ shared_ptr<PreparedStatementData> ClientContext::CreatePreparedStatement(ClientC
|
|
|
101430
101058
|
result->catalog_version = Transaction::GetTransaction(*this).catalog_version;
|
|
101431
101059
|
|
|
101432
101060
|
if (config.enable_optimizer) {
|
|
101433
|
-
profiler
|
|
101061
|
+
profiler.StartPhase("optimizer");
|
|
101434
101062
|
Optimizer optimizer(*planner.binder, *this);
|
|
101435
101063
|
plan = optimizer.Optimize(move(plan));
|
|
101436
101064
|
D_ASSERT(plan);
|
|
101437
|
-
profiler
|
|
101065
|
+
profiler.EndPhase();
|
|
101438
101066
|
|
|
101439
101067
|
#ifdef DEBUG
|
|
101440
101068
|
plan->Verify();
|
|
101441
101069
|
#endif
|
|
101442
101070
|
}
|
|
101443
101071
|
|
|
101444
|
-
profiler
|
|
101072
|
+
profiler.StartPhase("physical_planner");
|
|
101445
101073
|
// now convert logical query plan into a physical query plan
|
|
101446
101074
|
PhysicalPlanGenerator physical_planner(*this);
|
|
101447
101075
|
auto physical_plan = physical_planner.CreatePlan(move(plan));
|
|
101448
|
-
profiler
|
|
101076
|
+
profiler.EndPhase();
|
|
101449
101077
|
|
|
101450
101078
|
#ifdef DEBUG
|
|
101451
101079
|
D_ASSERT(!physical_plan->ToString().empty());
|
|
@@ -101454,14 +101082,14 @@ shared_ptr<PreparedStatementData> ClientContext::CreatePreparedStatement(ClientC
|
|
|
101454
101082
|
return result;
|
|
101455
101083
|
}
|
|
101456
101084
|
|
|
101457
|
-
|
|
101458
|
-
|
|
101459
|
-
return progress_bar->GetCurrentPercentage();
|
|
101085
|
+
double ClientContext::GetProgress() {
|
|
101086
|
+
return query_progress.load();
|
|
101460
101087
|
}
|
|
101461
101088
|
|
|
101462
|
-
unique_ptr<
|
|
101463
|
-
|
|
101464
|
-
|
|
101089
|
+
unique_ptr<PendingQueryResult> ClientContext::PendingPreparedStatement(ClientContextLock &lock,
|
|
101090
|
+
shared_ptr<PreparedStatementData> statement_p,
|
|
101091
|
+
vector<Value> bound_values) {
|
|
101092
|
+
D_ASSERT(active_query);
|
|
101465
101093
|
auto &statement = *statement_p;
|
|
101466
101094
|
if (ActiveTransaction().IsInvalidated() && statement.requires_valid_transaction) {
|
|
101467
101095
|
throw Exception("Current transaction is aborted (please ROLLBACK)");
|
|
@@ -101475,47 +101103,42 @@ unique_ptr<QueryResult> ClientContext::ExecutePreparedStatement(ClientContextLoc
|
|
|
101475
101103
|
// bind the bound values before execution
|
|
101476
101104
|
statement.Bind(move(bound_values));
|
|
101477
101105
|
|
|
101478
|
-
|
|
101106
|
+
active_query->executor = make_unique<Executor>(*this);
|
|
101107
|
+
auto &executor = *active_query->executor;
|
|
101479
101108
|
if (config.enable_progress_bar) {
|
|
101480
|
-
progress_bar
|
|
101481
|
-
progress_bar->Start();
|
|
101109
|
+
active_query->progress_bar = make_unique<ProgressBar>(executor, config.wait_time);
|
|
101110
|
+
active_query->progress_bar->Start();
|
|
101111
|
+
query_progress = 0;
|
|
101482
101112
|
}
|
|
101483
|
-
// store the physical plan in the context for calls to Fetch()
|
|
101484
101113
|
executor.Initialize(statement.plan.get());
|
|
101485
|
-
|
|
101486
101114
|
auto types = executor.GetTypes();
|
|
101487
|
-
|
|
101488
101115
|
D_ASSERT(types == statement.types);
|
|
101116
|
+
D_ASSERT(!active_query->open_result);
|
|
101489
101117
|
|
|
101490
|
-
|
|
101491
|
-
|
|
101492
|
-
|
|
101493
|
-
|
|
101494
|
-
|
|
101495
|
-
|
|
101496
|
-
|
|
101497
|
-
|
|
101498
|
-
|
|
101499
|
-
|
|
101500
|
-
|
|
101501
|
-
|
|
101502
|
-
|
|
101503
|
-
|
|
101504
|
-
break;
|
|
101505
|
-
}
|
|
101506
|
-
#ifdef DEBUG
|
|
101507
|
-
for (idx_t i = 0; i < chunk->ColumnCount(); i++) {
|
|
101508
|
-
if (statement.types[i].id() == LogicalTypeId::VARCHAR) {
|
|
101509
|
-
chunk->data[i].UTFVerify(chunk->size());
|
|
101510
|
-
}
|
|
101118
|
+
auto pending_result = make_unique<PendingQueryResult>(shared_from_this(), *statement_p, move(types));
|
|
101119
|
+
active_query->prepared = move(statement_p);
|
|
101120
|
+
active_query->open_result = pending_result.get();
|
|
101121
|
+
return pending_result;
|
|
101122
|
+
}
|
|
101123
|
+
|
|
101124
|
+
PendingExecutionResult ClientContext::ExecuteTaskInternal(ClientContextLock &lock, PendingQueryResult &result) {
|
|
101125
|
+
D_ASSERT(active_query);
|
|
101126
|
+
D_ASSERT(active_query->open_result == &result);
|
|
101127
|
+
try {
|
|
101128
|
+
auto result = active_query->executor->ExecuteTask();
|
|
101129
|
+
if (active_query->progress_bar) {
|
|
101130
|
+
active_query->progress_bar->Update(result == PendingExecutionResult::RESULT_READY);
|
|
101131
|
+
query_progress = active_query->progress_bar->GetCurrentPercentage();
|
|
101511
101132
|
}
|
|
101512
|
-
|
|
101513
|
-
|
|
101514
|
-
|
|
101515
|
-
|
|
101516
|
-
|
|
101517
|
-
}
|
|
101518
|
-
|
|
101133
|
+
return result;
|
|
101134
|
+
} catch (std::exception &ex) {
|
|
101135
|
+
result.error = ex.what();
|
|
101136
|
+
} catch (...) { // LCOV_EXCL_START
|
|
101137
|
+
result.error = "Unhandled exception in ExecuteTaskInternal";
|
|
101138
|
+
} // LCOV_EXCL_STOP
|
|
101139
|
+
EndQueryInternal(lock, false, true);
|
|
101140
|
+
result.success = false;
|
|
101141
|
+
return PendingExecutionResult::EXECUTION_ERROR;
|
|
101519
101142
|
}
|
|
101520
101143
|
|
|
101521
101144
|
void ClientContext::InitialCleanup(ClientContextLock &lock) {
|
|
@@ -101618,27 +101241,58 @@ unique_ptr<PreparedStatement> ClientContext::Prepare(const string &query) {
|
|
|
101618
101241
|
}
|
|
101619
101242
|
}
|
|
101620
101243
|
|
|
101244
|
+
unique_ptr<PendingQueryResult> ClientContext::PendingQueryPreparedInternal(ClientContextLock &lock, const string &query,
|
|
101245
|
+
shared_ptr<PreparedStatementData> &prepared,
|
|
101246
|
+
vector<Value> &values) {
|
|
101247
|
+
try {
|
|
101248
|
+
InitialCleanup(lock);
|
|
101249
|
+
} catch (std::exception &ex) {
|
|
101250
|
+
return make_unique<PendingQueryResult>(ex.what());
|
|
101251
|
+
}
|
|
101252
|
+
return PendingStatementOrPreparedStatementInternal(lock, query, nullptr, prepared, &values);
|
|
101253
|
+
}
|
|
101254
|
+
|
|
101255
|
+
unique_ptr<PendingQueryResult>
|
|
101256
|
+
ClientContext::PendingQuery(const string &query, shared_ptr<PreparedStatementData> &prepared, vector<Value> &values) {
|
|
101257
|
+
auto lock = LockContext();
|
|
101258
|
+
return PendingQueryPreparedInternal(*lock, query, prepared, values);
|
|
101259
|
+
}
|
|
101260
|
+
|
|
101621
101261
|
unique_ptr<QueryResult> ClientContext::Execute(const string &query, shared_ptr<PreparedStatementData> &prepared,
|
|
101622
101262
|
vector<Value> &values, bool allow_stream_result) {
|
|
101623
101263
|
auto lock = LockContext();
|
|
101624
|
-
|
|
101625
|
-
|
|
101626
|
-
|
|
101627
|
-
return make_unique<MaterializedQueryResult>(ex.what());
|
|
101264
|
+
auto pending = PendingQueryPreparedInternal(*lock, query, prepared, values);
|
|
101265
|
+
if (!pending->success) {
|
|
101266
|
+
return make_unique<MaterializedQueryResult>(pending->error);
|
|
101628
101267
|
}
|
|
101629
|
-
|
|
101630
|
-
return RunStatementOrPreparedStatement(*lock, query, nullptr, prepared, &values, allow_stream_result);
|
|
101268
|
+
return pending->ExecuteInternal(*lock, allow_stream_result);
|
|
101631
101269
|
}
|
|
101632
101270
|
|
|
101633
|
-
unique_ptr<
|
|
101634
|
-
|
|
101635
|
-
bool allow_stream_result) {
|
|
101271
|
+
unique_ptr<PendingQueryResult> ClientContext::PendingStatementInternal(ClientContextLock &lock, const string &query,
|
|
101272
|
+
unique_ptr<SQLStatement> statement) {
|
|
101636
101273
|
// prepare the query for execution
|
|
101637
101274
|
auto prepared = CreatePreparedStatement(lock, query, move(statement));
|
|
101638
101275
|
// by default, no values are bound
|
|
101639
101276
|
vector<Value> bound_values;
|
|
101640
101277
|
// execute the prepared statement
|
|
101641
|
-
return
|
|
101278
|
+
return PendingPreparedStatement(lock, move(prepared), move(bound_values));
|
|
101279
|
+
}
|
|
101280
|
+
|
|
101281
|
+
unique_ptr<QueryResult> ClientContext::RunStatementInternal(ClientContextLock &lock, const string &query,
|
|
101282
|
+
unique_ptr<SQLStatement> statement,
|
|
101283
|
+
bool allow_stream_result, bool verify) {
|
|
101284
|
+
auto pending = PendingQueryInternal(lock, move(statement), verify);
|
|
101285
|
+
if (!pending->success) {
|
|
101286
|
+
return make_unique<MaterializedQueryResult>(move(pending->error));
|
|
101287
|
+
}
|
|
101288
|
+
return ExecutePendingQueryInternal(lock, *pending, allow_stream_result);
|
|
101289
|
+
}
|
|
101290
|
+
|
|
101291
|
+
bool ClientContext::IsActiveResult(ClientContextLock &lock, BaseQueryResult *result) {
|
|
101292
|
+
if (!active_query) {
|
|
101293
|
+
return false;
|
|
101294
|
+
}
|
|
101295
|
+
return active_query->open_result == result;
|
|
101642
101296
|
}
|
|
101643
101297
|
|
|
101644
101298
|
static bool IsExplainAnalyze(SQLStatement *statement) {
|
|
@@ -101652,19 +101306,10 @@ static bool IsExplainAnalyze(SQLStatement *statement) {
|
|
|
101652
101306
|
return explain.explain_type == ExplainType::EXPLAIN_ANALYZE;
|
|
101653
101307
|
}
|
|
101654
101308
|
|
|
101655
|
-
unique_ptr<
|
|
101656
|
-
|
|
101657
|
-
|
|
101658
|
-
vector<Value> *values,
|
|
101659
|
-
bool allow_stream_result) {
|
|
101660
|
-
this->query = query;
|
|
101661
|
-
|
|
101662
|
-
unique_ptr<QueryResult> result;
|
|
101309
|
+
unique_ptr<PendingQueryResult> ClientContext::PendingStatementOrPreparedStatementInternal(
|
|
101310
|
+
ClientContextLock &lock, const string &query, unique_ptr<SQLStatement> statement,
|
|
101311
|
+
shared_ptr<PreparedStatementData> &prepared, vector<Value> *values) {
|
|
101663
101312
|
// check if we are on AutoCommit. In this case we should start a transaction.
|
|
101664
|
-
if (transaction.IsAutoCommit()) {
|
|
101665
|
-
transaction.BeginTransaction();
|
|
101666
|
-
}
|
|
101667
|
-
ActiveTransaction().active_query = db->GetTransactionManager().GetQueryNumber();
|
|
101668
101313
|
if (statement && config.query_verification_enabled) {
|
|
101669
101314
|
// query verification is enabled
|
|
101670
101315
|
// create a copy of the statement, and use the copy
|
|
@@ -101674,19 +101319,29 @@ unique_ptr<QueryResult> ClientContext::RunStatementOrPreparedStatement(ClientCon
|
|
|
101674
101319
|
// in case this is a select query, we verify the original statement
|
|
101675
101320
|
string error = VerifyQuery(lock, query, move(statement));
|
|
101676
101321
|
if (!error.empty()) {
|
|
101677
|
-
// query failed: abort now
|
|
101678
|
-
FinalizeQuery(lock, false);
|
|
101679
101322
|
// error in verifying query
|
|
101680
|
-
return make_unique<
|
|
101323
|
+
return make_unique<PendingQueryResult>(error);
|
|
101681
101324
|
}
|
|
101682
101325
|
}
|
|
101683
101326
|
statement = move(copied_statement);
|
|
101684
101327
|
}
|
|
101328
|
+
return PendingStatementOrPreparedStatement(lock, query, move(statement), prepared, values);
|
|
101329
|
+
}
|
|
101330
|
+
|
|
101331
|
+
unique_ptr<PendingQueryResult>
|
|
101332
|
+
ClientContext::PendingStatementOrPreparedStatement(ClientContextLock &lock, const string &query,
|
|
101333
|
+
unique_ptr<SQLStatement> statement,
|
|
101334
|
+
shared_ptr<PreparedStatementData> &prepared, vector<Value> *values) {
|
|
101335
|
+
unique_ptr<PendingQueryResult> result;
|
|
101336
|
+
|
|
101337
|
+
BeginQueryInternal(lock, query);
|
|
101685
101338
|
// start the profiler
|
|
101686
|
-
profiler
|
|
101339
|
+
auto &profiler = QueryProfiler::Get(*this);
|
|
101340
|
+
profiler.StartQuery(query, IsExplainAnalyze(statement ? statement.get() : prepared->unbound_statement.get()));
|
|
101341
|
+
bool invalidate_query = true;
|
|
101687
101342
|
try {
|
|
101688
101343
|
if (statement) {
|
|
101689
|
-
result =
|
|
101344
|
+
result = PendingStatementInternal(lock, query, move(statement));
|
|
101690
101345
|
} else {
|
|
101691
101346
|
auto &catalog = Catalog::GetCatalog(*this);
|
|
101692
101347
|
if (prepared->unbound_statement && catalog.GetCatalogVersion() != prepared->catalog_version) {
|
|
@@ -101699,68 +101354,22 @@ unique_ptr<QueryResult> ClientContext::RunStatementOrPreparedStatement(ClientCon
|
|
|
101699
101354
|
new_prepared->unbound_statement = move(prepared->unbound_statement);
|
|
101700
101355
|
prepared = move(new_prepared);
|
|
101701
101356
|
}
|
|
101702
|
-
result =
|
|
101357
|
+
result = PendingPreparedStatement(lock, prepared, *values);
|
|
101703
101358
|
}
|
|
101704
101359
|
} catch (StandardException &ex) {
|
|
101705
101360
|
// standard exceptions do not invalidate the current transaction
|
|
101706
|
-
result = make_unique<
|
|
101361
|
+
result = make_unique<PendingQueryResult>(ex.what());
|
|
101362
|
+
invalidate_query = false;
|
|
101707
101363
|
} catch (std::exception &ex) {
|
|
101708
101364
|
// other types of exceptions do invalidate the current transaction
|
|
101709
|
-
|
|
101710
|
-
ActiveTransaction().Invalidate();
|
|
101711
|
-
}
|
|
101712
|
-
result = make_unique<MaterializedQueryResult>(ex.what());
|
|
101365
|
+
result = make_unique<PendingQueryResult>(ex.what());
|
|
101713
101366
|
}
|
|
101714
101367
|
if (!result->success) {
|
|
101715
|
-
// initial failures should always be reported as MaterializedResult
|
|
101716
|
-
D_ASSERT(result->type != QueryResultType::STREAM_RESULT);
|
|
101717
101368
|
// query failed: abort now
|
|
101718
|
-
|
|
101369
|
+
EndQueryInternal(lock, false, invalidate_query);
|
|
101719
101370
|
return result;
|
|
101720
101371
|
}
|
|
101721
|
-
|
|
101722
|
-
if (result->type == QueryResultType::STREAM_RESULT) {
|
|
101723
|
-
// store as currently open result if it is a stream result
|
|
101724
|
-
this->open_result = (StreamQueryResult *)result.get();
|
|
101725
|
-
} else {
|
|
101726
|
-
// finalize the query if it is not a stream result
|
|
101727
|
-
string error = FinalizeQuery(lock, true);
|
|
101728
|
-
if (!error.empty()) {
|
|
101729
|
-
// failure in committing transaction
|
|
101730
|
-
return make_unique<MaterializedQueryResult>(error);
|
|
101731
|
-
}
|
|
101732
|
-
}
|
|
101733
|
-
return result;
|
|
101734
|
-
}
|
|
101735
|
-
|
|
101736
|
-
unique_ptr<QueryResult> ClientContext::RunStatement(ClientContextLock &lock, const string &query,
|
|
101737
|
-
unique_ptr<SQLStatement> statement, bool allow_stream_result) {
|
|
101738
|
-
shared_ptr<PreparedStatementData> prepared;
|
|
101739
|
-
return RunStatementOrPreparedStatement(lock, query, move(statement), prepared, nullptr, allow_stream_result);
|
|
101740
|
-
}
|
|
101741
|
-
|
|
101742
|
-
unique_ptr<QueryResult> ClientContext::RunStatements(ClientContextLock &lock, const string &query,
|
|
101743
|
-
vector<unique_ptr<SQLStatement>> &statements,
|
|
101744
|
-
bool allow_stream_result) {
|
|
101745
|
-
// now we have a list of statements
|
|
101746
|
-
// iterate over them and execute them one by one
|
|
101747
|
-
unique_ptr<QueryResult> result;
|
|
101748
|
-
QueryResult *last_result = nullptr;
|
|
101749
|
-
for (idx_t i = 0; i < statements.size(); i++) {
|
|
101750
|
-
auto &statement = statements[i];
|
|
101751
|
-
bool is_last_statement = i + 1 == statements.size();
|
|
101752
|
-
auto current_result = RunStatement(lock, query, move(statement), allow_stream_result && is_last_statement);
|
|
101753
|
-
// now append the result to the list of results
|
|
101754
|
-
if (!last_result) {
|
|
101755
|
-
// first result of the query
|
|
101756
|
-
result = move(current_result);
|
|
101757
|
-
last_result = result.get();
|
|
101758
|
-
} else {
|
|
101759
|
-
// later results; attach to the result chain
|
|
101760
|
-
last_result->next = move(current_result);
|
|
101761
|
-
last_result = last_result->next.get();
|
|
101762
|
-
}
|
|
101763
|
-
}
|
|
101372
|
+
D_ASSERT(active_query->open_result == result.get());
|
|
101764
101373
|
return result;
|
|
101765
101374
|
}
|
|
101766
101375
|
|
|
@@ -101786,34 +101395,96 @@ void ClientContext::LogQueryInternal(ClientContextLock &, const string &query) {
|
|
|
101786
101395
|
}
|
|
101787
101396
|
|
|
101788
101397
|
unique_ptr<QueryResult> ClientContext::Query(unique_ptr<SQLStatement> statement, bool allow_stream_result) {
|
|
101789
|
-
auto
|
|
101790
|
-
|
|
101791
|
-
|
|
101792
|
-
vector<unique_ptr<SQLStatement>> statements;
|
|
101793
|
-
statements.push_back(move(statement));
|
|
101794
|
-
|
|
101795
|
-
return RunStatements(*lock, query, statements, allow_stream_result);
|
|
101398
|
+
auto pending_query = PendingQuery(move(statement));
|
|
101399
|
+
return pending_query->Execute(allow_stream_result);
|
|
101796
101400
|
}
|
|
101797
101401
|
|
|
101798
101402
|
unique_ptr<QueryResult> ClientContext::Query(const string &query, bool allow_stream_result) {
|
|
101799
101403
|
auto lock = LockContext();
|
|
101800
|
-
LogQueryInternal(*lock, query);
|
|
101801
101404
|
|
|
101405
|
+
string error;
|
|
101802
101406
|
vector<unique_ptr<SQLStatement>> statements;
|
|
101407
|
+
if (!ParseStatements(*lock, query, statements, error)) {
|
|
101408
|
+
return make_unique<MaterializedQueryResult>(move(error));
|
|
101409
|
+
}
|
|
101410
|
+
if (statements.empty()) {
|
|
101411
|
+
// no statements, return empty successful result
|
|
101412
|
+
return make_unique<MaterializedQueryResult>(StatementType::INVALID_STATEMENT);
|
|
101413
|
+
}
|
|
101414
|
+
|
|
101415
|
+
unique_ptr<QueryResult> result;
|
|
101416
|
+
QueryResult *last_result = nullptr;
|
|
101417
|
+
for (idx_t i = 0; i < statements.size(); i++) {
|
|
101418
|
+
auto &statement = statements[i];
|
|
101419
|
+
bool is_last_statement = i + 1 == statements.size();
|
|
101420
|
+
bool stream_result = allow_stream_result && is_last_statement;
|
|
101421
|
+
auto pending_query = PendingQueryInternal(*lock, move(statement));
|
|
101422
|
+
unique_ptr<QueryResult> current_result;
|
|
101423
|
+
if (!pending_query->success) {
|
|
101424
|
+
current_result = make_unique<MaterializedQueryResult>(pending_query->error);
|
|
101425
|
+
} else {
|
|
101426
|
+
current_result = ExecutePendingQueryInternal(*lock, *pending_query, stream_result);
|
|
101427
|
+
}
|
|
101428
|
+
// now append the result to the list of results
|
|
101429
|
+
if (!last_result) {
|
|
101430
|
+
// first result of the query
|
|
101431
|
+
result = move(current_result);
|
|
101432
|
+
last_result = result.get();
|
|
101433
|
+
} else {
|
|
101434
|
+
// later results; attach to the result chain
|
|
101435
|
+
last_result->next = move(current_result);
|
|
101436
|
+
last_result = last_result->next.get();
|
|
101437
|
+
}
|
|
101438
|
+
}
|
|
101439
|
+
return result;
|
|
101440
|
+
}
|
|
101441
|
+
|
|
101442
|
+
bool ClientContext::ParseStatements(ClientContextLock &lock, const string &query,
|
|
101443
|
+
vector<unique_ptr<SQLStatement>> &result, string &error) {
|
|
101803
101444
|
try {
|
|
101804
|
-
InitialCleanup(
|
|
101445
|
+
InitialCleanup(lock);
|
|
101805
101446
|
// parse the query and transform it into a set of statements
|
|
101806
|
-
|
|
101447
|
+
result = ParseStatementsInternal(lock, query);
|
|
101448
|
+
return true;
|
|
101807
101449
|
} catch (std::exception &ex) {
|
|
101808
|
-
|
|
101450
|
+
error = ex.what();
|
|
101451
|
+
return false;
|
|
101809
101452
|
}
|
|
101453
|
+
}
|
|
101810
101454
|
|
|
101811
|
-
|
|
101812
|
-
|
|
101813
|
-
|
|
101455
|
+
unique_ptr<PendingQueryResult> ClientContext::PendingQuery(const string &query) {
|
|
101456
|
+
auto lock = LockContext();
|
|
101457
|
+
|
|
101458
|
+
string error;
|
|
101459
|
+
vector<unique_ptr<SQLStatement>> statements;
|
|
101460
|
+
if (!ParseStatements(*lock, query, statements, error)) {
|
|
101461
|
+
return make_unique<PendingQueryResult>(move(error));
|
|
101462
|
+
}
|
|
101463
|
+
if (statements.size() != 1) {
|
|
101464
|
+
return make_unique<PendingQueryResult>("PendingQuery can only take a single statement");
|
|
101814
101465
|
}
|
|
101466
|
+
return PendingQueryInternal(*lock, move(statements[0]));
|
|
101467
|
+
}
|
|
101815
101468
|
|
|
101816
|
-
|
|
101469
|
+
unique_ptr<PendingQueryResult> ClientContext::PendingQuery(unique_ptr<SQLStatement> statement) {
|
|
101470
|
+
auto lock = LockContext();
|
|
101471
|
+
return PendingQueryInternal(*lock, move(statement));
|
|
101472
|
+
}
|
|
101473
|
+
|
|
101474
|
+
unique_ptr<PendingQueryResult> ClientContext::PendingQueryInternal(ClientContextLock &lock,
|
|
101475
|
+
unique_ptr<SQLStatement> statement, bool verify) {
|
|
101476
|
+
auto query = statement->query;
|
|
101477
|
+
shared_ptr<PreparedStatementData> prepared;
|
|
101478
|
+
if (verify) {
|
|
101479
|
+
return PendingStatementOrPreparedStatementInternal(lock, query, move(statement), prepared, nullptr);
|
|
101480
|
+
} else {
|
|
101481
|
+
return PendingStatementOrPreparedStatement(lock, query, move(statement), prepared, nullptr);
|
|
101482
|
+
}
|
|
101483
|
+
}
|
|
101484
|
+
|
|
101485
|
+
unique_ptr<QueryResult> ClientContext::ExecutePendingQueryInternal(ClientContextLock &lock, PendingQueryResult &query,
|
|
101486
|
+
bool allow_stream_result) {
|
|
101487
|
+
return query.ExecuteInternal(lock, allow_stream_result);
|
|
101817
101488
|
}
|
|
101818
101489
|
|
|
101819
101490
|
void ClientContext::Interrupt() {
|
|
@@ -101822,12 +101493,14 @@ void ClientContext::Interrupt() {
|
|
|
101822
101493
|
|
|
101823
101494
|
void ClientContext::EnableProfiling() {
|
|
101824
101495
|
auto lock = LockContext();
|
|
101825
|
-
|
|
101496
|
+
auto &config = ClientConfig::GetConfig(*this);
|
|
101497
|
+
config.enable_profiler = true;
|
|
101826
101498
|
}
|
|
101827
101499
|
|
|
101828
101500
|
void ClientContext::DisableProfiling() {
|
|
101829
101501
|
auto lock = LockContext();
|
|
101830
|
-
|
|
101502
|
+
auto &config = ClientConfig::GetConfig(*this);
|
|
101503
|
+
config.enable_profiler = false;
|
|
101831
101504
|
}
|
|
101832
101505
|
|
|
101833
101506
|
string ClientContext::VerifyQuery(ClientContextLock &lock, const string &query, unique_ptr<SQLStatement> statement) {
|
|
@@ -101889,9 +101562,10 @@ string ClientContext::VerifyQuery(ClientContextLock &lock, const string &query,
|
|
|
101889
101562
|
#endif
|
|
101890
101563
|
|
|
101891
101564
|
// disable profiling if it is enabled
|
|
101892
|
-
|
|
101565
|
+
auto &config = ClientConfig::GetConfig(*this);
|
|
101566
|
+
bool profiling_is_enabled = config.enable_profiler;
|
|
101893
101567
|
if (profiling_is_enabled) {
|
|
101894
|
-
|
|
101568
|
+
config.enable_profiler = false;
|
|
101895
101569
|
}
|
|
101896
101570
|
|
|
101897
101571
|
// see below
|
|
@@ -101908,7 +101582,7 @@ string ClientContext::VerifyQuery(ClientContextLock &lock, const string &query,
|
|
|
101908
101582
|
|
|
101909
101583
|
// execute the original statement
|
|
101910
101584
|
try {
|
|
101911
|
-
auto result = RunStatementInternal(lock, query, move(statement), false);
|
|
101585
|
+
auto result = RunStatementInternal(lock, query, move(statement), false, false);
|
|
101912
101586
|
original_result = unique_ptr_cast<QueryResult, MaterializedQueryResult>(move(result));
|
|
101913
101587
|
} catch (std::exception &ex) {
|
|
101914
101588
|
original_result->error = ex.what();
|
|
@@ -101921,7 +101595,7 @@ string ClientContext::VerifyQuery(ClientContextLock &lock, const string &query,
|
|
|
101921
101595
|
auto explain_q = "EXPLAIN " + query;
|
|
101922
101596
|
auto explain_stmt = make_unique<ExplainStatement>(move(statement_copy_for_explain));
|
|
101923
101597
|
try {
|
|
101924
|
-
RunStatementInternal(lock, explain_q, move(explain_stmt), false);
|
|
101598
|
+
RunStatementInternal(lock, explain_q, move(explain_stmt), false, false);
|
|
101925
101599
|
} catch (std::exception &ex) { // LCOV_EXCL_START
|
|
101926
101600
|
return "EXPLAIN failed but query did not (" + string(ex.what()) + ")";
|
|
101927
101601
|
} // LCOV_EXCL_STOP
|
|
@@ -101929,7 +101603,7 @@ string ClientContext::VerifyQuery(ClientContextLock &lock, const string &query,
|
|
|
101929
101603
|
|
|
101930
101604
|
// now execute the copied statement
|
|
101931
101605
|
try {
|
|
101932
|
-
auto result = RunStatementInternal(lock, query, move(copied_stmt), false);
|
|
101606
|
+
auto result = RunStatementInternal(lock, query, move(copied_stmt), false, false);
|
|
101933
101607
|
copied_result = unique_ptr_cast<QueryResult, MaterializedQueryResult>(move(result));
|
|
101934
101608
|
} catch (std::exception &ex) {
|
|
101935
101609
|
copied_result->error = ex.what();
|
|
@@ -101938,7 +101612,7 @@ string ClientContext::VerifyQuery(ClientContextLock &lock, const string &query,
|
|
|
101938
101612
|
}
|
|
101939
101613
|
// now execute the deserialized statement
|
|
101940
101614
|
try {
|
|
101941
|
-
auto result = RunStatementInternal(lock, query, move(deserialized_stmt), false);
|
|
101615
|
+
auto result = RunStatementInternal(lock, query, move(deserialized_stmt), false, false);
|
|
101942
101616
|
deserialized_result = unique_ptr_cast<QueryResult, MaterializedQueryResult>(move(result));
|
|
101943
101617
|
} catch (std::exception &ex) {
|
|
101944
101618
|
deserialized_result->error = ex.what();
|
|
@@ -101948,7 +101622,7 @@ string ClientContext::VerifyQuery(ClientContextLock &lock, const string &query,
|
|
|
101948
101622
|
// now execute the unoptimized statement
|
|
101949
101623
|
config.enable_optimizer = false;
|
|
101950
101624
|
try {
|
|
101951
|
-
auto result = RunStatementInternal(lock, query, move(unoptimized_stmt), false);
|
|
101625
|
+
auto result = RunStatementInternal(lock, query, move(unoptimized_stmt), false, false);
|
|
101952
101626
|
unoptimized_result = unique_ptr_cast<QueryResult, MaterializedQueryResult>(move(result));
|
|
101953
101627
|
} catch (std::exception &ex) {
|
|
101954
101628
|
unoptimized_result->error = ex.what();
|
|
@@ -101958,7 +101632,7 @@ string ClientContext::VerifyQuery(ClientContextLock &lock, const string &query,
|
|
|
101958
101632
|
config.enable_optimizer = true;
|
|
101959
101633
|
|
|
101960
101634
|
if (profiling_is_enabled) {
|
|
101961
|
-
|
|
101635
|
+
config.enable_profiler = true;
|
|
101962
101636
|
}
|
|
101963
101637
|
|
|
101964
101638
|
// now compare the results
|
|
@@ -102012,7 +101686,7 @@ bool ClientContext::UpdateFunctionInfoFromEntry(ScalarFunctionCatalogEntry *exis
|
|
|
102012
101686
|
void ClientContext::RegisterFunction(CreateFunctionInfo *info) {
|
|
102013
101687
|
RunFunctionInTransaction([&]() {
|
|
102014
101688
|
auto &catalog = Catalog::GetCatalog(*this);
|
|
102015
|
-
|
|
101689
|
+
auto existing_function = (ScalarFunctionCatalogEntry *)catalog.GetEntry(
|
|
102016
101690
|
*this, CatalogType::SCALAR_FUNCTION_ENTRY, info->schema, info->name, true);
|
|
102017
101691
|
if (existing_function) {
|
|
102018
101692
|
if (UpdateFunctionInfoFromEntry(existing_function, (CreateScalarFunctionInfo *)info)) {
|
|
@@ -102034,6 +101708,7 @@ void ClientContext::RunFunctionInTransactionInternal(ClientContextLock &lock, co
|
|
|
102034
101708
|
// check if we are on AutoCommit. In this case we should start a transaction
|
|
102035
101709
|
bool require_new_transaction = transaction.IsAutoCommit() && !transaction.HasActiveTransaction();
|
|
102036
101710
|
if (require_new_transaction) {
|
|
101711
|
+
D_ASSERT(!active_query);
|
|
102037
101712
|
transaction.BeginTransaction();
|
|
102038
101713
|
}
|
|
102039
101714
|
try {
|
|
@@ -102148,12 +101823,14 @@ unique_ptr<QueryResult> ClientContext::Execute(const shared_ptr<Relation> &relat
|
|
|
102148
101823
|
// verify read only statements by running a select statement
|
|
102149
101824
|
auto select = make_unique<SelectStatement>();
|
|
102150
101825
|
select->node = relation->GetQueryNode();
|
|
102151
|
-
|
|
101826
|
+
RunStatementInternal(*lock, query, move(select), false);
|
|
102152
101827
|
}
|
|
102153
101828
|
}
|
|
102154
101829
|
auto &expected_columns = relation->Columns();
|
|
102155
101830
|
auto relation_stmt = make_unique<RelationStatement>(relation);
|
|
102156
|
-
|
|
101831
|
+
|
|
101832
|
+
unique_ptr<QueryResult> result;
|
|
101833
|
+
result = RunStatementInternal(*lock, query, move(relation_stmt), false);
|
|
102157
101834
|
if (!result->success) {
|
|
102158
101835
|
return result;
|
|
102159
101836
|
}
|
|
@@ -102925,10 +102602,11 @@ Connection::Connection(DuckDB &database) : Connection(*database.instance) {
|
|
|
102925
102602
|
}
|
|
102926
102603
|
|
|
102927
102604
|
string Connection::GetProfilingInformation(ProfilerPrintFormat format) {
|
|
102605
|
+
auto &profiler = QueryProfiler::Get(*context);
|
|
102928
102606
|
if (format == ProfilerPrintFormat::JSON) {
|
|
102929
|
-
return
|
|
102607
|
+
return profiler.ToJSON();
|
|
102930
102608
|
} else {
|
|
102931
|
-
return
|
|
102609
|
+
return profiler.ToString();
|
|
102932
102610
|
}
|
|
102933
102611
|
}
|
|
102934
102612
|
|
|
@@ -102972,6 +102650,14 @@ unique_ptr<MaterializedQueryResult> Connection::Query(unique_ptr<SQLStatement> s
|
|
|
102972
102650
|
return unique_ptr_cast<QueryResult, MaterializedQueryResult>(move(result));
|
|
102973
102651
|
}
|
|
102974
102652
|
|
|
102653
|
+
unique_ptr<PendingQueryResult> Connection::PendingQuery(const string &query) {
|
|
102654
|
+
return context->PendingQuery(query);
|
|
102655
|
+
}
|
|
102656
|
+
|
|
102657
|
+
unique_ptr<PendingQueryResult> Connection::PendingQuery(unique_ptr<SQLStatement> statement) {
|
|
102658
|
+
return context->PendingQuery(move(statement));
|
|
102659
|
+
}
|
|
102660
|
+
|
|
102975
102661
|
unique_ptr<PreparedStatement> Connection::Prepare(const string &query) {
|
|
102976
102662
|
return context->Prepare(query);
|
|
102977
102663
|
}
|
|
@@ -103443,6 +103129,7 @@ void DuckDB::SetExtensionLoaded(const std::string &name) {
|
|
|
103443
103129
|
|
|
103444
103130
|
|
|
103445
103131
|
|
|
103132
|
+
|
|
103446
103133
|
#ifdef BUILD_ICU_EXTENSION
|
|
103447
103134
|
#include "icu-extension.hpp"
|
|
103448
103135
|
#endif
|
|
@@ -103476,7 +103163,7 @@ namespace duckdb {
|
|
|
103476
103163
|
void ExtensionHelper::LoadAllExtensions(DuckDB &db) {
|
|
103477
103164
|
unordered_set<string> extensions {"parquet", "icu", "tpch", "tpcds", "fts", "httpfs", "visualizer"};
|
|
103478
103165
|
for (auto &ext : extensions) {
|
|
103479
|
-
|
|
103166
|
+
LoadExtensionInternal(db, ext, true);
|
|
103480
103167
|
}
|
|
103481
103168
|
}
|
|
103482
103169
|
|
|
@@ -103484,6 +103171,27 @@ void ExtensionHelper::LoadAllExtensions(DuckDB &db) {
|
|
|
103484
103171
|
// Load Statically Compiled Extension
|
|
103485
103172
|
//===--------------------------------------------------------------------===//
|
|
103486
103173
|
ExtensionLoadResult ExtensionHelper::LoadExtension(DuckDB &db, const std::string &extension) {
|
|
103174
|
+
return LoadExtensionInternal(db, extension, false);
|
|
103175
|
+
}
|
|
103176
|
+
|
|
103177
|
+
ExtensionLoadResult ExtensionHelper::LoadExtensionInternal(DuckDB &db, const std::string &extension,
|
|
103178
|
+
bool initial_load) {
|
|
103179
|
+
#ifdef DUCKDB_TEST_REMOTE_INSTALL
|
|
103180
|
+
if (!initial_load && StringUtil::Contains(DUCKDB_TEST_REMOTE_INSTALL, extension)) {
|
|
103181
|
+
Connection con(db);
|
|
103182
|
+
auto result = con.Query("INSTALL " + extension);
|
|
103183
|
+
if (!result->success) {
|
|
103184
|
+
result->Print();
|
|
103185
|
+
return ExtensionLoadResult::EXTENSION_UNKNOWN;
|
|
103186
|
+
}
|
|
103187
|
+
result = con.Query("LOAD " + extension);
|
|
103188
|
+
if (!result->success) {
|
|
103189
|
+
result->Print();
|
|
103190
|
+
return ExtensionLoadResult::EXTENSION_UNKNOWN;
|
|
103191
|
+
}
|
|
103192
|
+
return ExtensionLoadResult::LOADED_EXTENSION;
|
|
103193
|
+
}
|
|
103194
|
+
#endif
|
|
103487
103195
|
if (extension == "parquet") {
|
|
103488
103196
|
#ifdef BUILD_PARQUET_EXTENSION
|
|
103489
103197
|
db.LoadExtension<ParquetExtension>();
|
|
@@ -103795,6 +103503,11 @@ inline const unsigned char *ASN1_STRING_get0_data(const ASN1_STRING *asn1) {
|
|
|
103795
103503
|
#include <brotli/encode.h>
|
|
103796
103504
|
#endif
|
|
103797
103505
|
|
|
103506
|
+
#ifdef __clang__
|
|
103507
|
+
#pragma clang diagnostic push
|
|
103508
|
+
#pragma clang diagnostic ignored "-Wexit-time-destructors"
|
|
103509
|
+
#endif
|
|
103510
|
+
|
|
103798
103511
|
/*
|
|
103799
103512
|
* Declaration
|
|
103800
103513
|
*/
|
|
@@ -110971,6 +110684,10 @@ inline SSL_CTX *Client::ssl_context() const {
|
|
|
110971
110684
|
|
|
110972
110685
|
} // namespace CPPHTTPLIB_NAMESPACE
|
|
110973
110686
|
|
|
110687
|
+
#ifdef __clang__
|
|
110688
|
+
#pragma clang diagnostic pop
|
|
110689
|
+
#endif
|
|
110690
|
+
|
|
110974
110691
|
#endif // CPPHTTPLIB_HTTPLIB_H
|
|
110975
110692
|
|
|
110976
110693
|
|
|
@@ -110982,12 +110699,13 @@ inline SSL_CTX *Client::ssl_context() const {
|
|
|
110982
110699
|
|
|
110983
110700
|
namespace duckdb {
|
|
110984
110701
|
|
|
110985
|
-
const vector<string> ExtensionHelper::PATH_COMPONENTS = {".duckdb", "extensions", DuckDB::SourceID(),
|
|
110986
|
-
DuckDB::Platform()};
|
|
110987
|
-
|
|
110988
110702
|
//===--------------------------------------------------------------------===//
|
|
110989
110703
|
// Install Extension
|
|
110990
110704
|
//===--------------------------------------------------------------------===//
|
|
110705
|
+
const vector<string> ExtensionHelper::PathComponents() {
|
|
110706
|
+
return vector<string> {".duckdb", "extensions", DuckDB::SourceID(), DuckDB::Platform()};
|
|
110707
|
+
}
|
|
110708
|
+
|
|
110991
110709
|
void ExtensionHelper::InstallExtension(DatabaseInstance &db, const string &extension, bool force_install) {
|
|
110992
110710
|
auto &config = DBConfig::GetConfig(db);
|
|
110993
110711
|
if (!config.enable_external_access) {
|
|
@@ -110999,7 +110717,8 @@ void ExtensionHelper::InstallExtension(DatabaseInstance &db, const string &exten
|
|
|
110999
110717
|
if (!fs.DirectoryExists(local_path)) {
|
|
111000
110718
|
throw InternalException("Can't find the home directory at " + local_path);
|
|
111001
110719
|
}
|
|
111002
|
-
|
|
110720
|
+
auto path_components = PathComponents();
|
|
110721
|
+
for (auto &path_ele : path_components) {
|
|
111003
110722
|
local_path = fs.JoinPath(local_path, path_ele);
|
|
111004
110723
|
if (!fs.DirectoryExists(local_path)) {
|
|
111005
110724
|
fs.CreateDirectory(local_path);
|
|
@@ -111138,7 +110857,8 @@ void ExtensionHelper::LoadExternalExtension(DatabaseInstance &db, const string &
|
|
|
111138
110857
|
// shorthand case
|
|
111139
110858
|
if (!StringUtil::Contains(extension, ".") && !StringUtil::Contains(extension, fs.PathSeparator())) {
|
|
111140
110859
|
string local_path = fs.GetHomeDirectory();
|
|
111141
|
-
|
|
110860
|
+
auto path_components = PathComponents();
|
|
110861
|
+
for (auto &path_ele : path_components) {
|
|
111142
110862
|
local_path = fs.JoinPath(local_path, path_ele);
|
|
111143
110863
|
}
|
|
111144
110864
|
filename = fs.JoinPath(local_path, extension + ".duckdb_extension");
|
|
@@ -111246,6 +110966,75 @@ unique_ptr<DataChunk> MaterializedQueryResult::FetchRaw() {
|
|
|
111246
110966
|
|
|
111247
110967
|
|
|
111248
110968
|
|
|
110969
|
+
namespace duckdb {
|
|
110970
|
+
|
|
110971
|
+
PendingQueryResult::PendingQueryResult(shared_ptr<ClientContext> context_p, PreparedStatementData &statement,
|
|
110972
|
+
vector<LogicalType> types_p)
|
|
110973
|
+
: BaseQueryResult(QueryResultType::PENDING_RESULT, statement.statement_type, move(types_p), statement.names),
|
|
110974
|
+
context(move(context_p)) {
|
|
110975
|
+
}
|
|
110976
|
+
|
|
110977
|
+
PendingQueryResult::PendingQueryResult(string error) : BaseQueryResult(QueryResultType::PENDING_RESULT, move(error)) {
|
|
110978
|
+
}
|
|
110979
|
+
|
|
110980
|
+
PendingQueryResult::~PendingQueryResult() {
|
|
110981
|
+
}
|
|
110982
|
+
|
|
110983
|
+
unique_ptr<ClientContextLock> PendingQueryResult::LockContext() {
|
|
110984
|
+
if (!context) {
|
|
110985
|
+
throw InvalidInputException("Attempting to execute an unsuccessful or closed pending query result\nError: %s",
|
|
110986
|
+
error);
|
|
110987
|
+
}
|
|
110988
|
+
return context->LockContext();
|
|
110989
|
+
}
|
|
110990
|
+
|
|
110991
|
+
void PendingQueryResult::CheckExecutableInternal(ClientContextLock &lock) {
|
|
110992
|
+
bool invalidated = !success || !context;
|
|
110993
|
+
if (!invalidated) {
|
|
110994
|
+
invalidated = !context->IsActiveResult(lock, this);
|
|
110995
|
+
}
|
|
110996
|
+
if (invalidated) {
|
|
110997
|
+
throw InvalidInputException("Attempting to execute an unsuccessful or closed pending query result\nError: %s",
|
|
110998
|
+
error);
|
|
110999
|
+
}
|
|
111000
|
+
}
|
|
111001
|
+
|
|
111002
|
+
PendingExecutionResult PendingQueryResult::ExecuteTask() {
|
|
111003
|
+
auto lock = LockContext();
|
|
111004
|
+
return ExecuteTaskInternal(*lock);
|
|
111005
|
+
}
|
|
111006
|
+
|
|
111007
|
+
PendingExecutionResult PendingQueryResult::ExecuteTaskInternal(ClientContextLock &lock) {
|
|
111008
|
+
CheckExecutableInternal(lock);
|
|
111009
|
+
return context->ExecuteTaskInternal(lock, *this);
|
|
111010
|
+
}
|
|
111011
|
+
|
|
111012
|
+
unique_ptr<QueryResult> PendingQueryResult::ExecuteInternal(ClientContextLock &lock, bool allow_streaming_result) {
|
|
111013
|
+
CheckExecutableInternal(lock);
|
|
111014
|
+
while (ExecuteTaskInternal(lock) == PendingExecutionResult::RESULT_NOT_READY) {
|
|
111015
|
+
}
|
|
111016
|
+
if (!success) {
|
|
111017
|
+
return make_unique<MaterializedQueryResult>(error);
|
|
111018
|
+
}
|
|
111019
|
+
auto result = context->FetchResultInternal(lock, *this, allow_streaming_result);
|
|
111020
|
+
Close();
|
|
111021
|
+
return result;
|
|
111022
|
+
}
|
|
111023
|
+
|
|
111024
|
+
unique_ptr<QueryResult> PendingQueryResult::Execute(bool allow_streaming_result) {
|
|
111025
|
+
auto lock = LockContext();
|
|
111026
|
+
return ExecuteInternal(*lock, allow_streaming_result);
|
|
111027
|
+
}
|
|
111028
|
+
|
|
111029
|
+
void PendingQueryResult::Close() {
|
|
111030
|
+
context.reset();
|
|
111031
|
+
}
|
|
111032
|
+
|
|
111033
|
+
} // namespace duckdb
|
|
111034
|
+
|
|
111035
|
+
|
|
111036
|
+
|
|
111037
|
+
|
|
111249
111038
|
|
|
111250
111039
|
namespace duckdb {
|
|
111251
111040
|
|
|
@@ -111282,11 +111071,19 @@ const vector<string> &PreparedStatement::GetNames() {
|
|
|
111282
111071
|
}
|
|
111283
111072
|
|
|
111284
111073
|
unique_ptr<QueryResult> PreparedStatement::Execute(vector<Value> &values, bool allow_stream_result) {
|
|
111074
|
+
auto pending = PendingQuery(values);
|
|
111075
|
+
if (!pending->success) {
|
|
111076
|
+
return make_unique<MaterializedQueryResult>(pending->error);
|
|
111077
|
+
}
|
|
111078
|
+
return pending->Execute(allow_stream_result && data->allow_stream_result);
|
|
111079
|
+
}
|
|
111080
|
+
|
|
111081
|
+
unique_ptr<PendingQueryResult> PreparedStatement::PendingQuery(vector<Value> &values) {
|
|
111285
111082
|
if (!success) {
|
|
111286
111083
|
throw InvalidInputException("Attempting to execute an unsuccessfully prepared statement!");
|
|
111287
111084
|
}
|
|
111288
111085
|
D_ASSERT(data);
|
|
111289
|
-
auto result = context->
|
|
111086
|
+
auto result = context->PendingQuery(query, data, values);
|
|
111290
111087
|
return result;
|
|
111291
111088
|
}
|
|
111292
111089
|
|
|
@@ -111372,16 +111169,42 @@ using std::ofstream;
|
|
|
111372
111169
|
|
|
111373
111170
|
|
|
111374
111171
|
|
|
111172
|
+
|
|
111173
|
+
|
|
111375
111174
|
#include <utility>
|
|
111376
111175
|
#include <algorithm>
|
|
111377
111176
|
|
|
111378
111177
|
namespace duckdb {
|
|
111379
111178
|
|
|
111179
|
+
QueryProfiler::QueryProfiler(ClientContext &context_p)
|
|
111180
|
+
: context(context_p), running(false), query_requires_profiling(false), is_explain_analyze(false) {
|
|
111181
|
+
}
|
|
111182
|
+
|
|
111183
|
+
bool QueryProfiler::IsEnabled() const {
|
|
111184
|
+
return is_explain_analyze ? true : ClientConfig::GetConfig(context).enable_profiler;
|
|
111185
|
+
}
|
|
111186
|
+
|
|
111187
|
+
bool QueryProfiler::IsDetailedEnabled() const {
|
|
111188
|
+
return is_explain_analyze ? false : ClientConfig::GetConfig(context).enable_detailed_profiling;
|
|
111189
|
+
}
|
|
111190
|
+
|
|
111191
|
+
ProfilerPrintFormat QueryProfiler::GetPrintFormat() const {
|
|
111192
|
+
return is_explain_analyze ? ProfilerPrintFormat::NONE : ClientConfig::GetConfig(context).profiler_print_format;
|
|
111193
|
+
}
|
|
111194
|
+
|
|
111195
|
+
string QueryProfiler::GetSaveLocation() const {
|
|
111196
|
+
return is_explain_analyze ? string() : ClientConfig::GetConfig(context).profiler_save_location;
|
|
111197
|
+
}
|
|
111198
|
+
|
|
111199
|
+
QueryProfiler &QueryProfiler::Get(ClientContext &context) {
|
|
111200
|
+
return *context.profiler;
|
|
111201
|
+
}
|
|
111202
|
+
|
|
111380
111203
|
void QueryProfiler::StartQuery(string query, bool is_explain_analyze) {
|
|
111381
111204
|
if (is_explain_analyze) {
|
|
111382
111205
|
StartExplainAnalyze();
|
|
111383
111206
|
}
|
|
111384
|
-
if (!
|
|
111207
|
+
if (!IsEnabled()) {
|
|
111385
111208
|
return;
|
|
111386
111209
|
}
|
|
111387
111210
|
this->running = true;
|
|
@@ -111439,17 +111262,10 @@ void QueryProfiler::Finalize(TreeNode &node) {
|
|
|
111439
111262
|
|
|
111440
111263
|
void QueryProfiler::StartExplainAnalyze() {
|
|
111441
111264
|
this->is_explain_analyze = true;
|
|
111442
|
-
this->stored_enabled = enabled;
|
|
111443
|
-
this->stored_automatic_print_format = automatic_print_format;
|
|
111444
|
-
this->stored_save_location = save_location;
|
|
111445
|
-
|
|
111446
|
-
this->enabled = true;
|
|
111447
|
-
this->save_location = string();
|
|
111448
|
-
this->automatic_print_format = ProfilerPrintFormat::NONE;
|
|
111449
111265
|
}
|
|
111450
111266
|
|
|
111451
111267
|
void QueryProfiler::EndQuery() {
|
|
111452
|
-
if (!
|
|
111268
|
+
if (!IsEnabled() || !running) {
|
|
111453
111269
|
return;
|
|
111454
111270
|
}
|
|
111455
111271
|
|
|
@@ -111458,6 +111274,7 @@ void QueryProfiler::EndQuery() {
|
|
|
111458
111274
|
Finalize(*root);
|
|
111459
111275
|
}
|
|
111460
111276
|
this->running = false;
|
|
111277
|
+
auto automatic_print_format = GetPrintFormat();
|
|
111461
111278
|
// print or output the query profiling after termination, if this is enabled
|
|
111462
111279
|
if (automatic_print_format != ProfilerPrintFormat::NONE) {
|
|
111463
111280
|
// check if this query should be output based on the operator types
|
|
@@ -111469,7 +111286,7 @@ void QueryProfiler::EndQuery() {
|
|
|
111469
111286
|
} else if (automatic_print_format == ProfilerPrintFormat::QUERY_TREE_OPTIMIZER) {
|
|
111470
111287
|
query_info = ToString(true);
|
|
111471
111288
|
}
|
|
111472
|
-
|
|
111289
|
+
auto save_location = GetSaveLocation();
|
|
111473
111290
|
if (save_location.empty()) {
|
|
111474
111291
|
Printer::Print(query_info);
|
|
111475
111292
|
Printer::Print("\n");
|
|
@@ -111477,16 +111294,11 @@ void QueryProfiler::EndQuery() {
|
|
|
111477
111294
|
WriteToFile(save_location.c_str(), query_info);
|
|
111478
111295
|
}
|
|
111479
111296
|
}
|
|
111480
|
-
|
|
111481
|
-
this->is_explain_analyze = false;
|
|
111482
|
-
this->enabled = stored_enabled;
|
|
111483
|
-
this->automatic_print_format = stored_automatic_print_format;
|
|
111484
|
-
this->save_location = stored_save_location;
|
|
111485
|
-
}
|
|
111297
|
+
this->is_explain_analyze = false;
|
|
111486
111298
|
}
|
|
111487
111299
|
|
|
111488
111300
|
void QueryProfiler::StartPhase(string new_phase) {
|
|
111489
|
-
if (!
|
|
111301
|
+
if (!IsEnabled() || !running) {
|
|
111490
111302
|
return;
|
|
111491
111303
|
}
|
|
111492
111304
|
|
|
@@ -111510,7 +111322,7 @@ void QueryProfiler::StartPhase(string new_phase) {
|
|
|
111510
111322
|
}
|
|
111511
111323
|
|
|
111512
111324
|
void QueryProfiler::EndPhase() {
|
|
111513
|
-
if (!
|
|
111325
|
+
if (!IsEnabled() || !running) {
|
|
111514
111326
|
return;
|
|
111515
111327
|
}
|
|
111516
111328
|
D_ASSERT(phase_stack.size() > 0);
|
|
@@ -111530,7 +111342,7 @@ void QueryProfiler::EndPhase() {
|
|
|
111530
111342
|
}
|
|
111531
111343
|
|
|
111532
111344
|
void QueryProfiler::Initialize(PhysicalOperator *root_op) {
|
|
111533
|
-
if (!
|
|
111345
|
+
if (!IsEnabled() || !running) {
|
|
111534
111346
|
return;
|
|
111535
111347
|
}
|
|
111536
111348
|
this->query_requires_profiling = false;
|
|
@@ -111611,7 +111423,7 @@ void OperatorProfiler::Flush(const PhysicalOperator *phys_op, ExpressionExecutor
|
|
|
111611
111423
|
}
|
|
111612
111424
|
|
|
111613
111425
|
void QueryProfiler::Flush(OperatorProfiler &profiler) {
|
|
111614
|
-
if (!
|
|
111426
|
+
if (!IsEnabled() || !running) {
|
|
111615
111427
|
return;
|
|
111616
111428
|
}
|
|
111617
111429
|
lock_guard<mutex> guard(flush_lock);
|
|
@@ -111621,7 +111433,7 @@ void QueryProfiler::Flush(OperatorProfiler &profiler) {
|
|
|
111621
111433
|
|
|
111622
111434
|
entry->second->info.time += node.second.time;
|
|
111623
111435
|
entry->second->info.elements += node.second.elements;
|
|
111624
|
-
if (!
|
|
111436
|
+
if (!IsDetailedEnabled()) {
|
|
111625
111437
|
continue;
|
|
111626
111438
|
}
|
|
111627
111439
|
for (auto &info : node.second.executors_info) {
|
|
@@ -111682,7 +111494,7 @@ string QueryProfiler::ToString(bool print_optimizer_output) const {
|
|
|
111682
111494
|
}
|
|
111683
111495
|
|
|
111684
111496
|
void QueryProfiler::ToStream(std::ostream &ss, bool print_optimizer_output) const {
|
|
111685
|
-
if (!
|
|
111497
|
+
if (!IsEnabled()) {
|
|
111686
111498
|
ss << "Query profiling is disabled. Call "
|
|
111687
111499
|
"Connection::EnableProfiling() to enable profiling!";
|
|
111688
111500
|
return;
|
|
@@ -111853,7 +111665,7 @@ static void ToJSONRecursive(QueryProfiler::TreeNode &node, std::ostream &ss, int
|
|
|
111853
111665
|
}
|
|
111854
111666
|
|
|
111855
111667
|
string QueryProfiler::ToJSON() const {
|
|
111856
|
-
if (!
|
|
111668
|
+
if (!IsEnabled()) {
|
|
111857
111669
|
return "{ \"result\": \"disabled\" }\n";
|
|
111858
111670
|
}
|
|
111859
111671
|
if (query.empty()) {
|
|
@@ -111968,10 +111780,6 @@ vector<QueryProfiler::PhaseTimingItem> QueryProfiler::GetOrderedPhaseTimings() c
|
|
|
111968
111780
|
return result;
|
|
111969
111781
|
}
|
|
111970
111782
|
void QueryProfiler::Propagate(QueryProfiler &qp) {
|
|
111971
|
-
this->automatic_print_format = qp.automatic_print_format;
|
|
111972
|
-
this->save_location = qp.save_location;
|
|
111973
|
-
this->enabled = qp.enabled;
|
|
111974
|
-
this->detailed_enabled = qp.detailed_enabled;
|
|
111975
111783
|
}
|
|
111976
111784
|
|
|
111977
111785
|
void ExpressionInfo::ExtractExpressionsRecursive(unique_ptr<ExpressionState> &state) {
|
|
@@ -112028,17 +111836,44 @@ ExpressionRootInfo::ExpressionRootInfo(ExpressionExecutorState &state, string na
|
|
|
112028
111836
|
|
|
112029
111837
|
namespace duckdb {
|
|
112030
111838
|
|
|
112031
|
-
|
|
111839
|
+
BaseQueryResult::BaseQueryResult(QueryResultType type, StatementType statement_type)
|
|
112032
111840
|
: type(type), statement_type(statement_type), success(true) {
|
|
112033
111841
|
}
|
|
112034
111842
|
|
|
112035
|
-
|
|
112036
|
-
|
|
111843
|
+
BaseQueryResult::BaseQueryResult(QueryResultType type, StatementType statement_type, vector<LogicalType> types_p,
|
|
111844
|
+
vector<string> names_p)
|
|
112037
111845
|
: type(type), statement_type(statement_type), types(move(types_p)), names(move(names_p)), success(true) {
|
|
112038
111846
|
D_ASSERT(types.size() == names.size());
|
|
112039
111847
|
}
|
|
112040
111848
|
|
|
112041
|
-
|
|
111849
|
+
BaseQueryResult::BaseQueryResult(QueryResultType type, string error) : type(type), success(false), error(move(error)) {
|
|
111850
|
+
}
|
|
111851
|
+
|
|
111852
|
+
BaseQueryResult::~BaseQueryResult() {
|
|
111853
|
+
}
|
|
111854
|
+
|
|
111855
|
+
bool BaseQueryResult::HasError() {
|
|
111856
|
+
return !success;
|
|
111857
|
+
}
|
|
111858
|
+
const string &BaseQueryResult::GetError() {
|
|
111859
|
+
return error;
|
|
111860
|
+
}
|
|
111861
|
+
idx_t BaseQueryResult::ColumnCount() {
|
|
111862
|
+
return types.size();
|
|
111863
|
+
}
|
|
111864
|
+
|
|
111865
|
+
QueryResult::QueryResult(QueryResultType type, StatementType statement_type) : BaseQueryResult(type, statement_type) {
|
|
111866
|
+
}
|
|
111867
|
+
|
|
111868
|
+
QueryResult::QueryResult(QueryResultType type, StatementType statement_type, vector<LogicalType> types_p,
|
|
111869
|
+
vector<string> names_p)
|
|
111870
|
+
: BaseQueryResult(type, statement_type, move(types_p), move(names_p)) {
|
|
111871
|
+
}
|
|
111872
|
+
|
|
111873
|
+
QueryResult::QueryResult(QueryResultType type, string error) : BaseQueryResult(type, move(error)) {
|
|
111874
|
+
}
|
|
111875
|
+
|
|
111876
|
+
QueryResult::~QueryResult() {
|
|
112042
111877
|
}
|
|
112043
111878
|
|
|
112044
111879
|
unique_ptr<DataChunk> QueryResult::Fetch() {
|
|
@@ -115057,24 +114892,27 @@ Value EnableObjectCacheSetting::GetSetting(ClientContext &context) {
|
|
|
115057
114892
|
//===--------------------------------------------------------------------===//
|
|
115058
114893
|
void EnableProfilingSetting::SetLocal(ClientContext &context, const Value &input) {
|
|
115059
114894
|
auto parameter = StringUtil::Lower(input.ToString());
|
|
114895
|
+
|
|
114896
|
+
auto &config = ClientConfig::GetConfig(context);
|
|
115060
114897
|
if (parameter == "json") {
|
|
115061
|
-
|
|
114898
|
+
config.profiler_print_format = ProfilerPrintFormat::JSON;
|
|
115062
114899
|
} else if (parameter == "query_tree") {
|
|
115063
|
-
|
|
114900
|
+
config.profiler_print_format = ProfilerPrintFormat::QUERY_TREE;
|
|
115064
114901
|
} else if (parameter == "query_tree_optimizer") {
|
|
115065
|
-
|
|
114902
|
+
config.profiler_print_format = ProfilerPrintFormat::QUERY_TREE_OPTIMIZER;
|
|
115066
114903
|
} else {
|
|
115067
114904
|
throw ParserException(
|
|
115068
114905
|
"Unrecognized print format %s, supported formats: [json, query_tree, query_tree_optimizer]", parameter);
|
|
115069
114906
|
}
|
|
115070
|
-
|
|
114907
|
+
config.enable_profiler = true;
|
|
115071
114908
|
}
|
|
115072
114909
|
|
|
115073
114910
|
Value EnableProfilingSetting::GetSetting(ClientContext &context) {
|
|
115074
|
-
|
|
114911
|
+
auto &config = ClientConfig::GetConfig(context);
|
|
114912
|
+
if (!config.enable_profiler) {
|
|
115075
114913
|
return Value();
|
|
115076
114914
|
}
|
|
115077
|
-
switch (
|
|
114915
|
+
switch (config.profiler_print_format) {
|
|
115078
114916
|
case ProfilerPrintFormat::NONE:
|
|
115079
114917
|
return Value("none");
|
|
115080
114918
|
case ProfilerPrintFormat::JSON:
|
|
@@ -115218,12 +115056,14 @@ Value ProfilerHistorySize::GetSetting(ClientContext &context) {
|
|
|
115218
115056
|
// Profile Output
|
|
115219
115057
|
//===--------------------------------------------------------------------===//
|
|
115220
115058
|
void ProfileOutputSetting::SetLocal(ClientContext &context, const Value &input) {
|
|
115059
|
+
auto &config = ClientConfig::GetConfig(context);
|
|
115221
115060
|
auto parameter = input.ToString();
|
|
115222
|
-
|
|
115061
|
+
config.profiler_save_location = parameter;
|
|
115223
115062
|
}
|
|
115224
115063
|
|
|
115225
115064
|
Value ProfileOutputSetting::GetSetting(ClientContext &context) {
|
|
115226
|
-
|
|
115065
|
+
auto &config = ClientConfig::GetConfig(context);
|
|
115066
|
+
return Value(config.profiler_save_location);
|
|
115227
115067
|
}
|
|
115228
115068
|
|
|
115229
115069
|
//===--------------------------------------------------------------------===//
|
|
@@ -115231,17 +115071,24 @@ Value ProfileOutputSetting::GetSetting(ClientContext &context) {
|
|
|
115231
115071
|
//===--------------------------------------------------------------------===//
|
|
115232
115072
|
void ProfilingModeSetting::SetLocal(ClientContext &context, const Value &input) {
|
|
115233
115073
|
auto parameter = StringUtil::Lower(input.ToString());
|
|
115074
|
+
auto &config = ClientConfig::GetConfig(context);
|
|
115234
115075
|
if (parameter == "standard") {
|
|
115235
|
-
|
|
115076
|
+
config.enable_profiler = true;
|
|
115077
|
+
config.enable_detailed_profiling = false;
|
|
115236
115078
|
} else if (parameter == "detailed") {
|
|
115237
|
-
|
|
115079
|
+
config.enable_profiler = true;
|
|
115080
|
+
config.enable_detailed_profiling = true;
|
|
115238
115081
|
} else {
|
|
115239
115082
|
throw ParserException("Unrecognized profiling mode \"%s\", supported formats: [standard, detailed]", parameter);
|
|
115240
115083
|
}
|
|
115241
115084
|
}
|
|
115242
115085
|
|
|
115243
115086
|
Value ProfilingModeSetting::GetSetting(ClientContext &context) {
|
|
115244
|
-
|
|
115087
|
+
auto &config = ClientConfig::GetConfig(context);
|
|
115088
|
+
if (!config.enable_profiler) {
|
|
115089
|
+
return Value();
|
|
115090
|
+
}
|
|
115091
|
+
return Value(config.enable_detailed_profiling ? "detailed" : "standard");
|
|
115245
115092
|
}
|
|
115246
115093
|
|
|
115247
115094
|
//===--------------------------------------------------------------------===//
|
|
@@ -115321,14 +115168,11 @@ Value ThreadsSetting::GetSetting(ClientContext &context) {
|
|
|
115321
115168
|
namespace duckdb {
|
|
115322
115169
|
|
|
115323
115170
|
StreamQueryResult::StreamQueryResult(StatementType statement_type, shared_ptr<ClientContext> context,
|
|
115324
|
-
vector<LogicalType> types, vector<string> names
|
|
115325
|
-
|
|
115326
|
-
: QueryResult(QueryResultType::STREAM_RESULT, statement_type, move(types), move(names)), is_open(true),
|
|
115327
|
-
context(move(context)), prepared(move(prepared)) {
|
|
115171
|
+
vector<LogicalType> types, vector<string> names)
|
|
115172
|
+
: QueryResult(QueryResultType::STREAM_RESULT, statement_type, move(types), move(names)), context(move(context)) {
|
|
115328
115173
|
}
|
|
115329
115174
|
|
|
115330
115175
|
StreamQueryResult::~StreamQueryResult() {
|
|
115331
|
-
Close();
|
|
115332
115176
|
}
|
|
115333
115177
|
|
|
115334
115178
|
string StreamQueryResult::ToString() {
|
|
@@ -115342,12 +115186,28 @@ string StreamQueryResult::ToString() {
|
|
|
115342
115186
|
return result;
|
|
115343
115187
|
}
|
|
115344
115188
|
|
|
115189
|
+
unique_ptr<ClientContextLock> StreamQueryResult::LockContext() {
|
|
115190
|
+
if (!context) {
|
|
115191
|
+
throw InvalidInputException("Attempting to execute an unsuccessful or closed pending query result\nError: %s",
|
|
115192
|
+
error);
|
|
115193
|
+
}
|
|
115194
|
+
return context->LockContext();
|
|
115195
|
+
}
|
|
115196
|
+
|
|
115197
|
+
void StreamQueryResult::CheckExecutableInternal(ClientContextLock &lock) {
|
|
115198
|
+
if (!IsOpenInternal(lock)) {
|
|
115199
|
+
throw InvalidInputException("Attempting to execute an unsuccessful or closed pending query result\nError: %s",
|
|
115200
|
+
error);
|
|
115201
|
+
}
|
|
115202
|
+
}
|
|
115203
|
+
|
|
115345
115204
|
unique_ptr<DataChunk> StreamQueryResult::FetchRaw() {
|
|
115346
|
-
|
|
115347
|
-
|
|
115348
|
-
|
|
115205
|
+
unique_ptr<DataChunk> chunk;
|
|
115206
|
+
{
|
|
115207
|
+
auto lock = LockContext();
|
|
115208
|
+
CheckExecutableInternal(*lock);
|
|
115209
|
+
chunk = context->Fetch(*lock, *this);
|
|
115349
115210
|
}
|
|
115350
|
-
auto chunk = context->Fetch();
|
|
115351
115211
|
if (!chunk || chunk->ColumnCount() == 0 || chunk->size() == 0) {
|
|
115352
115212
|
Close();
|
|
115353
115213
|
return nullptr;
|
|
@@ -115373,12 +115233,24 @@ unique_ptr<MaterializedQueryResult> StreamQueryResult::Materialize() {
|
|
|
115373
115233
|
return result;
|
|
115374
115234
|
}
|
|
115375
115235
|
|
|
115376
|
-
|
|
115377
|
-
|
|
115378
|
-
|
|
115236
|
+
bool StreamQueryResult::IsOpenInternal(ClientContextLock &lock) {
|
|
115237
|
+
bool invalidated = !success || !context;
|
|
115238
|
+
if (!invalidated) {
|
|
115239
|
+
invalidated = !context->IsActiveResult(lock, this);
|
|
115240
|
+
}
|
|
115241
|
+
return !invalidated;
|
|
115242
|
+
}
|
|
115243
|
+
|
|
115244
|
+
bool StreamQueryResult::IsOpen() {
|
|
115245
|
+
if (!success || !context) {
|
|
115246
|
+
return false;
|
|
115379
115247
|
}
|
|
115380
|
-
|
|
115381
|
-
|
|
115248
|
+
auto lock = LockContext();
|
|
115249
|
+
return IsOpenInternal(*lock);
|
|
115250
|
+
}
|
|
115251
|
+
|
|
115252
|
+
void StreamQueryResult::Close() {
|
|
115253
|
+
context.reset();
|
|
115382
115254
|
}
|
|
115383
115255
|
|
|
115384
115256
|
} // namespace duckdb
|
|
@@ -120173,9 +120045,10 @@ void Optimizer::RunOptimizer(OptimizerType type, const std::function<void()> &ca
|
|
|
120173
120045
|
// optimizer is marked as disabled: skip
|
|
120174
120046
|
return;
|
|
120175
120047
|
}
|
|
120176
|
-
|
|
120048
|
+
auto &profiler = QueryProfiler::Get(context);
|
|
120049
|
+
profiler.StartPhase(OptimizerTypeToString(type));
|
|
120177
120050
|
callback();
|
|
120178
|
-
|
|
120051
|
+
profiler.EndPhase();
|
|
120179
120052
|
}
|
|
120180
120053
|
|
|
120181
120054
|
unique_ptr<LogicalOperator> Optimizer::Optimize(unique_ptr<LogicalOperator> plan) {
|
|
@@ -124134,6 +124007,10 @@ public:
|
|
|
124134
124007
|
|
|
124135
124008
|
//! Fully execute a pipeline with a source and a sink until the source is completely exhausted
|
|
124136
124009
|
void Execute();
|
|
124010
|
+
//! Execute a pipeline with a source and a sink until finished, or until max_chunks have been processed
|
|
124011
|
+
//! Returns true if execution is finished, false if Execute should be called again
|
|
124012
|
+
bool Execute(idx_t max_chunks);
|
|
124013
|
+
|
|
124137
124014
|
//! Push a single input DataChunk into the pipeline.
|
|
124138
124015
|
//! Returns either OperatorResultType::NEED_MORE_INPUT or OperatorResultType::FINISHED
|
|
124139
124016
|
//! If OperatorResultType::FINISHED is returned, more input will not change the result anymore
|
|
@@ -124302,7 +124179,7 @@ Executor::~Executor() {
|
|
|
124302
124179
|
}
|
|
124303
124180
|
|
|
124304
124181
|
Executor &Executor::Get(ClientContext &context) {
|
|
124305
|
-
return context.
|
|
124182
|
+
return context.GetExecutor();
|
|
124306
124183
|
}
|
|
124307
124184
|
|
|
124308
124185
|
void Executor::AddEvent(shared_ptr<Event> event) {
|
|
@@ -124531,16 +124408,6 @@ void Executor::VerifyPipelines() {
|
|
|
124531
124408
|
#endif
|
|
124532
124409
|
}
|
|
124533
124410
|
|
|
124534
|
-
void Executor::WorkOnTasks() {
|
|
124535
|
-
auto &scheduler = TaskScheduler::GetScheduler(context);
|
|
124536
|
-
|
|
124537
|
-
unique_ptr<Task> task;
|
|
124538
|
-
while (scheduler.GetTaskFromProducer(*producer, task)) {
|
|
124539
|
-
task->Execute();
|
|
124540
|
-
task.reset();
|
|
124541
|
-
}
|
|
124542
|
-
}
|
|
124543
|
-
|
|
124544
124411
|
void Executor::Initialize(PhysicalOperator *plan) {
|
|
124545
124412
|
Reset();
|
|
124546
124413
|
|
|
@@ -124549,7 +124416,8 @@ void Executor::Initialize(PhysicalOperator *plan) {
|
|
|
124549
124416
|
lock_guard<mutex> elock(executor_lock);
|
|
124550
124417
|
physical_plan = plan;
|
|
124551
124418
|
|
|
124552
|
-
|
|
124419
|
+
auto &profiler = QueryProfiler::Get(context);
|
|
124420
|
+
profiler.Initialize(physical_plan);
|
|
124553
124421
|
this->producer = scheduler.CreateProducer();
|
|
124554
124422
|
|
|
124555
124423
|
auto root_pipeline = make_shared<Pipeline>(*this);
|
|
@@ -124565,60 +124433,102 @@ void Executor::Initialize(PhysicalOperator *plan) {
|
|
|
124565
124433
|
|
|
124566
124434
|
ScheduleEvents();
|
|
124567
124435
|
}
|
|
124436
|
+
}
|
|
124568
124437
|
|
|
124569
|
-
|
|
124570
|
-
|
|
124571
|
-
|
|
124572
|
-
|
|
124573
|
-
|
|
124574
|
-
|
|
124438
|
+
void Executor::CancelTasks() {
|
|
124439
|
+
task.reset();
|
|
124440
|
+
// we do this by creating weak pointers to all pipelines
|
|
124441
|
+
// then clearing our references to the pipelines
|
|
124442
|
+
// and waiting until all pipelines have been destroyed
|
|
124443
|
+
vector<weak_ptr<Pipeline>> weak_references;
|
|
124444
|
+
{
|
|
124445
|
+
lock_guard<mutex> elock(executor_lock);
|
|
124446
|
+
if (pipelines.empty()) {
|
|
124447
|
+
return;
|
|
124575
124448
|
}
|
|
124576
|
-
|
|
124577
|
-
|
|
124578
|
-
|
|
124579
|
-
|
|
124580
|
-
|
|
124581
|
-
|
|
124582
|
-
vector<weak_ptr<Pipeline>> weak_references;
|
|
124583
|
-
{
|
|
124584
|
-
lock_guard<mutex> elock(executor_lock);
|
|
124585
|
-
weak_references.reserve(pipelines.size());
|
|
124586
|
-
for (auto &pipeline : pipelines) {
|
|
124449
|
+
weak_references.reserve(pipelines.size());
|
|
124450
|
+
for (auto &pipeline : pipelines) {
|
|
124451
|
+
weak_references.push_back(weak_ptr<Pipeline>(pipeline));
|
|
124452
|
+
}
|
|
124453
|
+
for (auto &kv : union_pipelines) {
|
|
124454
|
+
for (auto &pipeline : kv.second) {
|
|
124587
124455
|
weak_references.push_back(weak_ptr<Pipeline>(pipeline));
|
|
124588
124456
|
}
|
|
124589
|
-
|
|
124590
|
-
|
|
124591
|
-
|
|
124592
|
-
|
|
124457
|
+
}
|
|
124458
|
+
for (auto &kv : child_pipelines) {
|
|
124459
|
+
for (auto &pipeline : kv.second) {
|
|
124460
|
+
weak_references.push_back(weak_ptr<Pipeline>(pipeline));
|
|
124593
124461
|
}
|
|
124594
|
-
|
|
124595
|
-
|
|
124596
|
-
|
|
124597
|
-
|
|
124462
|
+
}
|
|
124463
|
+
pipelines.clear();
|
|
124464
|
+
union_pipelines.clear();
|
|
124465
|
+
child_pipelines.clear();
|
|
124466
|
+
events.clear();
|
|
124467
|
+
}
|
|
124468
|
+
WorkOnTasks();
|
|
124469
|
+
for (auto &weak_ref : weak_references) {
|
|
124470
|
+
while (true) {
|
|
124471
|
+
auto weak = weak_ref.lock();
|
|
124472
|
+
if (!weak) {
|
|
124473
|
+
break;
|
|
124598
124474
|
}
|
|
124599
|
-
pipelines.clear();
|
|
124600
|
-
union_pipelines.clear();
|
|
124601
|
-
child_pipelines.clear();
|
|
124602
|
-
events.clear();
|
|
124603
124475
|
}
|
|
124604
|
-
|
|
124605
|
-
|
|
124606
|
-
|
|
124607
|
-
|
|
124608
|
-
|
|
124609
|
-
|
|
124476
|
+
}
|
|
124477
|
+
}
|
|
124478
|
+
|
|
124479
|
+
void Executor::WorkOnTasks() {
|
|
124480
|
+
auto &scheduler = TaskScheduler::GetScheduler(context);
|
|
124481
|
+
|
|
124482
|
+
unique_ptr<Task> task;
|
|
124483
|
+
while (scheduler.GetTaskFromProducer(*producer, task)) {
|
|
124484
|
+
task->Execute(TaskExecutionMode::PROCESS_ALL);
|
|
124485
|
+
task.reset();
|
|
124486
|
+
}
|
|
124487
|
+
}
|
|
124488
|
+
|
|
124489
|
+
PendingExecutionResult Executor::ExecuteTask() {
|
|
124490
|
+
if (execution_result != PendingExecutionResult::RESULT_NOT_READY) {
|
|
124491
|
+
return execution_result;
|
|
124492
|
+
}
|
|
124493
|
+
// check if there are any incomplete pipelines
|
|
124494
|
+
auto &scheduler = TaskScheduler::GetScheduler(context);
|
|
124495
|
+
while (completed_pipelines < total_pipelines) {
|
|
124496
|
+
// there are! if we don't already have a task, fetch one
|
|
124497
|
+
if (!task) {
|
|
124498
|
+
scheduler.GetTaskFromProducer(*producer, task);
|
|
124499
|
+
}
|
|
124500
|
+
if (task) {
|
|
124501
|
+
// if we have a task, partially process it
|
|
124502
|
+
auto result = task->Execute(TaskExecutionMode::PROCESS_PARTIAL);
|
|
124503
|
+
if (result != TaskExecutionResult::TASK_NOT_FINISHED) {
|
|
124504
|
+
// if the task is finished, clean it up
|
|
124505
|
+
task.reset();
|
|
124610
124506
|
}
|
|
124611
124507
|
}
|
|
124508
|
+
if (!HasError()) {
|
|
124509
|
+
// we (partially) processed a task and no exceptions were thrown
|
|
124510
|
+
// give back control to the caller
|
|
124511
|
+
return PendingExecutionResult::RESULT_NOT_READY;
|
|
124512
|
+
}
|
|
124513
|
+
execution_result = PendingExecutionResult::EXECUTION_ERROR;
|
|
124514
|
+
|
|
124515
|
+
// an exception has occurred executing one of the pipelines
|
|
124516
|
+
// we need to cancel all tasks associated with this executor
|
|
124517
|
+
CancelTasks();
|
|
124612
124518
|
ThrowException();
|
|
124613
124519
|
}
|
|
124520
|
+
D_ASSERT(!task);
|
|
124614
124521
|
|
|
124615
124522
|
lock_guard<mutex> elock(executor_lock);
|
|
124616
124523
|
pipelines.clear();
|
|
124617
124524
|
NextExecutor();
|
|
124618
124525
|
if (!exceptions.empty()) { // LCOV_EXCL_START
|
|
124619
124526
|
// an exception has occurred executing one of the pipelines
|
|
124527
|
+
execution_result = PendingExecutionResult::EXECUTION_ERROR;
|
|
124620
124528
|
ThrowExceptionInternal();
|
|
124621
124529
|
} // LCOV_EXCL_STOP
|
|
124530
|
+
execution_result = PendingExecutionResult::RESULT_READY;
|
|
124531
|
+
return execution_result;
|
|
124622
124532
|
}
|
|
124623
124533
|
|
|
124624
124534
|
void Executor::Reset() {
|
|
@@ -124637,6 +124547,7 @@ void Executor::Reset() {
|
|
|
124637
124547
|
union_pipelines.clear();
|
|
124638
124548
|
child_pipelines.clear();
|
|
124639
124549
|
child_dependencies.clear();
|
|
124550
|
+
execution_result = PendingExecutionResult::RESULT_NOT_READY;
|
|
124640
124551
|
}
|
|
124641
124552
|
|
|
124642
124553
|
void Executor::AddChildPipeline(Pipeline *current) {
|
|
@@ -124918,10 +124829,11 @@ void Executor::ThrowExceptionInternal() { // LCOV_EXCL_START
|
|
|
124918
124829
|
|
|
124919
124830
|
void Executor::Flush(ThreadContext &tcontext) {
|
|
124920
124831
|
lock_guard<mutex> elock(executor_lock);
|
|
124921
|
-
|
|
124832
|
+
auto &profiler = QueryProfiler::Get(context);
|
|
124833
|
+
profiler.Flush(tcontext.profiler);
|
|
124922
124834
|
}
|
|
124923
124835
|
|
|
124924
|
-
bool Executor::GetPipelinesProgress(
|
|
124836
|
+
bool Executor::GetPipelinesProgress(double ¤t_progress) { // LCOV_EXCL_START
|
|
124925
124837
|
lock_guard<mutex> elock(executor_lock);
|
|
124926
124838
|
|
|
124927
124839
|
if (!pipelines.empty()) {
|
|
@@ -124967,9 +124879,9 @@ ExecutorTask::ExecutorTask(ClientContext &context) : ExecutorTask(Executor::Get(
|
|
|
124967
124879
|
ExecutorTask::~ExecutorTask() {
|
|
124968
124880
|
}
|
|
124969
124881
|
|
|
124970
|
-
|
|
124882
|
+
TaskExecutionResult ExecutorTask::Execute(TaskExecutionMode mode) {
|
|
124971
124883
|
try {
|
|
124972
|
-
ExecuteTask();
|
|
124884
|
+
return ExecuteTask(mode);
|
|
124973
124885
|
} catch (Exception &ex) {
|
|
124974
124886
|
executor.PushError(ex.type, ex.what());
|
|
124975
124887
|
} catch (std::exception &ex) {
|
|
@@ -124977,6 +124889,7 @@ void ExecutorTask::Execute() {
|
|
|
124977
124889
|
} catch (...) { // LCOV_EXCL_START
|
|
124978
124890
|
executor.PushError(ExceptionType::UNKNOWN_TYPE, "Unknown exception in Finalize!");
|
|
124979
124891
|
} // LCOV_EXCL_STOP
|
|
124892
|
+
return TaskExecutionResult::TASK_ERROR;
|
|
124980
124893
|
}
|
|
124981
124894
|
|
|
124982
124895
|
} // namespace duckdb
|
|
@@ -125004,6 +124917,8 @@ void ExecutorTask::Execute() {
|
|
|
125004
124917
|
namespace duckdb {
|
|
125005
124918
|
|
|
125006
124919
|
class PipelineTask : public ExecutorTask {
|
|
124920
|
+
static constexpr const idx_t PARTIAL_CHUNK_COUNT = 50;
|
|
124921
|
+
|
|
125007
124922
|
public:
|
|
125008
124923
|
explicit PipelineTask(Pipeline &pipeline_p, shared_ptr<Event> event_p)
|
|
125009
124924
|
: ExecutorTask(pipeline_p.executor), pipeline(pipeline_p), event(move(event_p)) {
|
|
@@ -125011,12 +124926,24 @@ public:
|
|
|
125011
124926
|
|
|
125012
124927
|
Pipeline &pipeline;
|
|
125013
124928
|
shared_ptr<Event> event;
|
|
124929
|
+
unique_ptr<PipelineExecutor> pipeline_executor;
|
|
125014
124930
|
|
|
125015
124931
|
public:
|
|
125016
|
-
|
|
125017
|
-
|
|
125018
|
-
|
|
124932
|
+
TaskExecutionResult ExecuteTask(TaskExecutionMode mode) override {
|
|
124933
|
+
if (!pipeline_executor) {
|
|
124934
|
+
pipeline_executor = make_unique<PipelineExecutor>(pipeline.GetClientContext(), pipeline);
|
|
124935
|
+
}
|
|
124936
|
+
if (mode == TaskExecutionMode::PROCESS_PARTIAL) {
|
|
124937
|
+
bool finished = pipeline_executor->Execute(PARTIAL_CHUNK_COUNT);
|
|
124938
|
+
if (!finished) {
|
|
124939
|
+
return TaskExecutionResult::TASK_NOT_FINISHED;
|
|
124940
|
+
}
|
|
124941
|
+
} else {
|
|
124942
|
+
pipeline_executor->Execute();
|
|
124943
|
+
}
|
|
125019
124944
|
event->FinishTask();
|
|
124945
|
+
pipeline_executor.reset();
|
|
124946
|
+
return TaskExecutionResult::TASK_FINISHED;
|
|
125020
124947
|
}
|
|
125021
124948
|
};
|
|
125022
124949
|
|
|
@@ -125028,7 +124955,7 @@ ClientContext &Pipeline::GetClientContext() {
|
|
|
125028
124955
|
}
|
|
125029
124956
|
|
|
125030
124957
|
// LCOV_EXCL_START
|
|
125031
|
-
bool Pipeline::GetProgressInternal(ClientContext &context, PhysicalOperator *op,
|
|
124958
|
+
bool Pipeline::GetProgressInternal(ClientContext &context, PhysicalOperator *op, double ¤t_percentage) {
|
|
125032
124959
|
current_percentage = -1;
|
|
125033
124960
|
switch (op->type) {
|
|
125034
124961
|
case PhysicalOperatorType::TABLE_SCAN: {
|
|
@@ -125047,7 +124974,7 @@ bool Pipeline::GetProgressInternal(ClientContext &context, PhysicalOperator *op,
|
|
|
125047
124974
|
}
|
|
125048
124975
|
// LCOV_EXCL_STOP
|
|
125049
124976
|
|
|
125050
|
-
bool Pipeline::GetProgress(
|
|
124977
|
+
bool Pipeline::GetProgress(double ¤t_percentage) {
|
|
125051
124978
|
auto &client = executor.context;
|
|
125052
124979
|
return GetProgressInternal(client, source, current_percentage);
|
|
125053
124980
|
}
|
|
@@ -125248,16 +125175,18 @@ PipelineExecutor::PipelineExecutor(ClientContext &context_p, Pipeline &pipeline_
|
|
|
125248
125175
|
InitializeChunk(final_chunk);
|
|
125249
125176
|
}
|
|
125250
125177
|
|
|
125251
|
-
|
|
125178
|
+
bool PipelineExecutor::Execute(idx_t max_chunks) {
|
|
125252
125179
|
D_ASSERT(pipeline.sink);
|
|
125180
|
+
bool exhausted_source = false;
|
|
125253
125181
|
auto &source_chunk = pipeline.operators.empty() ? final_chunk : *intermediate_chunks[0];
|
|
125254
|
-
|
|
125182
|
+
for (idx_t i = 0; i < max_chunks; i++) {
|
|
125255
125183
|
if (finished_processing) {
|
|
125256
125184
|
break;
|
|
125257
125185
|
}
|
|
125258
125186
|
source_chunk.Reset();
|
|
125259
125187
|
FetchFromSource(source_chunk);
|
|
125260
125188
|
if (source_chunk.size() == 0) {
|
|
125189
|
+
exhausted_source = true;
|
|
125261
125190
|
break;
|
|
125262
125191
|
}
|
|
125263
125192
|
auto result = ExecutePushInternal(source_chunk);
|
|
@@ -125266,7 +125195,15 @@ void PipelineExecutor::Execute() {
|
|
|
125266
125195
|
break;
|
|
125267
125196
|
}
|
|
125268
125197
|
}
|
|
125198
|
+
if (!exhausted_source && !finished_processing) {
|
|
125199
|
+
return false;
|
|
125200
|
+
}
|
|
125269
125201
|
PushFinalize();
|
|
125202
|
+
return true;
|
|
125203
|
+
}
|
|
125204
|
+
|
|
125205
|
+
void PipelineExecutor::Execute() {
|
|
125206
|
+
Execute(NumericLimits<idx_t>::Maximum());
|
|
125270
125207
|
}
|
|
125271
125208
|
|
|
125272
125209
|
OperatorResultType PipelineExecutor::ExecutePush(DataChunk &input) { // LCOV_EXCL_START
|
|
@@ -129797,7 +129734,7 @@ void TaskScheduler::ExecuteForever(atomic<bool> *marker) {
|
|
|
129797
129734
|
// wait for a signal with a timeout; the timeout allows us to periodically check
|
|
129798
129735
|
queue->semaphore.wait(TASK_TIMEOUT_USECS);
|
|
129799
129736
|
if (queue->q.try_dequeue(task)) {
|
|
129800
|
-
task->Execute();
|
|
129737
|
+
task->Execute(TaskExecutionMode::PROCESS_ALL);
|
|
129801
129738
|
task.reset();
|
|
129802
129739
|
}
|
|
129803
129740
|
}
|
|
@@ -129870,7 +129807,7 @@ void TaskScheduler::SetThreadsInternal(int32_t n) {
|
|
|
129870
129807
|
|
|
129871
129808
|
namespace duckdb {
|
|
129872
129809
|
|
|
129873
|
-
ThreadContext::ThreadContext(ClientContext &context) : profiler(context.
|
|
129810
|
+
ThreadContext::ThreadContext(ClientContext &context) : profiler(QueryProfiler::Get(context).IsEnabled()) {
|
|
129874
129811
|
}
|
|
129875
129812
|
|
|
129876
129813
|
} // namespace duckdb
|
|
@@ -149039,8 +148976,8 @@ BoundStatement Binder::Bind(DeleteStatement &stmt) {
|
|
|
149039
148976
|
del->AddChild(move(root));
|
|
149040
148977
|
|
|
149041
148978
|
// set up the delete expression
|
|
149042
|
-
del->expressions.push_back(
|
|
149043
|
-
|
|
148979
|
+
del->expressions.push_back(make_unique<BoundColumnRefExpression>(
|
|
148980
|
+
LogicalType::ROW_TYPE, ColumnBinding(get.table_index, get.column_ids.size())));
|
|
149044
148981
|
get.column_ids.push_back(COLUMN_IDENTIFIER_ROW_ID);
|
|
149045
148982
|
|
|
149046
148983
|
result.plan = move(del);
|
|
@@ -149980,7 +149917,7 @@ BoundStatement Binder::Bind(UpdateStatement &stmt) {
|
|
|
149980
149917
|
|
|
149981
149918
|
// finally add the row id column to the projection list
|
|
149982
149919
|
proj->expressions.push_back(make_unique<BoundColumnRefExpression>(
|
|
149983
|
-
|
|
149920
|
+
LogicalType::ROW_TYPE, ColumnBinding(get->table_index, get->column_ids.size())));
|
|
149984
149921
|
get->column_ids.push_back(COLUMN_IDENTIFIER_ROW_ID);
|
|
149985
149922
|
|
|
149986
149923
|
// set the projection as child of the update node and finalize the result
|
|
@@ -154713,7 +154650,7 @@ void LogicalGet::ResolveTypes() {
|
|
|
154713
154650
|
}
|
|
154714
154651
|
for (auto &index : column_ids) {
|
|
154715
154652
|
if (index == COLUMN_IDENTIFIER_ROW_ID) {
|
|
154716
|
-
types.
|
|
154653
|
+
types.emplace_back(LogicalType::ROW_TYPE);
|
|
154717
154654
|
} else {
|
|
154718
154655
|
types.push_back(returned_types[index]);
|
|
154719
154656
|
}
|
|
@@ -154874,13 +154811,15 @@ Planner::Planner(ClientContext &context) : binder(Binder::CreateBinder(context))
|
|
|
154874
154811
|
}
|
|
154875
154812
|
|
|
154876
154813
|
void Planner::CreatePlan(SQLStatement &statement) {
|
|
154814
|
+
auto &profiler = QueryProfiler::Get(context);
|
|
154815
|
+
|
|
154877
154816
|
vector<BoundParameterExpression *> bound_parameters;
|
|
154878
154817
|
|
|
154879
154818
|
// first bind the tables and columns to the catalog
|
|
154880
|
-
|
|
154819
|
+
profiler.StartPhase("binder");
|
|
154881
154820
|
binder->parameters = &bound_parameters;
|
|
154882
154821
|
auto bound_statement = binder->Bind(statement);
|
|
154883
|
-
|
|
154822
|
+
profiler.EndPhase();
|
|
154884
154823
|
|
|
154885
154824
|
this->read_only = binder->read_only;
|
|
154886
154825
|
this->requires_valid_transaction = binder->requires_valid_transaction;
|
|
@@ -161586,7 +161525,7 @@ DataTable::DataTable(ClientContext &context, DataTable &parent, idx_t changed_id
|
|
|
161586
161525
|
vector<LogicalType> scan_types;
|
|
161587
161526
|
for (idx_t i = 0; i < bound_columns.size(); i++) {
|
|
161588
161527
|
if (bound_columns[i] == COLUMN_IDENTIFIER_ROW_ID) {
|
|
161589
|
-
scan_types.
|
|
161528
|
+
scan_types.emplace_back(LogicalType::ROW_TYPE);
|
|
161590
161529
|
} else {
|
|
161591
161530
|
scan_types.push_back(parent.column_definitions[bound_columns[i]].type);
|
|
161592
161531
|
}
|
|
@@ -162053,7 +161992,7 @@ void DataTable::RevertAppend(idx_t start_row, idx_t count) {
|
|
|
162053
161992
|
if (!info->indexes.Empty()) {
|
|
162054
161993
|
idx_t current_row_base = start_row;
|
|
162055
161994
|
row_t row_data[STANDARD_VECTOR_SIZE];
|
|
162056
|
-
Vector row_identifiers(
|
|
161995
|
+
Vector row_identifiers(LogicalType::ROW_TYPE, (data_ptr_t)row_data);
|
|
162057
161996
|
ScanTableSegment(start_row, count, [&](DataChunk &chunk) {
|
|
162058
161997
|
for (idx_t i = 0; i < chunk.size(); i++) {
|
|
162059
161998
|
row_data[i] = current_row_base + i;
|
|
@@ -162077,7 +162016,7 @@ bool DataTable::AppendToIndexes(TableAppendState &state, DataChunk &chunk, row_t
|
|
|
162077
162016
|
return true;
|
|
162078
162017
|
}
|
|
162079
162018
|
// first generate the vector of row identifiers
|
|
162080
|
-
Vector row_identifiers(
|
|
162019
|
+
Vector row_identifiers(LogicalType::ROW_TYPE);
|
|
162081
162020
|
VectorOperations::GenerateSequence(row_identifiers, chunk.size(), row_start, 1);
|
|
162082
162021
|
|
|
162083
162022
|
vector<Index *> already_appended;
|
|
@@ -162111,7 +162050,7 @@ void DataTable::RemoveFromIndexes(TableAppendState &state, DataChunk &chunk, row
|
|
|
162111
162050
|
return;
|
|
162112
162051
|
}
|
|
162113
162052
|
// first generate the vector of row identifiers
|
|
162114
|
-
Vector row_identifiers(
|
|
162053
|
+
Vector row_identifiers(LogicalType::ROW_TYPE);
|
|
162115
162054
|
VectorOperations::GenerateSequence(row_identifiers, chunk.size(), row_start, 1);
|
|
162116
162055
|
|
|
162117
162056
|
// now remove the entries from the indices
|
|
@@ -162422,7 +162361,7 @@ void DataTable::AddIndex(unique_ptr<Index> index, const vector<unique_ptr<Expres
|
|
|
162422
162361
|
for (auto &id : index->column_ids) {
|
|
162423
162362
|
intermediate_types.push_back(column_definitions[id].type);
|
|
162424
162363
|
}
|
|
162425
|
-
intermediate_types.
|
|
162364
|
+
intermediate_types.emplace_back(LogicalType::ROW_TYPE);
|
|
162426
162365
|
intermediate.Initialize(intermediate_types);
|
|
162427
162366
|
|
|
162428
162367
|
// initialize an index scan
|
|
@@ -162736,7 +162675,7 @@ void LocalStorage::Scan(LocalScanState &state, const vector<column_t> &column_id
|
|
|
162736
162675
|
if (count != chunk_count) {
|
|
162737
162676
|
sel.Initialize(valid_sel);
|
|
162738
162677
|
} else {
|
|
162739
|
-
sel.Initialize(
|
|
162678
|
+
sel.Initialize(nullptr);
|
|
162740
162679
|
}
|
|
162741
162680
|
// now scan the vectors of the chunk
|
|
162742
162681
|
for (idx_t i = 0; i < column_ids.size(); i++) {
|
|
@@ -162788,7 +162727,7 @@ void LocalStorage::Append(DataTable *table, DataChunk &chunk) {
|
|
|
162788
162727
|
idx_t base_id = MAX_ROW_ID + storage->collection.Count();
|
|
162789
162728
|
|
|
162790
162729
|
// first generate the vector of row identifiers
|
|
162791
|
-
Vector row_ids(
|
|
162730
|
+
Vector row_ids(LogicalType::ROW_TYPE);
|
|
162792
162731
|
VectorOperations::GenerateSequence(row_ids, chunk.size(), base_id, 1);
|
|
162793
162732
|
|
|
162794
162733
|
// now append the entries to the indices
|
|
@@ -162907,7 +162846,7 @@ static void TemplatedUpdateLoop(Vector &data_vector, Vector &update_vector, Vect
|
|
|
162907
162846
|
|
|
162908
162847
|
static void UpdateChunk(Vector &data, Vector &updates, Vector &row_ids, idx_t count, idx_t base_index) {
|
|
162909
162848
|
D_ASSERT(data.GetType() == updates.GetType());
|
|
162910
|
-
D_ASSERT(row_ids.GetType() ==
|
|
162849
|
+
D_ASSERT(row_ids.GetType() == LogicalType::ROW_TYPE);
|
|
162911
162850
|
|
|
162912
162851
|
switch (data.GetType().InternalType()) {
|
|
162913
162852
|
case PhysicalType::INT8:
|
|
@@ -163830,7 +163769,9 @@ void BaseStatistics::Verify(Vector &vector, const SelectionVector &sel, idx_t co
|
|
|
163830
163769
|
}
|
|
163831
163770
|
|
|
163832
163771
|
void BaseStatistics::Verify(Vector &vector, idx_t count) {
|
|
163833
|
-
|
|
163772
|
+
SelectionVector owned_sel;
|
|
163773
|
+
auto sel = FlatVector::IncrementalSelectionVector(count, owned_sel);
|
|
163774
|
+
Verify(vector, *sel, count);
|
|
163834
163775
|
}
|
|
163835
163776
|
|
|
163836
163777
|
} // namespace duckdb
|
|
@@ -166869,7 +166810,7 @@ void ListColumnData::Append(BaseStatistics &stats_p, ColumnAppendState &state, V
|
|
|
166869
166810
|
|
|
166870
166811
|
VectorData vdata;
|
|
166871
166812
|
vdata.validity = list_validity;
|
|
166872
|
-
vdata.sel =
|
|
166813
|
+
vdata.sel = FlatVector::IncrementalSelectionVector(count, vdata.owned_sel);
|
|
166873
166814
|
vdata.data = (data_ptr_t)append_offsets.get();
|
|
166874
166815
|
|
|
166875
166816
|
// append the list offsets
|
|
@@ -167381,7 +167322,7 @@ void RowGroup::TemplatedScan(Transaction *transaction, RowGroupScanState &state,
|
|
|
167381
167322
|
if (count != max_count) {
|
|
167382
167323
|
sel.Initialize(valid_sel);
|
|
167383
167324
|
} else {
|
|
167384
|
-
sel.Initialize(
|
|
167325
|
+
sel.Initialize(nullptr);
|
|
167385
167326
|
}
|
|
167386
167327
|
//! first, we scan the columns with filters, fetch their data and generate a selection vector.
|
|
167387
167328
|
//! get runtime statistics
|
|
@@ -169426,7 +169367,7 @@ idx_t UpdateValidityStatistics(UpdateSegment *segment, SegmentStatistics &stats,
|
|
|
169426
169367
|
}
|
|
169427
169368
|
}
|
|
169428
169369
|
}
|
|
169429
|
-
sel.Initialize(
|
|
169370
|
+
sel.Initialize(nullptr);
|
|
169430
169371
|
return count;
|
|
169431
169372
|
}
|
|
169432
169373
|
|
|
@@ -169440,7 +169381,7 @@ idx_t TemplatedUpdateNumericStatistics(UpdateSegment *segment, SegmentStatistics
|
|
|
169440
169381
|
for (idx_t i = 0; i < count; i++) {
|
|
169441
169382
|
NumericStatistics::Update<T>(stats, update_data[i]);
|
|
169442
169383
|
}
|
|
169443
|
-
sel.Initialize(
|
|
169384
|
+
sel.Initialize(nullptr);
|
|
169444
169385
|
return count;
|
|
169445
169386
|
} else {
|
|
169446
169387
|
idx_t not_null_count = 0;
|
|
@@ -169466,7 +169407,7 @@ idx_t UpdateStringStatistics(UpdateSegment *segment, SegmentStatistics &stats, V
|
|
|
169466
169407
|
update_data[i] = segment->GetStringHeap().AddString(update_data[i]);
|
|
169467
169408
|
}
|
|
169468
169409
|
}
|
|
169469
|
-
sel.Initialize(
|
|
169410
|
+
sel.Initialize(nullptr);
|
|
169470
169411
|
return count;
|
|
169471
169412
|
} else {
|
|
169472
169413
|
idx_t not_null_count = 0;
|
|
@@ -170186,9 +170127,9 @@ void ReplayState::ReplayDelete() {
|
|
|
170186
170127
|
throw InternalException("Corrupt WAL: delete without table");
|
|
170187
170128
|
}
|
|
170188
170129
|
|
|
170189
|
-
D_ASSERT(chunk.ColumnCount() == 1 && chunk.data[0].GetType() ==
|
|
170130
|
+
D_ASSERT(chunk.ColumnCount() == 1 && chunk.data[0].GetType() == LogicalType::ROW_TYPE);
|
|
170190
170131
|
row_t row_ids[1];
|
|
170191
|
-
Vector row_identifiers(
|
|
170132
|
+
Vector row_identifiers(LogicalType::ROW_TYPE, (data_ptr_t)row_ids);
|
|
170192
170133
|
|
|
170193
170134
|
auto source_ids = FlatVector::GetData<row_t>(chunk.data[0]);
|
|
170194
170135
|
// delete the tuples from the current table
|
|
@@ -170453,7 +170394,7 @@ void WriteAheadLog::WriteDelete(DataChunk &chunk) {
|
|
|
170453
170394
|
return;
|
|
170454
170395
|
}
|
|
170455
170396
|
D_ASSERT(chunk.size() > 0);
|
|
170456
|
-
D_ASSERT(chunk.ColumnCount() == 1 && chunk.data[0].GetType() ==
|
|
170397
|
+
D_ASSERT(chunk.ColumnCount() == 1 && chunk.data[0].GetType() == LogicalType::ROW_TYPE);
|
|
170457
170398
|
chunk.Verify();
|
|
170458
170399
|
|
|
170459
170400
|
writer->Write<WALType>(WALType::DELETE_TUPLE);
|
|
@@ -170466,7 +170407,7 @@ void WriteAheadLog::WriteUpdate(DataChunk &chunk, const vector<column_t> &column
|
|
|
170466
170407
|
}
|
|
170467
170408
|
D_ASSERT(chunk.size() > 0);
|
|
170468
170409
|
D_ASSERT(chunk.ColumnCount() == 2);
|
|
170469
|
-
D_ASSERT(chunk.data[1].GetType().id() ==
|
|
170410
|
+
D_ASSERT(chunk.data[1].GetType().id() == LogicalType::ROW_TYPE);
|
|
170470
170411
|
chunk.Verify();
|
|
170471
170412
|
|
|
170472
170413
|
writer->Write<WALType>(WALType::UPDATE_TUPLE);
|
|
@@ -170644,7 +170585,7 @@ void CleanupState::Flush() {
|
|
|
170644
170585
|
}
|
|
170645
170586
|
|
|
170646
170587
|
// set up the row identifiers vector
|
|
170647
|
-
Vector row_identifiers(
|
|
170588
|
+
Vector row_identifiers(LogicalType::ROW_TYPE, (data_ptr_t)row_numbers);
|
|
170648
170589
|
|
|
170649
170590
|
// delete the tuples from all the indexes
|
|
170650
170591
|
current_table->RemoveFromIndexes(row_identifiers, count);
|
|
@@ -170866,7 +170807,7 @@ void CommitState::WriteDelete(DeleteInfo *info) {
|
|
|
170866
170807
|
|
|
170867
170808
|
if (!delete_chunk) {
|
|
170868
170809
|
delete_chunk = make_unique<DataChunk>();
|
|
170869
|
-
vector<LogicalType> delete_types = {
|
|
170810
|
+
vector<LogicalType> delete_types = {LogicalType::ROW_TYPE};
|
|
170870
170811
|
delete_chunk->Initialize(delete_types);
|
|
170871
170812
|
}
|
|
170872
170813
|
auto rows = FlatVector::GetData<row_t>(delete_chunk->data[0]);
|
|
@@ -170892,7 +170833,7 @@ void CommitState::WriteUpdate(UpdateInfo *info) {
|
|
|
170892
170833
|
} else {
|
|
170893
170834
|
update_types.push_back(column_data.type);
|
|
170894
170835
|
}
|
|
170895
|
-
update_types.
|
|
170836
|
+
update_types.emplace_back(LogicalType::ROW_TYPE);
|
|
170896
170837
|
|
|
170897
170838
|
update_chunk = make_unique<DataChunk>();
|
|
170898
170839
|
update_chunk->Initialize(update_types);
|