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

Public Member Functions

 DistinctAggregateCollectionInfo (const vector< unique_ptr< Expression > > &aggregates, vector< idx_t > indices)
 Shared information about a collection of distinct aggregates.
const unsafe_vector< idx_t > & Indices () const
bool AnyDistinct () const

Static Public Member Functions

static unique_ptr< DistinctAggregateCollectionInfo > Create (vector< unique_ptr< Expression > > &aggregates)

Public Attributes

unsafe_vector< idx_t > indices
idx_t table_count
vector< idx_t > table_indices
 Occupied tables, not equal to indices if aggregates share input data.
unordered_map< idx_t, idx_t > table_map
 This indirection is used to allow two aggregates to share the same input data.
const vector< unique_ptr< Expression > > & aggregates
idx_t total_child_count

Private Member Functions

idx_t CreateTableIndexMap ()
 Returns the amount of tables that are occupied.

Constructor & Destructor Documentation

◆ DistinctAggregateCollectionInfo()

duckdb::DistinctAggregateCollectionInfo::DistinctAggregateCollectionInfo ( const vector< unique_ptr< Expression > > & aggregates,
vector< idx_t > indices )

Shared information about a collection of distinct aggregates.

159649 : indices(std::move(indices)), aggregates(aggregates) {
159650 table_count = CreateTableIndexMap();
159651
159652 const idx_t aggregate_count = aggregates.size();
159653
159654 total_child_count = 0;
159655 for (idx_t i = 0; i < aggregate_count; i++) {
159656 auto &aggregate = aggregates[i]->Cast<BoundAggregateExpression>();
159657
159658 if (!aggregate.IsDistinct()) {
159659 continue;
159660 }
159661 total_child_count += aggregate.children.size();
159662 }
159663}
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237
idx_t CreateTableIndexMap()
Returns the amount of tables that are occupied.
Definition duckdb.cpp:159780
Here is the call graph for this function:

Member Function Documentation

◆ Create()

unique_ptr< DistinctAggregateCollectionInfo > duckdb::DistinctAggregateCollectionInfo::Create ( vector< unique_ptr< Expression > > & aggregates)
static
159829 {
159830 vector<idx_t> indices = GetDistinctIndices(aggregates);
159831 if (indices.empty()) {
159832 return nullptr;
159833 }
159834 return make_uniq<DistinctAggregateCollectionInfo>(aggregates, std::move(indices));
159835}

◆ Indices()

const unsafe_vector< idx_t > & duckdb::DistinctAggregateCollectionInfo::Indices ( ) const
159812 {
159813 return this->indices;
159814}

◆ AnyDistinct()

bool duckdb::DistinctAggregateCollectionInfo::AnyDistinct ( ) const
159808 {
159809 return !indices.empty();
159810}

◆ CreateTableIndexMap()

idx_t duckdb::DistinctAggregateCollectionInfo::CreateTableIndexMap ( )
private

Returns the amount of tables that are occupied.

Assign the existing table to the aggregate

Create a new table and assign its index to the aggregate

Every distinct aggregate needs to be assigned an index

There can not be more tables than there are distinct aggregates

159780 {
159781 vector<aggr_ref_t> table_inputs;
159782
159783 D_ASSERT(table_map.empty());
159784 for (auto &agg_idx : indices) {
159785 D_ASSERT(agg_idx < aggregates.size());
159786 auto &aggregate = aggregates[agg_idx]->Cast<BoundAggregateExpression>();
159787
159788 auto matching_inputs =
159789 std::find_if(table_inputs.begin(), table_inputs.end(), FindMatchingAggregate(std::ref(aggregate)));
159790 if (matching_inputs != table_inputs.end()) {
159792 auto found_idx = NumericCast<idx_t>(std::distance(table_inputs.begin(), matching_inputs));
159793 table_map[agg_idx] = found_idx;
159794 continue;
159795 }
159797 table_map[agg_idx] = table_inputs.size();
159798 table_inputs.push_back(std::ref(aggregate));
159799 }
159801 D_ASSERT(table_map.size() == indices.size());
159803 D_ASSERT(table_inputs.size() <= indices.size());
159804
159805 return table_inputs.size();
159806}
unordered_map< idx_t, idx_t > table_map
This indirection is used to allow two aggregates to share the same input data.
Definition duckdb.cpp:99183
Here is the call graph for this function:
Here is the caller graph for this function:

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