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

Public Member Functions

 WindowDistinctAggregator (const BoundWindowExpression &wexpr, WindowSharedExpressions &shared, ClientContext &client)
unique_ptr< GlobalSinkState > GetGlobalState (ClientContext &client, idx_t group_count, const ValidityMask &partition_mask) const override
void Sink (ExecutionContext &context, DataChunk &sink_chunk, DataChunk &coll_chunk, idx_t input_idx, optional_ptr< SelectionVector > filter_sel, idx_t filtered, OperatorSinkInput &sink) override
void Finalize (ExecutionContext &context, CollectionPtr collection, const FrameStats &stats, OperatorSinkInput &sink) override
unique_ptr< LocalSinkState > GetLocalState (ExecutionContext &context, const GlobalSinkState &gstate) const override
void Evaluate (ExecutionContext &context, const DataChunk &bounds, Vector &result, idx_t count, idx_t row_idx, OperatorSinkInput &sink) const override
Public Member Functions inherited from duckdb::WindowAggregator
 WindowAggregator (const BoundWindowExpression &wexpr)
 WindowAggregator (const BoundWindowExpression &wexpr, WindowSharedExpressions &shared)

Static Public Member Functions

static bool CanAggregate (const BoundWindowExpression &wexpr)
Static Public Member Functions inherited from duckdb::WindowAggregator
template<typename OP>
static void EvaluateSubFrames (const DataChunk &bounds, const WindowExcludeMode exclude_mode, idx_t count, idx_t row_idx, SubFrames &frames, OP operation)

Public Attributes

ClientContext & context
 Context for sorting.
Public Attributes inherited from duckdb::WindowAggregator
const BoundWindowExpression & wexpr
 The window function.
const AggregateObject aggr
 A description of the aggregator.
vector< LogicalType > arg_types
 The argument types for the function.
const LogicalType result_type
 The result type of the window function.
const idx_t state_size
 The size of a single aggregate state.
const WindowExcludeMode exclude_mode
 The window exclusion clause.
vector< column_t > child_idx
 Partition collection column indicies.

Additional Inherited Members

Public Types inherited from duckdb::WindowAggregator
using CollectionPtr = optional_ptr<WindowCollection>

Constructor & Destructor Documentation

◆ WindowDistinctAggregator()

duckdb::WindowDistinctAggregator::WindowDistinctAggregator ( const BoundWindowExpression & wexpr,
WindowSharedExpressions & shared,
ClientContext & client )
255452 : WindowAggregator(wexpr, shared), context(context) {
255453}
const BoundWindowExpression & wexpr
The window function.
Definition duckdb.cpp:164034
ClientContext & context
Context for sorting.
Definition duckdb.cpp:253121

Member Function Documentation

◆ CanAggregate()

bool duckdb::WindowDistinctAggregator::CanAggregate ( const BoundWindowExpression & wexpr)
static
255438 {
255439 if (!wexpr.aggregate) {
255440 return false;
255441 }
255442
255443 if (!wexpr.aggregate->CanAggregate()) {
255444 return false;
255445 }
255446
255447 return wexpr.distinct && wexpr.exclude_clause == WindowExcludeMode::NO_OTHER && wexpr.arg_orders.empty();
255448}

◆ GetGlobalState()

unique_ptr< GlobalSinkState > duckdb::WindowDistinctAggregator::GetGlobalState ( ClientContext & client,
idx_t group_count,
const ValidityMask & partition_mask ) const
overridevirtual

Reimplemented from duckdb::WindowAggregator.

255659 {
255660 return make_uniq<WindowDistinctAggregatorGlobalState>(context, *this, group_count);
255661}

◆ Sink()

void duckdb::WindowDistinctAggregator::Sink ( ExecutionContext & context,
DataChunk & sink_chunk,
DataChunk & coll_chunk,
idx_t input_idx,
optional_ptr< SelectionVector > filter_sel,
idx_t filtered,
OperatorSinkInput & sink )
overridevirtual

Reimplemented from duckdb::WindowAggregator.

255665 {
255666 WindowAggregator::Sink(context, sink_chunk, coll_chunk, input_idx, filter_sel, filtered, sink);
255667
255668 auto &ldstate = sink.local_state.Cast<WindowDistinctAggregatorLocalState>();
255669 ldstate.Sink(context, sink_chunk, coll_chunk, input_idx, filter_sel, filtered, sink.interrupt_state);
255670}

◆ Finalize()

void duckdb::WindowDistinctAggregator::Finalize ( ExecutionContext & context,
CollectionPtr collection,
const FrameStats & stats,
OperatorSinkInput & sink )
overridevirtual

Reimplemented from duckdb::WindowAggregator.

255805 {
255806 auto &gdsink = sink.global_state.Cast<WindowDistinctAggregatorGlobalState>();
255807 auto &ldstate = sink.local_state.Cast<WindowDistinctAggregatorLocalState>();
255808 ldstate.Finalize(context, gdsink, collection);
255809
255810 // Sort, merge and build the tree in parallel
255811 while (gdsink.stage.load() != WindowDistinctSortStage::FINISHED) {
255812 if (gdsink.TryPrepareNextStage(ldstate)) {
255813 ldstate.ExecuteTask(context, gdsink);
255814 } else {
255815 std::this_thread::yield();
255816 }
255817 }
255818
255819 // These are a parallel implementations,
255820 // so every thread can call them.
255821 gdsink.zipped_tree.Build();
255822 gdsink.merge_sort_tree.Build(ldstate);
255823
255824 ++gdsink.finalized;
255825}

◆ GetLocalState()

unique_ptr< LocalSinkState > duckdb::WindowDistinctAggregator::GetLocalState ( ExecutionContext & context,
const GlobalSinkState & gstate ) const
overridevirtual

Implements duckdb::WindowAggregator.

256112 {
256113 auto &gdstate = gstate.Cast<const WindowDistinctAggregatorGlobalState>();
256114 return make_uniq<WindowDistinctAggregatorLocalState>(context, gdstate);
256115}

◆ Evaluate()

void duckdb::WindowDistinctAggregator::Evaluate ( ExecutionContext & context,
const DataChunk & bounds,
Vector & result,
idx_t count,
idx_t row_idx,
OperatorSinkInput & sink ) const
overridevirtual

Implements duckdb::WindowAggregator.

256118 {
256119 const auto &gdstate = sink.global_state.Cast<WindowDistinctAggregatorGlobalState>();
256120 auto &ldstate = sink.local_state.Cast<WindowDistinctAggregatorLocalState>();
256121 ldstate.Evaluate(context, gdstate, bounds, result, count, row_idx);
256122}

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