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::HashAggregateDistinctFinalizeEvent Class Reference
Inheritance diagram for duckdb::HashAggregateDistinctFinalizeEvent:
Collaboration diagram for duckdb::HashAggregateDistinctFinalizeEvent:

Public Member Functions

 HashAggregateDistinctFinalizeEvent (ClientContext &context, Pipeline &pipeline_p, const PhysicalHashAggregate &op_p, HashAggregateGlobalSinkState &gstate_p)
 Distinct Finalize Event that is scheduled if we have distinct aggregates.
void Schedule () override
void FinishEvent () override
 Called right after the event is finished.
Public Member Functions inherited from duckdb::BasePipelineEvent
 BasePipelineEvent (shared_ptr< Pipeline > pipeline)
 BasePipelineEvent (Pipeline &pipeline)
void PrintPipeline () override
Public Member Functions inherited from duckdb::Event
 Event (Executor &executor)
virtual void FinalizeFinish ()
 Called after the event is entirely finished.
void FinishTask ()
void Finish ()
void AddDependency (Event &event)
bool HasDependencies () const
const vector< reference< Event > > & GetParentsVerification () const
void CompleteDependency ()
void SetTasks (vector< shared_ptr< Task > > tasks)
void InsertEvent (shared_ptr< Event > replacement_event)
bool IsFinished () const
ClientContext & GetClientContext ()
template<class TARGET>
TARGET & Cast ()
template<class TARGET>
const TARGET & Cast () const
Public Member Functions inherited from duckdb::enable_shared_from_this< Event >
shared_ptr< Event > shared_from_this ()

Public Attributes

vector< vector< unique_ptr< GlobalSourceState > > > global_source_states
 The GlobalSourceStates for all the radix tables of the distinct aggregates.
Public Attributes inherited from duckdb::BasePipelineEvent
shared_ptr< Pipeline > pipeline
 The pipeline that this event belongs to.

Private Member Functions

idx_t CreateGlobalSources ()

Private Attributes

ClientContext & context
const PhysicalHashAggregate & op
HashAggregateGlobalSinkState & gstate

Additional Inherited Members

Protected Member Functions inherited from duckdb::enable_shared_from_this< Event >
enable_shared_from_this & operator= (enable_shared_from_this const &) noexcept
Protected Attributes inherited from duckdb::Event
Executor & executor
atomic< idx_t > finished_tasks
 The current threads working on the event.
atomic< idx_t > total_tasks
 The maximum amount of threads that can work on the event.
atomic< idx_t > finished_dependencies
idx_t total_dependencies
 The total amount of dependencies.
vector< weak_ptr< Event > > parents
 The events that depend on this event to run.
vector< reference< Event > > parents_raw
 Raw pointers to the parents (used for verification only).
atomic< bool > finished
 Whether or not the event is finished executing.

Constructor & Destructor Documentation

◆ HashAggregateDistinctFinalizeEvent()

duckdb::HashAggregateDistinctFinalizeEvent::HashAggregateDistinctFinalizeEvent ( ClientContext & context,
Pipeline & pipeline_p,
const PhysicalHashAggregate & op_p,
HashAggregateGlobalSinkState & gstate_p )
inline

Distinct Finalize Event that is scheduled if we have distinct aggregates.

160480 : BasePipelineEvent(pipeline_p), context(context), op(op_p), gstate(gstate_p) {
160481 }

Member Function Documentation

◆ Schedule()

void duckdb::HashAggregateDistinctFinalizeEvent::Schedule ( )
overridevirtual

Implements duckdb::Event.

160533 {
160534 auto n_tasks = CreateGlobalSources();
160535 n_tasks = MinValue<idx_t>(n_tasks, NumericCast<idx_t>(TaskScheduler::GetScheduler(context).NumberOfThreads()));
160536 vector<shared_ptr<Task>> tasks;
160537 for (idx_t i = 0; i < n_tasks; i++) {
160538 tasks.push_back(make_uniq<HashAggregateDistinctFinalizeTask>(*pipeline, shared_from_this(), op, gstate));
160539 }
160540 SetTasks(std::move(tasks));
160541}
shared_ptr< Pipeline > pipeline
The pipeline that this event belongs to.
Definition duckdb.cpp:35137
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237

◆ FinishEvent()

void duckdb::HashAggregateDistinctFinalizeEvent::FinishEvent ( )
overridevirtual

Called right after the event is finished.

Reimplemented from duckdb::Event.

160576 {
160577 // Now that everything is added to the main ht, we can actually finalize
160578 auto new_event = make_shared_ptr<HashAggregateFinalizeEvent>(context, pipeline.get(), op, gstate);
160579 this->InsertEvent(std::move(new_event));
160580}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CreateGlobalSources()

idx_t duckdb::HashAggregateDistinctFinalizeEvent::CreateGlobalSources ( )
private
160543 {
160544 auto &aggregates = op.grouped_aggregate_data.aggregates;
160545 global_source_states.reserve(op.groupings.size());
160546
160547 idx_t n_tasks = 0;
160548 for (idx_t grouping_idx = 0; grouping_idx < op.groupings.size(); grouping_idx++) {
160549 auto &grouping = op.groupings[grouping_idx];
160550 auto &distinct_state = *gstate.grouping_states[grouping_idx].distinct_state;
160551 auto &distinct_data = *grouping.distinct_data;
160552
160553 vector<unique_ptr<GlobalSourceState>> aggregate_sources;
160554 aggregate_sources.reserve(aggregates.size());
160555 for (idx_t agg_idx = 0; agg_idx < aggregates.size(); agg_idx++) {
160556 auto &aggregate = aggregates[agg_idx];
160557 auto &aggr = aggregate->Cast<BoundAggregateExpression>();
160558
160559 if (!aggr.IsDistinct()) {
160560 aggregate_sources.push_back(nullptr);
160561 continue;
160562 }
160563 D_ASSERT(distinct_data.info.table_map.count(agg_idx));
160564
160565 auto table_idx = distinct_data.info.table_map.at(agg_idx);
160566 auto &radix_table_p = distinct_data.radix_tables[table_idx];
160567 n_tasks += radix_table_p->MaxThreads(*distinct_state.radix_states[table_idx]);
160568 aggregate_sources.push_back(radix_table_p->GetGlobalSourceState(context));
160569 }
160570 global_source_states.push_back(std::move(aggregate_sources));
160571 }
160572
160573 return MaxValue<idx_t>(n_tasks, 1);
160574}
vector< vector< unique_ptr< GlobalSourceState > > > global_source_states
The GlobalSourceStates for all the radix tables of the distinct aggregates.
Definition duckdb.cpp:160498

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