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::UngroupedAggregateExecuteState Struct Reference
Collaboration diagram for duckdb::UngroupedAggregateExecuteState:

Public Member Functions

 UngroupedAggregateExecuteState (ClientContext &context, const vector< unique_ptr< Expression > > &aggregates, const vector< LogicalType > &child_types)
void Sink (LocalUngroupedAggregateState &state, DataChunk &input)
void Reset ()

Public Attributes

const vector< unique_ptr< Expression > > & aggregates
 The set of aggregates.
ExpressionExecutor child_executor
 The executor.
DataChunk aggregate_input_chunk
 The payload chunk, containing all the Vectors for the aggregates.
AggregateFilterDataSet filter_set
 Aggregate filter data set.

Constructor & Destructor Documentation

◆ UngroupedAggregateExecuteState()

duckdb::UngroupedAggregateExecuteState::UngroupedAggregateExecuteState ( ClientContext & context,
const vector< unique_ptr< Expression > > & aggregates,
const vector< LogicalType > & child_types )
162739 vector<LogicalType> payload_types;
162740 vector<AggregateObject> aggregate_objects;
162741 auto &allocator = BufferAllocator::Get(context);
162742 for (auto &aggregate : aggregates) {
162743 D_ASSERT(aggregate->GetExpressionClass() == ExpressionClass::BOUND_AGGREGATE);
162744 auto &aggr = aggregate->Cast<BoundAggregateExpression>();
162745 // initialize the payload chunk
162746 for (auto &child : aggr.children) {
162747 payload_types.push_back(child->return_type);
162748 child_executor.AddExpression(*child);
162749 }
162750 aggregate_objects.emplace_back(&aggr);
162751 }
162752 if (!payload_types.empty()) { // for select count(*) from t; there is no payload at all
162753 aggregate_input_chunk.Initialize(allocator, payload_types);
162754 }
162755 filter_set.Initialize(context, aggregate_objects, child_types);
162756}
const vector< unique_ptr< Expression > > & aggregates
The set of aggregates.
Definition duckdb.cpp:161047
AggregateFilterDataSet filter_set
Aggregate filter data set.
Definition duckdb.cpp:161053
ExpressionExecutor child_executor
The executor.
Definition duckdb.cpp:161049
DataChunk aggregate_input_chunk
The payload chunk, containing all the Vectors for the aggregates.
Definition duckdb.cpp:161051

Member Function Documentation

◆ Sink()

void duckdb::UngroupedAggregateExecuteState::Sink ( LocalUngroupedAggregateState & state,
DataChunk & input )
162762 {
162763 DataChunk &payload_chunk = aggregate_input_chunk;
162764
162765 idx_t payload_idx = 0;
162766 idx_t next_payload_idx = 0;
162767
162768 for (idx_t aggr_idx = 0; aggr_idx < aggregates.size(); aggr_idx++) {
162769 auto &aggregate = aggregates[aggr_idx]->Cast<BoundAggregateExpression>();
162770
162771 payload_idx = next_payload_idx;
162772 next_payload_idx = payload_idx + aggregate.children.size();
162773
162774 if (aggregate.IsDistinct()) {
162775 continue;
162776 }
162777
162778 idx_t payload_cnt = 0;
162779 // resolve the filter (if any)
162780 if (aggregate.filter) {
162781 auto &filtered_data = filter_set.GetFilterData(aggr_idx);
162782 auto count = filtered_data.ApplyFilter(input);
162783
162784 child_executor.SetChunk(filtered_data.filtered_payload);
162785 payload_chunk.SetCardinality(count);
162786 } else {
162787 child_executor.SetChunk(input);
162788 payload_chunk.SetCardinality(input);
162789 }
162790
162791 // resolve the child expressions of the aggregate (if any)
162792 for (idx_t i = 0; i < aggregate.children.size(); ++i) {
162793 child_executor.ExecuteExpression(payload_idx + payload_cnt, payload_chunk.data[payload_idx + payload_cnt]);
162794 payload_cnt++;
162795 }
162796
162797 state.Sink(payload_chunk, payload_idx, aggr_idx);
162798 }
162799}
vector< Vector > data
The vectors owned by the DataChunk.
Definition duckdb.hpp:11445
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237

◆ Reset()

void duckdb::UngroupedAggregateExecuteState::Reset ( )
162758 {
162759 aggregate_input_chunk.Reset();
162760}

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