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

Public Member Functions

 UngroupedDistinctAggregateFinalizeEvent (ClientContext &context, const PhysicalUngroupedAggregate &op_p, UngroupedAggregateGlobalSinkState &gstate_p, Pipeline &pipeline_p)
void Schedule () override
void FinalizeTask ()
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 FinishEvent ()
 Called right after the event is finished.
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< unique_ptr< GlobalSourceState > > global_source_states
Public Attributes inherited from duckdb::BasePipelineEvent
shared_ptr< Pipeline > pipeline
 The pipeline that this event belongs to.

Private Attributes

ClientContext & context
const PhysicalUngroupedAggregate & op
UngroupedAggregateGlobalSinkState & gstate
mutex lock
idx_t tasks_scheduled
idx_t tasks_done

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

◆ UngroupedDistinctAggregateFinalizeEvent()

duckdb::UngroupedDistinctAggregateFinalizeEvent::UngroupedDistinctAggregateFinalizeEvent ( ClientContext & context,
const PhysicalUngroupedAggregate & op_p,
UngroupedAggregateGlobalSinkState & gstate_p,
Pipeline & pipeline_p )
inline
162995 : BasePipelineEvent(pipeline_p), context(context), op(op_p), gstate(gstate_p), tasks_scheduled(0),
162996 tasks_done(0) {
162997 }

Member Function Documentation

◆ Schedule()

void duckdb::UngroupedDistinctAggregateFinalizeEvent::Schedule ( )
overridevirtual

Implements duckdb::Event.

163052 {
163053 D_ASSERT(gstate.distinct_state);
163054 auto &aggregates = op.aggregates;
163055 auto &distinct_data = *op.distinct_data;
163056
163057 idx_t n_tasks = 0;
163058 idx_t payload_idx = 0;
163059 idx_t next_payload_idx = 0;
163060 for (idx_t agg_idx = 0; agg_idx < aggregates.size(); agg_idx++) {
163061 auto &aggregate = aggregates[agg_idx]->Cast<BoundAggregateExpression>();
163062
163063 // Forward the payload idx
163064 payload_idx = next_payload_idx;
163065 next_payload_idx = payload_idx + aggregate.children.size();
163066
163067 // If aggregate is not distinct, skip it
163068 if (!distinct_data.IsDistinct(agg_idx)) {
163069 global_source_states.push_back(nullptr);
163070 continue;
163071 }
163072 D_ASSERT(distinct_data.info.table_map.count(agg_idx));
163073
163074 // Create global state for scanning
163075 auto table_idx = distinct_data.info.table_map.at(agg_idx);
163076 auto &radix_table_p = *distinct_data.radix_tables[table_idx];
163077 n_tasks += radix_table_p.MaxThreads(*gstate.distinct_state->radix_states[table_idx]);
163078 global_source_states.push_back(radix_table_p.GetGlobalSourceState(context));
163079 }
163080 n_tasks = MaxValue<idx_t>(n_tasks, 1);
163081 n_tasks = MinValue<idx_t>(n_tasks, NumericCast<idx_t>(TaskScheduler::GetScheduler(context).NumberOfThreads()));
163082
163083 vector<shared_ptr<Task>> tasks;
163084 for (idx_t i = 0; i < n_tasks; i++) {
163085 tasks.push_back(
163086 make_uniq<UngroupedDistinctAggregateFinalizeTask>(pipeline->executor, shared_from_this(), op, gstate));
163087 tasks_scheduled++;
163088 }
163089 SetTasks(std::move(tasks));
163090}
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

◆ FinalizeTask()

void duckdb::UngroupedDistinctAggregateFinalizeEvent::FinalizeTask ( )
inline
163001 {
163002 lock_guard<mutex> finalize(lock);
163003 D_ASSERT(!gstate.finished);
163004 D_ASSERT(tasks_done < tasks_scheduled);
163005 if (++tasks_done == tasks_scheduled) {
163006 gstate.finished = true;
163007 }
163008 }

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