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

Public Types

using ColumnDataCollectionPtr = unique_ptr<ColumnDataCollection>
using ColumnDataCollectionSpec = pair<idx_t, optional_ptr<ColumnDataCollection>>
using ColumnSet = unordered_set<column_t>
using Range = pair<idx_t, idx_t>
 The (sorted) collection ranges.

Public Member Functions

 WindowCollection (BufferManager &buffer_manager, idx_t count, const vector< LogicalType > &types)
idx_t ColumnCount () const
idx_t size () const
const vector< LogicalType > & GetTypes () const
void GetCollection (idx_t row_idx, ColumnDataCollectionSpec &spec)
 Update a thread-local collection for appending data to a given row.
void Combine (const ColumnSet &build_validity)
 Single-threaded, idempotent ordered combining of all the appended data.

Public Attributes

ColumnDataCollectionPtr inputs
 The collection data. May be null if the column count is 0.
vector< atomic< bool > > all_valids
 Global validity mask.
vector< ValidityMask > validities
 Optional validity mask for the entire collection.
const vector< LogicalType > types
 The collection columns.
const idx_t count
 The collection rows.
mutex lock
 Guard for range updates.
BufferManager & buffer_manager
 The paging buffer manager to use.
vector< ColumnDataCollectionPtr > collections
 The component column data collections.
vector< Range > ranges

Constructor & Destructor Documentation

◆ WindowCollection()

duckdb::WindowCollection::WindowCollection ( BufferManager & buffer_manager,
idx_t count,
const vector< LogicalType > & types )
254724 if (!types.empty()) {
254725 inputs = make_uniq<ColumnDataCollection>(buffer_manager, types);
254726 }
254727
254728 validities.resize(types.size());
254729
254730 // Atomic vectors can't be constructed with a given value
254731 for (auto &all_valid : all_valids) {
254732 all_valid = true;
254733 }
254734}
const idx_t count
The collection rows.
Definition duckdb.cpp:163446
ColumnDataCollectionPtr inputs
The collection data. May be null if the column count is 0.
Definition duckdb.cpp:163437
const vector< LogicalType > types
The collection columns.
Definition duckdb.cpp:163444
BufferManager & buffer_manager
The paging buffer manager to use.
Definition duckdb.cpp:163451
vector< atomic< bool > > all_valids
Global validity mask.
Definition duckdb.cpp:163439
vector< ValidityMask > validities
Optional validity mask for the entire collection.
Definition duckdb.cpp:163441

Member Function Documentation

◆ ColumnCount()

idx_t duckdb::WindowCollection::ColumnCount ( ) const
inline
163419 {
163420 return types.size();
163421 }

◆ size()

idx_t duckdb::WindowCollection::size ( ) const
inline
163423 { // NOLINT
163424 return count;
163425 }

◆ GetTypes()

const vector< LogicalType > & duckdb::WindowCollection::GetTypes ( ) const
inline
163427 {
163428 return types;
163429 }

◆ GetCollection()

void duckdb::WindowCollection::GetCollection ( idx_t row_idx,
ColumnDataCollectionSpec & spec )

Update a thread-local collection for appending data to a given row.

254736 {
254737 if (spec.second && row_idx == spec.first + spec.second->Count()) {
254738 return;
254739 }
254740
254741 lock_guard<mutex> collection_guard(lock);
254742
254743 auto collection = make_uniq<ColumnDataCollection>(buffer_manager, types);
254744 spec = {row_idx, collection.get()};
254745 Range probe {row_idx, collections.size()};
254746 auto i = std::upper_bound(ranges.begin(), ranges.end(), probe);
254747 ranges.insert(i, probe);
254748 collections.emplace_back(std::move(collection));
254749}
vector< ColumnDataCollectionPtr > collections
The component column data collections.
Definition duckdb.cpp:163453
pair< idx_t, idx_t > Range
The (sorted) collection ranges.
Definition duckdb.cpp:163455
mutex lock
Guard for range updates.
Definition duckdb.cpp:163449

◆ Combine()

void duckdb::WindowCollection::Combine ( const ColumnSet & build_validity)

Single-threaded, idempotent ordered combining of all the appended data.

254751 {
254752 lock_guard<mutex> collection_guard(lock);
254753
254754 // If there are no columns (COUNT(*)) then this is a NOP
254755 if (types.empty()) {
254756 return;
254757 }
254758
254759 // Have we already combined?
254760 if (inputs->Count()) {
254761 D_ASSERT(collections.empty());
254762 D_ASSERT(ranges.empty());
254763 return;
254764 }
254765
254766 // If there are columns, we should have data
254767 D_ASSERT(!collections.empty());
254768 D_ASSERT(!ranges.empty());
254769
254770 for (auto &range : ranges) {
254771 inputs->Combine(*collections[range.second]);
254772 }
254773 collections.clear();
254774 ranges.clear();
254775
254776 if (validity_cols.empty()) {
254777 return;
254778 }
254779
254780 D_ASSERT(inputs.get());
254781
254782 // Find all columns with NULLs
254783 vector<column_t> invalid_cols;
254784 for (auto &col_idx : validity_cols) {
254785 if (!all_valids[col_idx]) {
254786 invalid_cols.emplace_back(col_idx);
254787 validities[col_idx].Initialize(inputs->Count());
254788 }
254789 }
254790
254791 if (invalid_cols.empty()) {
254792 return;
254793 }
254794
254795 WindowCursor cursor(*this, invalid_cols);
254796 idx_t target_offset = 0;
254797 while (cursor.Scan()) {
254798 const auto count = cursor.chunk.size();
254799 for (idx_t i = 0; i < invalid_cols.size(); ++i) {
254800 auto &other = FlatVector::Validity(cursor.chunk.data[i]);
254801 const auto col_idx = invalid_cols[i];
254802 validities[col_idx].SliceInPlace(other, target_offset, 0, count);
254803 }
254804 target_offset += count;
254805 }
254806}
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237
Here is the call graph for this function:

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