Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
Loading...
Searching...
No Matches
duckdb::JoinHashTable::ProbeSpill Struct Reference
Collaboration diagram for duckdb::JoinHashTable::ProbeSpill:

Public Member Functions

 ProbeSpill (JoinHashTable &ht, ClientContext &context, const vector< LogicalType > &probe_types)
ProbeSpillLocalAppendState RegisterThread ()
 Create a state for a new thread.
void Append (DataChunk &chunk, ProbeSpillLocalAppendState &local_state)
 Append a chunk to this ProbeSpill.
void Finalize ()
 Finalize by merging the thread-local accumulated data.
void PrepareNextProbe ()
 Prepare the next probe round.

Public Attributes

unique_ptr< ColumnDataConsumer > consumer
 Scans and consumes the ColumnDataCollection.

Private Attributes

JoinHashTable & ht
mutex lock
ClientContext & context
const vector< LogicalType > & probe_types
 The types of the probe DataChunks.
vector< column_t > column_ids
 The column ids.
unique_ptr< PartitionedColumnData > global_partitions
 The partitioned probe data and append states.
vector< unique_ptr< PartitionedColumnData > > local_partitions
vector< unique_ptr< PartitionedColumnDataAppendState > > local_partition_append_states
unique_ptr< ColumnDataCollection > global_spill_collection
 The active probe data.

Detailed Description

ProbeSpill represents materialized probe-side data that could not be probed during PhysicalHashJoin::Execute because the HashTable did not fit in memory. The ProbeSpill is not partitioned if the remaining data can be dealt with in just 1 more round of probing, otherwise it is radix partitioned in the same way as the HashTable

Constructor & Destructor Documentation

◆ ProbeSpill()

duckdb::ProbeSpill::ProbeSpill ( JoinHashTable & ht,
ClientContext & context,
const vector< LogicalType > & probe_types )
159095 : ht(ht), context(context), probe_types(probe_types) {
159097 make_uniq<RadixPartitionedColumnData>(context, probe_types, ht.radix_bits, probe_types.size() - 1);
159098 column_ids.reserve(probe_types.size());
159099 for (column_t column_id = 0; column_id < probe_types.size(); column_id++) {
159100 column_ids.emplace_back(column_id);
159101 }
159102}
idx_t column_t
Type used for column identifiers.
Definition duckdb.hpp:259
vector< column_t > column_ids
The column ids.
Definition duckdb.cpp:157297
const vector< LogicalType > & probe_types
The types of the probe DataChunks.
Definition duckdb.cpp:157295
unique_ptr< PartitionedColumnData > global_partitions
The partitioned probe data and append states.
Definition duckdb.cpp:157300

Member Function Documentation

◆ RegisterThread()

ProbeSpillLocalState duckdb::ProbeSpill::RegisterThread ( )

Create a state for a new thread.

159104 {
159105 ProbeSpillLocalAppendState result;
159106 lock_guard<mutex> guard(lock);
159107 local_partitions.emplace_back(global_partitions->CreateShared());
159108 local_partition_append_states.emplace_back(make_uniq<PartitionedColumnDataAppendState>());
159109 local_partitions.back()->InitializeAppendState(*local_partition_append_states.back());
159110
159111 result.local_partition = local_partitions.back().get();
159112 result.local_partition_append_state = local_partition_append_states.back().get();
159113 return result;
159114}

◆ Append()

void duckdb::ProbeSpill::Append ( DataChunk & chunk,
ProbeSpillLocalAppendState & local_state )

Append a chunk to this ProbeSpill.

159116 {
159117 local_state.local_partition->Append(*local_state.local_partition_append_state, chunk);
159118}
Here is the caller graph for this function:

◆ Finalize()

void duckdb::ProbeSpill::Finalize ( )

Finalize by merging the thread-local accumulated data.

159120 {
159121 D_ASSERT(local_partitions.size() == local_partition_append_states.size());
159122 for (idx_t i = 0; i < local_partition_append_states.size(); i++) {
159123 local_partitions[i]->FlushAppendState(*local_partition_append_states[i]);
159124 }
159125 for (auto &local_partition : local_partitions) {
159126 global_partitions->Combine(*local_partition);
159127 }
159128 local_partitions.clear();
159129 local_partition_append_states.clear();
159130}
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237

◆ PrepareNextProbe()

void duckdb::ProbeSpill::PrepareNextProbe ( )

Prepare the next probe round.

159132 {
159133 global_spill_collection.reset();
159134 auto &partitions = global_partitions->GetPartitions();
159135 if (partitions.empty() || ht.current_partitions.CheckAllInvalid(partitions.size())) {
159136 // Can't probe, just make an empty one
159138 make_uniq<ColumnDataCollection>(BufferManager::GetBufferManager(context), probe_types);
159139 } else {
159140 // Move current partitions to the global spill collection
159141 for (idx_t partition_idx = 0; partition_idx < partitions.size(); partition_idx++) {
159142 if (!ht.current_partitions.RowIsValidUnsafe(partition_idx)) {
159143 continue;
159144 }
159145 auto &partition = partitions[partition_idx];
159147 global_spill_collection = std::move(partition);
159148 } else if (partition->Count() != 0) {
159149 global_spill_collection->Combine(*partition);
159150 }
159151 partition.reset();
159152 }
159153 }
159154 consumer = make_uniq<ColumnDataConsumer>(*global_spill_collection, column_ids);
159155 consumer->InitializeScan();
159156}
int partition(const std::vector< _Tp > &_vec, std::vector< int > &labels, _EqPredicate predicate=_EqPredicate())
unique_ptr< ColumnDataConsumer > consumer
Scans and consumes the ColumnDataCollection.
Definition duckdb.cpp:157287
unique_ptr< ColumnDataCollection > global_spill_collection
The active probe data.
Definition duckdb.cpp:157305

The documentation for this struct was generated from the following file: