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::PhysicalResultCollector Class Referenceabstract

PhysicalResultCollector is an abstract class that is used to generate the final result of a query. More...

Inheritance diagram for duckdb::PhysicalResultCollector:
Collaboration diagram for duckdb::PhysicalResultCollector:

Public Member Functions

 PhysicalResultCollector (PhysicalPlan &physical_plan, PreparedStatementData &data)
virtual unique_ptr< QueryResult > GetResult (GlobalSinkState &state) const =0
 The final method used to fetch the query result from this operator.
bool IsSink () const override
vector< const_reference< PhysicalOperator > > GetChildren () const override
void BuildPipelines (Pipeline &current, MetaPipeline &meta_pipeline) override
bool IsSource () const override
virtual bool IsStreaming () const
 Whether this is a streaming result collector.
Public Member Functions inherited from duckdb::PhysicalOperator
 PhysicalOperator (PhysicalPlan &physical_plan, PhysicalOperatorType type, vector< LogicalType > types, idx_t estimated_cardinality)
 PhysicalOperator (const PhysicalOperator &other)=delete
 Deleted copy constructors.
PhysicalOperator & operator= (const PhysicalOperator &)=delete
virtual string GetName () const
virtual InsertionOrderPreservingMap< string > ParamsToString () const
virtual string ToString (ExplainFormat format=ExplainFormat::DEFAULT) const
void Print () const
const vector< LogicalType > & GetTypes () const
 Return a vector of the types that will be returned by this operator.
virtual bool Equals (const PhysicalOperator &other) const
idx_t EstimatedThreadCount () const
 Functions to help decide how to set up pipeline dependencies.
bool CanSaturateThreads (ClientContext &context) const
virtual void Verify ()
virtual unique_ptr< OperatorState > GetOperatorState (ExecutionContext &context) const
virtual unique_ptr< GlobalOperatorState > GetGlobalOperatorState (ClientContext &context) const
virtual OperatorResultType Execute (ExecutionContext &context, DataChunk &input, DataChunk &chunk, GlobalOperatorState &gstate, OperatorState &state) const
virtual OperatorFinalizeResultType FinalExecute (ExecutionContext &context, DataChunk &chunk, GlobalOperatorState &gstate, OperatorState &state) const
virtual OperatorFinalResultType OperatorFinalize (Pipeline &pipeline, Event &event, ClientContext &context, OperatorFinalizeInput &input) const
virtual bool ParallelOperator () const
virtual bool RequiresFinalExecute () const
virtual bool RequiresOperatorFinalize () const
virtual OrderPreservationType OperatorOrder () const
 The influence the operator has on order (insertion order means no influence).
virtual unique_ptr< LocalSourceState > GetLocalSourceState (ExecutionContext &context, GlobalSourceState &gstate) const
virtual unique_ptr< GlobalSourceState > GetGlobalSourceState (ClientContext &context) const
SourceResultType GetData (ExecutionContext &context, DataChunk &chunk, OperatorSourceInput &input) const
virtual OperatorPartitionData GetPartitionData (ExecutionContext &context, DataChunk &chunk, GlobalSourceState &gstate, LocalSourceState &lstate, const OperatorPartitionInfo &partition_info) const
virtual bool ParallelSource () const
virtual bool SupportsPartitioning (const OperatorPartitionInfo &partition_info) const
virtual OrderPreservationType SourceOrder () const
 The type of order emitted by the operator (as a source).
virtual ProgressData GetProgress (ClientContext &context, GlobalSourceState &gstate) const
 Returns the current progress percentage, or a negative value if progress bars are not supported.
virtual ProgressData GetSinkProgress (ClientContext &context, GlobalSinkState &gstate, const ProgressData source_progress) const
 Returns the current progress percentage, or a negative value if progress bars are not supported.
virtual InsertionOrderPreservingMap< string > ExtraSourceParams (GlobalSourceState &gstate, LocalSourceState &lstate) const
virtual SinkResultType Sink (ExecutionContext &context, DataChunk &chunk, OperatorSinkInput &input) const
virtual SinkCombineResultType Combine (ExecutionContext &context, OperatorSinkCombineInput &input) const
virtual void PrepareFinalize (ClientContext &context, GlobalSinkState &sink_state) const
virtual SinkFinalizeType Finalize (Pipeline &pipeline, Event &event, ClientContext &context, OperatorSinkFinalizeInput &input) const
virtual SinkNextBatchType NextBatch (ExecutionContext &context, OperatorSinkNextBatchInput &input) const
virtual unique_ptr< LocalSinkState > GetLocalSinkState (ExecutionContext &context) const
virtual unique_ptr< GlobalSinkState > GetGlobalSinkState (ClientContext &context) const
virtual bool ParallelSink () const
virtual OperatorPartitionInfo RequiredPartitionInfo () const
virtual bool SinkOrderDependent () const
virtual vector< const_reference< PhysicalOperator > > GetSources () const
bool AllSourcesSupportBatchIndex () const
template<class TARGET>
TARGET & Cast ()
template<class TARGET>
const TARGET & Cast () const

Static Public Member Functions

static unique_ptr< PhysicalOperator > GetResultCollector (ClientContext &context, PreparedStatementData &data)
Static Public Member Functions inherited from duckdb::PhysicalOperator
static void SetEstimatedCardinality (InsertionOrderPreservingMap< string > &result, idx_t estimated_cardinality)
static idx_t GetMaxThreadMemory (ClientContext &context)
 The maximum amount of memory the operator should use per thread.
static OperatorCachingMode SelectOperatorCachingMode (ExecutionContext &context)
 Whether operator caching is allowed in the current execution context.

Public Attributes

StatementType statement_type
StatementProperties properties
QueryResultMemoryType memory_type
PhysicalOperator & plan
vector< string > names
Public Attributes inherited from duckdb::PhysicalOperator
ArenaLinkedList< reference< PhysicalOperator > > children
 The child operators.
PhysicalOperatorType type
 The physical operator type.
vector< LogicalType > types
 The return types.
idx_t estimated_cardinality
 The estimated cardinality.
unique_ptr< GlobalSinkState > sink_state
 The global sink state.
unique_ptr< GlobalOperatorState > op_state
 The global operator state.
mutex lock
 Lock for (re)setting any of the operator states.

Static Public Attributes

static constexpr const PhysicalOperatorType TYPE = PhysicalOperatorType::RESULT_COLLECTOR
Static Public Attributes inherited from duckdb::PhysicalOperator
static constexpr const PhysicalOperatorType TYPE = PhysicalOperatorType::INVALID

Protected Member Functions

unique_ptr< ColumnDataCollection > CreateCollection (ClientContext &context) const
Protected Member Functions inherited from duckdb::PhysicalOperator
virtual SourceResultType GetDataInternal (ExecutionContext &context, DataChunk &chunk, OperatorSourceInput &input) const

Detailed Description

PhysicalResultCollector is an abstract class that is used to generate the final result of a query.

Constructor & Destructor Documentation

◆ PhysicalResultCollector()

duckdb::PhysicalResultCollector::PhysicalResultCollector ( PhysicalPlan & physical_plan,
PreparedStatementData & data )
179533 : PhysicalOperator(physical_plan, PhysicalOperatorType::RESULT_COLLECTOR, {LogicalType::BOOLEAN}, 0),
179534 statement_type(data.statement_type), properties(data.properties), memory_type(data.memory_type),
179535 plan(data.physical_plan->Root()), names(data.names) {
179536 types = data.types;
179537}
vector< LogicalType > types
The return types.
Definition duckdb.hpp:22152

Member Function Documentation

◆ GetResultCollector()

unique_ptr< PhysicalOperator > duckdb::PhysicalResultCollector::GetResultCollector ( ClientContext & context,
PreparedStatementData & data )
static
179540 {
179541 auto &physical_plan = *data.physical_plan;
179542 auto &root = physical_plan.Root();
179543
179544 if (!PhysicalPlanGenerator::PreserveInsertionOrder(context, root)) {
179545 // Not an order-preserving plan: use the parallel materialized collector.
179546 if (data.output_type == QueryResultOutputType::ALLOW_STREAMING) {
179547 return make_uniq<PhysicalBufferedCollector>(physical_plan, data, true);
179548 }
179549 return make_uniq<PhysicalMaterializedCollector>(physical_plan, data, true);
179550 }
179551
179552 if (!PhysicalPlanGenerator::UseBatchIndex(context, root)) {
179553 // Order-preserving plan, and we cannot use the batch index: use single-threaded result collector.
179554 if (data.output_type == QueryResultOutputType::ALLOW_STREAMING) {
179555 return make_uniq<PhysicalBufferedCollector>(physical_plan, data, false);
179556 }
179557 return make_uniq<PhysicalMaterializedCollector>(physical_plan, data, false);
179558 }
179559
179560 // Order-preserving plan, and we can use the batch index: use a batch collector.
179561 if (data.output_type == QueryResultOutputType::ALLOW_STREAMING) {
179562 return make_uniq<PhysicalBufferedBatchCollector>(physical_plan, data);
179563 }
179564 return make_uniq<PhysicalBatchCollector>(physical_plan, data);
179565}
static bool PreserveInsertionOrder(ClientContext &context, PhysicalOperator &plan)
Whether or not we should preserve insertion order for executing the given sink.
Definition duckdb.cpp:204829
static bool UseBatchIndex(ClientContext &context, PhysicalOperator &plan)
Whether or not we can (or should) use a batch-index based operator for executing the given sink.
Definition duckdb.cpp:204851

◆ GetResult()

virtual unique_ptr< QueryResult > duckdb::PhysicalResultCollector::GetResult ( GlobalSinkState & state) const
pure virtual

◆ IsSink()

bool duckdb::PhysicalResultCollector::IsSink ( ) const
inlineoverridevirtual

Reimplemented from duckdb::PhysicalOperator.

45919 {
45920 return true;
45921 }

◆ GetChildren()

vector< const_reference< PhysicalOperator > > duckdb::PhysicalResultCollector::GetChildren ( ) const
overridevirtual

Reimplemented from duckdb::PhysicalOperator.

179567 {
179568 return {plan};
179569}

◆ BuildPipelines()

void duckdb::PhysicalResultCollector::BuildPipelines ( Pipeline & current,
MetaPipeline & meta_pipeline )
overridevirtual

Reimplemented from duckdb::PhysicalOperator.

179571 {
179572 // operator is a sink, build a pipeline
179573 sink_state.reset();
179574
179575 D_ASSERT(children.empty());
179576
179577 // single operator: the operator becomes the data source of the current pipeline
179578 auto &state = meta_pipeline.GetState();
179579 state.SetPipelineSource(current, *this);
179580
179581 // we create a new pipeline starting from the child
179582 auto &child_meta_pipeline = meta_pipeline.CreateChildMetaPipeline(current, *this);
179583 child_meta_pipeline.Build(plan);
179584}
unique_ptr< GlobalSinkState > sink_state
The global sink state.
Definition duckdb.hpp:22157
ArenaLinkedList< reference< PhysicalOperator > > children
The child operators.
Definition duckdb.hpp:22148

◆ IsSource()

bool duckdb::PhysicalResultCollector::IsSource ( ) const
inlineoverridevirtual

Reimplemented from duckdb::PhysicalOperator.

45927 {
45928 return true;
45929 }

◆ IsStreaming()

virtual bool duckdb::PhysicalResultCollector::IsStreaming ( ) const
inlinevirtual

Whether this is a streaming result collector.

Reimplemented in duckdb::PhysicalBufferedBatchCollector, and duckdb::PhysicalBufferedCollector.

45933 {
45934 return false;
45935 }
Here is the caller graph for this function:

◆ CreateCollection()

unique_ptr< ColumnDataCollection > duckdb::PhysicalResultCollector::CreateCollection ( ClientContext & context) const
protected
179586 {
179587 switch (memory_type) {
179588 case QueryResultMemoryType::IN_MEMORY:
179589 return make_uniq<ColumnDataCollection>(Allocator::DefaultAllocator(), types);
179590 case QueryResultMemoryType::BUFFER_MANAGED:
179591 // Use the DatabaseInstance BufferManager because the query result can outlive the ClientContext
179592 return make_uniq<ColumnDataCollection>(BufferManager::GetBufferManager(*context.db), types,
179594 default:
179595 throw NotImplementedException("PhysicalResultCollector::CreateCollection for %s",
179596 EnumUtil::ToString(memory_type));
179597 }
179598}
@ THROW_ERROR_AFTER_DATABASE_CLOSES
Definition duckdb.hpp:18822

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