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

Public Types

using AtomicCounters = vector<std::atomic<idx_t>>

Public Member Functions

 WindowSegmentTreeGlobalState (ClientContext &context, const WindowSegmentTree &aggregator, idx_t group_count)
Public Member Functions inherited from duckdb::WindowAggregatorGlobalState
 WindowAggregatorGlobalState (ClientContext &client, const WindowAggregator &aggregator_p, idx_t group_count)
Public Member Functions inherited from duckdb::GlobalSinkState
template<class TARGET>
TARGET & Cast ()
template<class TARGET>
const TARGET & Cast () const
virtual idx_t MaxThreads (idx_t source_max_threads)
Public Member Functions inherited from duckdb::StateWithBlockableTasks
unique_lock< mutex > Lock ()
void PreventBlocking (const unique_lock< mutex > &guard)
bool BlockTask (const unique_lock< mutex > &guard, const InterruptState &interrupt_state)
 Add a task to 'blocked_tasks' before returning SourceResultType::BLOCKED (must hold the lock).
bool CanBlock (const unique_lock< mutex > &guard) const
bool UnblockTasks (const unique_lock< mutex > &guard)
 Unblock all tasks (must hold the lock).
SinkResultType BlockSink (const unique_lock< mutex > &guard, const InterruptState &interrupt_state)
SourceResultType BlockSource (const unique_lock< mutex > &guard, const InterruptState &interrupt_state)
void VerifyLock (const unique_lock< mutex > &guard) const

Public Attributes

const WindowSegmentTree & tree
 The owning aggregator.
WindowAggregateStates levels_flat_native
 The actual window segment tree: an array of aggregate states that represent all the intermediate nodes.
vector< idx_t > levels_flat_start
 For each level, the starting location in the levels_flat_native array.
std::atomic< idx_t > build_level
 The level being built (read).
unique_ptr< AtomicCounters > build_started
 The number of entries started so far at each level.
unique_ptr< AtomicCounters > build_completed
 The number of entries completed so far at each level.
vector< unique_ptr< ArenaAllocator > > tree_allocators
Public Attributes inherited from duckdb::WindowAggregatorGlobalState
ClientContext & client
 The client we are in.
ArenaAllocator allocator
 Global allocator.
const WindowAggregator & aggregator
 The aggregator data.
const AggregateObject aggr
 The aggregate function.
ValidityArray filter_mask
 The filtered rows in inputs.
mutex lock
 Lock for single threading.
std::atomic< idx_t > locals
 Count of local tasks.
std::atomic< idx_t > finalized
 Number of finalised states.
Public Attributes inherited from duckdb::GlobalSinkState
SinkFinalizeType state

Static Public Attributes

static constexpr idx_t TREE_FANOUT = 16

Constructor & Destructor Documentation

◆ WindowSegmentTreeGlobalState()

duckdb::WindowSegmentTreeGlobalState::WindowSegmentTreeGlobalState ( ClientContext & context,
const WindowSegmentTree & aggregator,
idx_t group_count )
257843 : WindowAggregatorGlobalState(client, aggregator, group_count), tree(aggregator), levels_flat_native(client, aggr) {
257844 D_ASSERT(!aggregator.wexpr.children.empty());
257845
257846 // compute space required to store internal nodes of segment tree
257847 levels_flat_start.push_back(0);
257848
257849 idx_t levels_flat_offset = 0;
257850 idx_t level_current = 0;
257851 // level 0 is data itself
257852 idx_t level_size;
257853 // iterate over the levels of the segment tree
257854 while ((level_size =
257855 (level_current == 0 ? group_count : levels_flat_offset - levels_flat_start[level_current - 1])) > 1) {
257856 for (idx_t pos = 0; pos < level_size; pos += TREE_FANOUT) {
257857 levels_flat_offset++;
257858 }
257859
257860 levels_flat_start.push_back(levels_flat_offset);
257861 level_current++;
257862 }
257863
257864 // Corner case: single element in the window
257865 if (levels_flat_offset == 0) {
257866 ++levels_flat_offset;
257867 }
257868
257869 levels_flat_native.Initialize(levels_flat_offset);
257870
257871 // Start by building from the bottom level
257872 build_level = 0;
257873
257874 build_started = make_uniq<AtomicCounters>(levels_flat_start.size());
257875 for (auto &counter : *build_started) {
257876 counter = 0;
257877 }
257878
257879 build_completed = make_uniq<AtomicCounters>(levels_flat_start.size());
257880 for (auto &counter : *build_completed) {
257881 counter = 0;
257882 }
257883}
ClientContext & client
The client we are in.
Definition duckdb.cpp:164054
const WindowAggregator & aggregator
The aggregator data.
Definition duckdb.cpp:164060
const AggregateObject aggr
The aggregate function.
Definition duckdb.cpp:164063
unique_ptr< AtomicCounters > build_started
The number of entries started so far at each level.
Definition duckdb.cpp:257593
vector< idx_t > levels_flat_start
For each level, the starting location in the levels_flat_native array.
Definition duckdb.cpp:257589
const WindowSegmentTree & tree
The owning aggregator.
Definition duckdb.cpp:257585
unique_ptr< AtomicCounters > build_completed
The number of entries completed so far at each level.
Definition duckdb.cpp:257595
std::atomic< idx_t > build_level
The level being built (read).
Definition duckdb.cpp:257591
WindowAggregateStates levels_flat_native
The actual window segment tree: an array of aggregate states that represent all the intermediate node...
Definition duckdb.cpp:257587
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237

Member Data Documentation

◆ tree_allocators

vector<unique_ptr<ArenaAllocator> > duckdb::WindowSegmentTreeGlobalState::tree_allocators

The tree allocators. We need to hold onto them for the tree lifetime, not the lifetime of the local state that constructed part of the tree


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