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::WindowValueLocalState Class Reference

A class representing the state of the first_value, last_value and nth_value functions. More...

Inheritance diagram for duckdb::WindowValueLocalState:
Collaboration diagram for duckdb::WindowValueLocalState:

Public Member Functions

 WindowValueLocalState (ExecutionContext &context, const WindowValueGlobalState &gvstate)
void Sink (ExecutionContext &context, DataChunk &sink_chunk, DataChunk &coll_chunk, idx_t input_idx, OperatorSinkInput &sink) override
 Accumulate the secondary sort values.
void Finalize (ExecutionContext &context, CollectionPtr collection, OperatorSinkInput &sink) override
 Finish the sinking and prepare to scan.
Public Member Functions inherited from duckdb::WindowExecutorBoundsLocalState
 WindowExecutorBoundsLocalState (ExecutionContext &context, const WindowExecutorGlobalState &gstate)
virtual void UpdateBounds (WindowExecutorGlobalState &gstate, idx_t row_idx, DataChunk &eval_chunk, optional_ptr< WindowCursor > range)
Public Member Functions inherited from duckdb::WindowExecutorLocalState
 WindowExecutorLocalState (ExecutionContext &context, const WindowExecutorGlobalState &gstate)
Public Member Functions inherited from duckdb::LocalSinkState
template<class TARGET>
TARGET & Cast ()
template<class TARGET>
const TARGET & Cast () const

Public Attributes

const WindowValueGlobalState & gvstate
 The corresponding global value state.
unique_ptr< LocalSinkState > local_value
 The optional sorting state for secondary sorts.
SelectionVector sort_nulls
 Reusable selection vector for NULLs.
SubFrames frames
 The frame boundaries, used for EXCLUDE.
unique_ptr< WindowCursor > cursor
 The state used for reading the collection.
Public Attributes inherited from duckdb::WindowExecutorBoundsLocalState
const ValidityMask & partition_mask
const ValidityMask & order_mask
DataChunk bounds
WindowBoundariesState state
Public Attributes inherited from duckdb::WindowExecutorLocalState
unique_ptr< WindowCursor > range_cursor
 The state used for reading the range collection.
Public Attributes inherited from duckdb::LocalSinkState
SourcePartitionInfo partition_info
 Source partition info.

Additional Inherited Members

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

Detailed Description

A class representing the state of the first_value, last_value and nth_value functions.

Constructor & Destructor Documentation

◆ WindowValueLocalState()

duckdb::WindowValueLocalState::WindowValueLocalState ( ExecutionContext & context,
const WindowValueGlobalState & gvstate )
inline
258426 : WindowExecutorBoundsLocalState(context, gvstate), gvstate(gvstate) {
258427 WindowAggregatorLocalState::InitSubFrames(frames, gvstate.executor.wexpr.exclude_clause);
258428
258429 if (gvstate.value_tree) {
258430 local_value = gvstate.value_tree->GetLocalState(context);
258431 if (gvstate.executor.IgnoreNulls()) {
258432 sort_nulls.Initialize();
258433 }
258434 }
258435 }
unique_ptr< LocalSinkState > local_value
The optional sorting state for secondary sorts.
Definition duckdb.cpp:258446
const WindowValueGlobalState & gvstate
The corresponding global value state.
Definition duckdb.cpp:258444
SelectionVector sort_nulls
Reusable selection vector for NULLs.
Definition duckdb.cpp:258448
SubFrames frames
The frame boundaries, used for EXCLUDE.
Definition duckdb.cpp:258450

Member Function Documentation

◆ Sink()

void duckdb::WindowValueLocalState::Sink ( ExecutionContext & context,
DataChunk & sink_chunk,
DataChunk & coll_chunk,
idx_t input_idx,
OperatorSinkInput & sink )
overridevirtual

Accumulate the secondary sort values.

Reimplemented from duckdb::WindowExecutorLocalState.

258457 {
258458 WindowExecutorBoundsLocalState::Sink(context, sink_chunk, coll_chunk, input_idx, sink);
258459
258460 if (local_value) {
258461 const auto &gvstate = sink.global_state.Cast<WindowValueGlobalState>();
258462 idx_t filtered = 0;
258463 optional_ptr<SelectionVector> filter_sel;
258464
258465 // If we need to IGNORE NULLS for the child, and there are NULLs,
258466 // then build an SV to hold them
258467 const auto coll_count = coll_chunk.size();
258468 auto &child = coll_chunk.data[gvstate.child_idx];
258469 UnifiedVectorFormat child_data;
258470 child.ToUnifiedFormat(coll_count, child_data);
258471 const auto &validity = child_data.validity;
258472 if (gvstate.executor.IgnoreNulls() && !validity.AllValid()) {
258473 const auto &sel = *child_data.sel;
258474 for (sel_t i = 0; i < coll_count; ++i) {
258475 const auto idx = sel.get_index(i);
258476 if (validity.RowIsValidUnsafe(idx)) {
258477 sort_nulls[filtered++] = i;
258478 }
258479 }
258480 filter_sel = &sort_nulls;
258481 }
258482
258483 auto &value_state = local_value->Cast<WindowIndexTreeLocalState>();
258484 value_state.Sink(context, sink_chunk, input_idx, filter_sel, filtered, sink.interrupt_state);
258485 }
258486}
vector< Vector > data
The vectors owned by the DataChunk.
Definition duckdb.hpp:11445
uint32_t sel_t
Type used for the selection vector.
Definition duckdb.hpp:251
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Finalize()

void duckdb::WindowValueLocalState::Finalize ( ExecutionContext & context,
CollectionPtr collection,
OperatorSinkInput & sink )
overridevirtual

Finish the sinking and prepare to scan.

Reimplemented from duckdb::WindowExecutorLocalState.

258488 {
258489 WindowExecutorBoundsLocalState::Finalize(context, collection, sink);
258490
258491 if (local_value) {
258492 auto &value_state = local_value->Cast<WindowIndexTreeLocalState>();
258493 value_state.Finalize(context, sink.interrupt_state);
258494 value_state.index_tree.Build();
258495 }
258496
258497 // Prepare to scan
258498 if (!cursor && gvstate.child_idx != DConstants::INVALID_INDEX) {
258499 cursor = make_uniq<WindowCursor>(*collection, gvstate.child_idx);
258500 }
258501}
unique_ptr< WindowCursor > cursor
The state used for reading the collection.
Definition duckdb.cpp:258453
static constexpr const idx_t INVALID_INDEX
The value used to signify an invalid index entry.
Definition duckdb.hpp:1117
Here is the call graph for this function:
Here is the caller graph for this function:

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