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

Public Member Functions

 WindowAggregateStates (ClientContext &client, const AggregateObject &aggr)
idx_t GetCount () const
 The number of states.
data_ptr_t * GetData ()
data_ptr_t GetStatePtr (idx_t idx)
const_data_ptr_t GetStatePtr (idx_t idx) const
void Initialize (idx_t count)
 Initialise all the states.
void Combine (WindowAggregateStates &target)
 Combine the states into the target.
void Finalize (Vector &result)
 Finalize the states into an output vector.
void Destroy ()
 Destroy the states.

Public Attributes

ClientContext & client
 The context to use for memory etc.
const AggregateObject aggr
 A description of the aggregator.
const idx_t state_size
 The size of each state.
ArenaAllocator allocator
 The allocator to use.
vector< data_t > states
 Data pointer that contains the state data.
unique_ptr< Vector > statef
 Reused result state container for the window functions.

Constructor & Destructor Documentation

◆ WindowAggregateStates()

duckdb::WindowAggregateStates::WindowAggregateStates ( ClientContext & client,
const AggregateObject & aggr )
253510 : client(client), aggr(aggr), state_size(aggr.function.GetStateSizeCallback()(aggr.function)),
253511 allocator(Allocator::Get(client)) {
253512}
const AggregateObject aggr
A description of the aggregator.
Definition duckdb.cpp:253493
const idx_t state_size
The size of each state.
Definition duckdb.cpp:253495
ArenaAllocator allocator
The allocator to use.
Definition duckdb.cpp:253497
ClientContext & client
The context to use for memory etc.
Definition duckdb.cpp:253491

◆ ~WindowAggregateStates()

duckdb::WindowAggregateStates::~WindowAggregateStates ( )
inline
253464 {
253465 Destroy();
253466 }
void Destroy()
Destroy the states.
Definition duckdb.cpp:253543

Member Function Documentation

◆ GetCount()

idx_t duckdb::WindowAggregateStates::GetCount ( ) const
inline

The number of states.

253469 {
253470 return states.size() / state_size;
253471 }
vector< data_t > states
Data pointer that contains the state data.
Definition duckdb.cpp:253499
Here is the caller graph for this function:

◆ GetData()

data_ptr_t * duckdb::WindowAggregateStates::GetData ( )
inline
253472 {
253473 return FlatVector::GetData<data_ptr_t>(*statef);
253474 }
unique_ptr< Vector > statef
Reused result state container for the window functions.
Definition duckdb.cpp:253501

◆ GetStatePtr() [1/2]

data_ptr_t duckdb::WindowAggregateStates::GetStatePtr ( idx_t idx)
inline
253475 {
253476 return states.data() + idx * state_size;
253477 }

◆ GetStatePtr() [2/2]

const_data_ptr_t duckdb::WindowAggregateStates::GetStatePtr ( idx_t idx) const
inline
253478 {
253479 return states.data() + idx * state_size;
253480 }

◆ Initialize()

void duckdb::WindowAggregateStates::Initialize ( idx_t count)

Initialise all the states.

253514 {
253515 // Don't leak - every Initialize must be matched with a Destroy
253516 D_ASSERT(states.empty());
253517
253518 states.resize(count * state_size);
253519 auto state_ptr = states.data();
253520
253521 statef = make_uniq<Vector>(LogicalType::POINTER, count);
253522 auto state_f_data = FlatVector::GetData<data_ptr_t>(*statef);
253523
253524 for (idx_t i = 0; i < count; ++i, state_ptr += state_size) {
253525 state_f_data[i] = state_ptr;
253526 aggr.function.GetStateInitCallback()(aggr.function, state_ptr);
253527 }
253528
253529 // Prevent conversion of results to constants
253530 statef->SetVectorType(VectorType::FLAT_VECTOR);
253531}
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237

◆ Combine()

void duckdb::WindowAggregateStates::Combine ( WindowAggregateStates & target)

Combine the states into the target.

253533 {
253534 AggregateInputData aggr_input_data(aggr.GetFunctionData(), allocator, AggregateCombineType::ALLOW_DESTRUCTIVE);
253535 aggr.function.GetStateCombineCallback()(*statef, *target.statef, aggr_input_data, GetCount());
253536}
idx_t GetCount() const
The number of states.
Definition duckdb.cpp:253469
Here is the call graph for this function:

◆ Finalize()

void duckdb::WindowAggregateStates::Finalize ( Vector & result)

Finalize the states into an output vector.

253538 {
253539 AggregateInputData aggr_input_data(aggr.GetFunctionData(), allocator);
253540 aggr.function.GetStateFinalizeCallback()(*statef, aggr_input_data, result, GetCount(), 0);
253541}
Here is the call graph for this function:

◆ Destroy()

void duckdb::WindowAggregateStates::Destroy ( )

Destroy the states.

253543 {
253544 if (states.empty()) {
253545 return;
253546 }
253547
253548 AggregateInputData aggr_input_data(aggr.GetFunctionData(), allocator);
253549 if (aggr.function.HasStateDestructorCallback()) {
253550 aggr.function.GetStateDestructorCallback()(*statef, aggr_input_data, GetCount());
253551 }
253552
253553 states.clear();
253554}
Here is the call graph for this function:

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