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

Public Member Functions

 ArrowMergeEvent (ArrowQueryResult &result, BatchedDataCollection &batches, Pipeline &pipeline_p)
 
void Schedule () override
 
- Public Member Functions inherited from duckdb::BasePipelineEvent
 BasePipelineEvent (shared_ptr< Pipeline > pipeline)
 
 BasePipelineEvent (Pipeline &pipeline)
 
void PrintPipeline () override
 
- Public Member Functions inherited from duckdb::Event
 Event (Executor &executor)
 
virtual void FinishEvent ()
 Called right after the event is finished.
 
virtual void FinalizeFinish ()
 Called after the event is entirely finished.
 
void FinishTask ()
 
void Finish ()
 
void AddDependency (Event &event)
 
bool HasDependencies () const
 
const vector< reference< Event > > & GetParentsVerification () const
 
void CompleteDependency ()
 
void SetTasks (vector< shared_ptr< Task > > tasks)
 
void InsertEvent (shared_ptr< Event > replacement_event)
 
bool IsFinished () const
 
ClientContextGetClientContext ()
 
template<class TARGET >
TARGETCast ()
 
template<class TARGET >
const TARGETCast () const
 
- Public Member Functions inherited from duckdb::enable_shared_from_this< Event >
shared_ptr< Eventshared_from_this ()
 
shared_ptr< Event constshared_from_this () const
 

Public Attributes

ArrowQueryResultresult
 
BatchedDataCollectionbatches
 
- Public Attributes inherited from duckdb::BasePipelineEvent
shared_ptr< Pipelinepipeline
 The pipeline that this event belongs to.
 

Private Attributes

idx_t record_batch_size
 The max size of a record batch to output.
 

Additional Inherited Members

- Protected Member Functions inherited from duckdb::enable_shared_from_this< Event >
 enable_shared_from_this (enable_shared_from_this const &) noexcept
 
enable_shared_from_thisoperator= (enable_shared_from_this const &) noexcept
 
- Protected Attributes inherited from duckdb::Event
Executorexecutor
 
atomic< idx_tfinished_tasks
 The current threads working on the event.
 
atomic< idx_ttotal_tasks
 The maximum amount of threads that can work on the event.
 
atomic< idx_tfinished_dependencies
 
idx_t total_dependencies
 The total amount of dependencies.
 
vector< weak_ptr< Event > > parents
 The events that depend on this event to run.
 
vector< reference< Event > > parents_raw
 Raw pointers to the parents (used for verification only)
 
atomic< bool > finished
 Whether or not the event is finished executing.
 

Constructor & Destructor Documentation

◆ ArrowMergeEvent()

duckdb::ArrowMergeEvent::ArrowMergeEvent ( ArrowQueryResult result,
BatchedDataCollection batches,
Pipeline pipeline_p 
)
35468 : BasePipelineEvent(pipeline_p), result(result), batches(batches) {
35469 record_batch_size = result.BatchSize();
35470}
idx_t record_batch_size
The max size of a record batch to output.
Definition duckdb.cpp:35388

Member Function Documentation

◆ Schedule()

void duckdb::ArrowMergeEvent::Schedule ( )
overridevirtual

Implements duckdb::Event.

35505 {
35506 vector<shared_ptr<Task>> tasks;
35507
35508 BatchesToTaskTransformer transformer(batches);
35509 vector<BatchesForTask> task_data;
35510 bool finished = false;
35511 // First we convert our list of batches into units of Storage::ROW_GROUP_SIZE tuples each
35512 while (!finished) {
35513 idx_t tuples_for_task = 0;
35514 idx_t start_index = transformer.GetIndex();
35515 idx_t end_index = start_index;
35516 while (tuples_for_task < DEFAULT_ROW_GROUP_SIZE) {
35517 idx_t batch_size;
35518 if (!transformer.TryGetNextBatchSize(batch_size)) {
35519 finished = true;
35520 break;
35521 }
35522 end_index++;
35523 tuples_for_task += batch_size;
35524 }
35525 if (start_index == end_index) {
35526 break;
35527 }
35528 BatchesForTask batches_for_task;
35529 batches_for_task.tuple_count = tuples_for_task;
35530 batches_for_task.batches = batches.BatchRange(start_index, end_index);
35531 task_data.push_back(batches_for_task);
35532 }
35533
35534 // Now we produce tasks from these units
35535 // Every task is given a scan_state created from the range of batches
35536 // and a vector of indices indicating the arrays (record batches) they should populate
35537 idx_t record_batch_index = 0;
35538 for (auto &data : task_data) {
35539 const auto tuples = data.tuple_count;
35540
35541 auto full_batches = tuples / record_batch_size;
35542 auto remainder = tuples % record_batch_size;
35543 auto total_batches = full_batches + !!remainder;
35544
35545 vector<idx_t> record_batch_indices(total_batches);
35546 for (idx_t i = 0; i < total_batches; i++) {
35547 record_batch_indices[i] = record_batch_index++;
35548 }
35549
35550 BatchCollectionChunkScanState scan_state(batches, data.batches, pipeline->executor.context);
35551 tasks.push_back(make_uniq<ArrowBatchTask>(result, std::move(record_batch_indices), pipeline->executor,
35552 shared_from_this(), std::move(scan_state), result.names,
35554 }
35555
35556 // Allocate the list of record batches inside the query result
35557 {
35558 vector<unique_ptr<ArrowArrayWrapper>> arrays;
35559 arrays.resize(record_batch_index);
35560 for (idx_t i = 0; i < record_batch_index; i++) {
35561 arrays[i] = make_uniq<ArrowArrayWrapper>();
35562 }
35563 result.SetArrowData(std::move(arrays));
35564 }
35565 D_ASSERT(!tasks.empty());
35566 SetTasks(std::move(tasks));
35567}
shared_ptr< Pipeline > pipeline
The pipeline that this event belongs to.
Definition duckdb.cpp:35137
vector< string > names
The names of the result.
Definition duckdb.hpp:19524
BatchedChunkIteratorRange BatchRange(idx_t begin=0, idx_t end=DConstants::INVALID_INDEX)
Create an iterator range from the provided indices.
atomic< bool > finished
Whether or not the event is finished executing.
Definition duckdb.cpp:35117

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