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

Public Member Functions

 WindowDenseRankExecutor (BoundWindowExpression &wexpr, WindowSharedExpressions &shared)
Public Member Functions inherited from duckdb::WindowPeerExecutor
 WindowPeerExecutor (BoundWindowExpression &wexpr, WindowSharedExpressions &shared)
unique_ptr< GlobalSinkState > GetGlobalState (ClientContext &context, const idx_t payload_count, const ValidityMask &partition_mask, const ValidityMask &order_mask) const override
unique_ptr< LocalSinkState > GetLocalState (ExecutionContext &context, const GlobalSinkState &gstate) const override
Public Member Functions inherited from duckdb::WindowExecutor
 WindowExecutor (BoundWindowExpression &wexpr, WindowSharedExpressions &shared)
virtual bool IgnoreNulls () const
virtual void Sink (ExecutionContext &context, DataChunk &sink_chunk, DataChunk &coll_chunk, const idx_t input_idx, OperatorSinkInput &sink) const
virtual void Finalize (ExecutionContext &context, CollectionPtr collection, OperatorSinkInput &sink) const
void Evaluate (ExecutionContext &context, idx_t row_idx, DataChunk &eval_chunk, Vector &result, OperatorSinkInput &sink) const

Protected Member Functions

void EvaluateInternal (ExecutionContext &context, DataChunk &eval_chunk, Vector &result, idx_t count, idx_t row_idx, OperatorSinkInput &sink) const override

Additional Inherited Members

Public Types inherited from duckdb::WindowExecutor
using CollectionPtr = optional_ptr<WindowCollection>
Public Attributes inherited from duckdb::WindowPeerExecutor
vector< column_t > arg_order_idx
 The column indices of any ORDER BY argument expressions.
Public Attributes inherited from duckdb::WindowExecutor
const BoundWindowExpression & wexpr
column_t boundary_start_idx = DConstants::INVALID_INDEX
column_t boundary_end_idx = DConstants::INVALID_INDEX
optional_ptr< Expression > range_expr
column_t range_idx = DConstants::INVALID_INDEX

Constructor & Destructor Documentation

◆ WindowDenseRankExecutor()

duckdb::WindowDenseRankExecutor::WindowDenseRankExecutor ( BoundWindowExpression & wexpr,
WindowSharedExpressions & shared )
257179 : WindowPeerExecutor(wexpr, shared) {
257180}

Member Function Documentation

◆ EvaluateInternal()

void duckdb::WindowDenseRankExecutor::EvaluateInternal ( ExecutionContext & context,
DataChunk & eval_chunk,
Vector & result,
idx_t count,
idx_t row_idx,
OperatorSinkInput & sink ) const
overrideprotectedvirtual

Implements duckdb::WindowExecutor.

257183 {
257184 auto &gpeer = sink.global_state.Cast<WindowPeerGlobalState>();
257185 auto &lpeer = sink.local_state.Cast<WindowPeerLocalState>();
257186
257187 auto &order_mask = gpeer.order_mask;
257188 auto partition_begin = FlatVector::GetData<const idx_t>(lpeer.bounds.data[PARTITION_BEGIN]);
257189 auto peer_begin = FlatVector::GetData<const idx_t>(lpeer.bounds.data[PEER_BEGIN]);
257190 auto rdata = FlatVector::GetData<int64_t>(result);
257191
257192 // Reset to "previous" row
257193 // Resetting is slow because we have to rescan the mask.
257194 // So check whether we are just picking up where we left off.
257195 // This is common because the main window operator
257196 // evaluates maximally sized runs for each hash group.
257197 if (lpeer.row_idx != row_idx) {
257198 lpeer.rank = (peer_begin[0] - partition_begin[0]) + 1;
257199 lpeer.rank_equal = (row_idx - peer_begin[0]);
257200
257201 // The previous dense rank is the number of order mask bits in [partition_begin, row_idx)
257202 lpeer.dense_rank = 0;
257203
257204 auto order_begin = partition_begin[0];
257205 idx_t begin_idx;
257206 idx_t begin_offset;
257207 order_mask.GetEntryIndex(order_begin, begin_idx, begin_offset);
257208
257209 auto order_end = row_idx;
257210 idx_t end_idx;
257211 idx_t end_offset;
257212 order_mask.GetEntryIndex(order_end, end_idx, end_offset);
257213
257214 // If they are in the same entry, just loop
257215 if (begin_idx == end_idx) {
257216 const auto entry = order_mask.GetValidityEntry(begin_idx);
257217 for (; begin_offset < end_offset; ++begin_offset) {
257218 lpeer.dense_rank += order_mask.RowIsValid(entry, begin_offset);
257219 }
257220 } else {
257221 // Count the ragged bits at the start of the partition
257222 if (begin_offset) {
257223 const auto entry = order_mask.GetValidityEntry(begin_idx);
257224 for (; begin_offset < order_mask.BITS_PER_VALUE; ++begin_offset) {
257225 lpeer.dense_rank += order_mask.RowIsValid(entry, begin_offset);
257226 ++order_begin;
257227 }
257228 ++begin_idx;
257229 }
257230
257231 // Count the the aligned bits.
257232 ValidityMask tail_mask(order_mask.GetData() + begin_idx, end_idx - begin_idx);
257233 lpeer.dense_rank += tail_mask.CountValid(order_end - order_begin);
257234 }
257235 }
257236
257237 for (idx_t i = 0; i < count; ++i, ++row_idx) {
257238 lpeer.NextRank(partition_begin[i], peer_begin[i], row_idx);
257239 rdata[i] = NumericCast<int64_t>(lpeer.dense_rank);
257240 }
257241
257242 // Remember where we left off
257243 lpeer.row_idx = row_idx;
257244}
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237

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