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::WindowMergeSortTreeLocalState Class Referenceabstract
Inheritance diagram for duckdb::WindowMergeSortTreeLocalState:
Collaboration diagram for duckdb::WindowMergeSortTreeLocalState:

Public Member Functions

 WindowMergeSortTreeLocalState (ExecutionContext &context, WindowMergeSortTree &index_tree)
void Sink (ExecutionContext &context, DataChunk &chunk, const idx_t row_idx, optional_ptr< SelectionVector > filter_sel, idx_t filtered, InterruptState &interrupt)
 Add a chunk to the local sort.
void Finalize (ExecutionContext &context, InterruptState &interrupt)
 Sort the data.
virtual void BuildLeaves ()=0
 Process sorted leaf data.
Public Member Functions inherited from duckdb::LocalSinkState
template<class TARGET>
TARGET & Cast ()
template<class TARGET>
const TARGET & Cast () const

Public Attributes

WindowMergeSortTree & window_tree
 The index tree we are building.
optional_ptr< LocalSinkState > local_sink
 Thread-local sorting data.
DataChunk sort_chunk
 Buffer for the sort data.
WindowMergeSortStage build_stage = WindowMergeSortStage::INIT
 Build stage.
idx_t build_task
 Build task number.
Public Attributes inherited from duckdb::LocalSinkState
SourcePartitionInfo partition_info
 Source partition info.

Private Member Functions

void ExecuteSortTask (ExecutionContext &context, InterruptState &interrupt)

Constructor & Destructor Documentation

◆ WindowMergeSortTreeLocalState()

duckdb::WindowMergeSortTreeLocalState::WindowMergeSortTreeLocalState ( ExecutionContext & context,
WindowMergeSortTree & index_tree )
256422 sort_chunk.Initialize(context.client, window_tree.scan_types);
256423 local_sink = window_tree.InitializeLocalSort(context);
256424}
WindowMergeSortTree & window_tree
The index tree we are building.
Definition duckdb.cpp:60181
DataChunk sort_chunk
Buffer for the sort data.
Definition duckdb.cpp:60185
optional_ptr< LocalSinkState > local_sink
Thread-local sorting data.
Definition duckdb.cpp:60183

Member Function Documentation

◆ Sink()

void duckdb::WindowMergeSortTreeLocalState::Sink ( ExecutionContext & context,
DataChunk & chunk,
const idx_t row_idx,
optional_ptr< SelectionVector > filter_sel,
idx_t filtered,
InterruptState & interrupt )

Add a chunk to the local sort.

256428 {
256429 // Sequence the payload column
256430 sort_chunk.Reset();
256431 auto &indices = sort_chunk.data.back();
256432 indices.Sequence(int64_t(row_idx), 1, chunk.size());
256433
256434 // Reference the ORDER BY columns
256435 auto &order_idx = window_tree.order_idx;
256436 for (column_t c = 0; c < order_idx.size(); ++c) {
256437 sort_chunk.data[c].Reference(chunk.data[order_idx[c]]);
256438 }
256439 sort_chunk.SetCardinality(chunk);
256440
256441 // Apply FILTER clause, if any
256442 if (filter_sel) {
256443 sort_chunk.Slice(*filter_sel, filtered);
256444 }
256445
256446 OperatorSinkInput sink {*window_tree.global_sink, *local_sink, interrupt};
256447 window_tree.sort->Sink(context, sort_chunk, sink);
256448}
vector< Vector > data
The vectors owned by the DataChunk.
Definition duckdb.hpp:11445
::int64_t int64_t
idx_t column_t
Type used for column identifiers.
Definition duckdb.hpp:259
Here is the caller graph for this function:

◆ Finalize()

void duckdb::WindowMergeSortTreeLocalState::Finalize ( ExecutionContext & context,
InterruptState & interrupt )

Sort the data.

256561 {
256562 // Sort, merge and build the tree in parallel
256563 while (window_tree.build_stage.load() != WindowMergeSortStage::FINISHED) {
256564 if (window_tree.TryPrepareSortStage(*this)) {
256565 ExecuteSortTask(context, interrupt);
256566 } else {
256567 std::this_thread::yield();
256568 }
256569 }
256570}
Here is the caller graph for this function:

◆ BuildLeaves()

virtual void duckdb::WindowMergeSortTreeLocalState::BuildLeaves ( )
pure virtual

Process sorted leaf data.

Implemented in duckdb::WindowIndexTreeLocalState, and duckdb::WindowTokenTreeLocalState.

◆ ExecuteSortTask()

void duckdb::WindowMergeSortTreeLocalState::ExecuteSortTask ( ExecutionContext & context,
InterruptState & interrupt )
private
256450 {
256451 PostIncrement<atomic<idx_t>> on_completed(window_tree.tasks_completed);
256452
256453 switch (build_stage) {
256454 case WindowMergeSortStage::COMBINE: {
256455 auto &local_sink = *window_tree.local_sinks[build_task];
256456 OperatorSinkCombineInput combine {*window_tree.global_sink, local_sink, interrupt};
256457 window_tree.sort->Combine(context, combine);
256458 break;
256459 }
256460 case WindowMergeSortStage::FINALIZE: {
256461 auto &sort = *window_tree.sort;
256462 OperatorSinkFinalizeInput finalize {*window_tree.global_sink, interrupt};
256463 sort.Finalize(context.client, finalize);
256464 auto sort_global = sort.GetGlobalSourceState(context.client, *window_tree.global_sink);
256465 auto sort_local = sort.GetLocalSourceState(context, *sort_global);
256466 OperatorSourceInput source {*sort_global, *sort_local, interrupt};
256467 sort.MaterializeColumnData(context, source);
256468 window_tree.sorted = sort.GetColumnData(source);
256469 break;
256470 }
256471 case WindowMergeSortStage::SORTED:
256472 BuildLeaves();
256473 break;
256474 default:
256475 break;
256476 }
256477}
WindowMergeSortStage build_stage
Build stage.
Definition duckdb.cpp:60187
virtual void BuildLeaves()=0
Process sorted leaf data.
idx_t build_task
Build task number.
Definition duckdb.cpp:60189
void sort(InputArray src, OutputArray dst, int flags)
cv::GKernelPackage combine(const cv::GKernelPackage &lhs, const cv::GKernelPackage &rhs)

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