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

Public Member Functions

 PhysicalCTE (PhysicalPlan &physical_plan, string ctename, idx_t table_index, vector< LogicalType > types, PhysicalOperator &top, PhysicalOperator &bottom, idx_t estimated_cardinality)
SinkResultType Sink (ExecutionContext &context, DataChunk &chunk, OperatorSinkInput &input) const override
unique_ptr< GlobalSinkState > GetGlobalSinkState (ClientContext &context) const override
unique_ptr< LocalSinkState > GetLocalSinkState (ExecutionContext &context) const override
SinkCombineResultType Combine (ExecutionContext &context, OperatorSinkCombineInput &input) const override
bool IsSink () const override
bool ParallelSink () const override
bool SinkOrderDependent () const override
InsertionOrderPreservingMap< string > ParamsToString () const override
void BuildPipelines (Pipeline &current, MetaPipeline &meta_pipeline) override
vector< const_reference< PhysicalOperator > > GetSources () const override
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 string ToString (ExplainFormat format=ExplainFormat::DEFAULT) const
void Print () const
virtual vector< const_reference< PhysicalOperator > > GetChildren () 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 IsSource () 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 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 OperatorPartitionInfo RequiredPartitionInfo () const
bool AllSourcesSupportBatchIndex () const
template<class TARGET>
TARGET & Cast ()
template<class TARGET>
const TARGET & Cast () const

Public Attributes

vector< const_reference< PhysicalOperator > > cte_scans
shared_ptr< ColumnDataCollection > working_table
idx_t table_index
string ctename
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::CTE
Static Public Attributes inherited from duckdb::PhysicalOperator
static constexpr const PhysicalOperatorType TYPE = PhysicalOperatorType::INVALID

Additional Inherited Members

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.
Protected Member Functions inherited from duckdb::PhysicalOperator
virtual SourceResultType GetDataInternal (ExecutionContext &context, DataChunk &chunk, OperatorSourceInput &input) const

Constructor & Destructor Documentation

◆ PhysicalCTE()

duckdb::PhysicalCTE::PhysicalCTE ( PhysicalPlan & physical_plan,
string ctename,
idx_t table_index,
vector< LogicalType > types,
PhysicalOperator & top,
PhysicalOperator & bottom,
idx_t estimated_cardinality )
200419 : PhysicalOperator(physical_plan, PhysicalOperatorType::CTE, std::move(types), estimated_cardinality),
200420 table_index(table_index), ctename(std::move(ctename)) {
200421 children.push_back(top);
200422 children.push_back(bottom);
200423}
vector< LogicalType > types
The return types.
Definition duckdb.hpp:22152
idx_t estimated_cardinality
The estimated cardinality.
Definition duckdb.hpp:22154
ArenaLinkedList< reference< PhysicalOperator > > children
The child operators.
Definition duckdb.hpp:22148

◆ ~PhysicalCTE()

duckdb::PhysicalCTE::~PhysicalCTE ( )
override
200425 {
200426}

Member Function Documentation

◆ Sink()

SinkResultType duckdb::PhysicalCTE::Sink ( ExecutionContext & context,
DataChunk & chunk,
OperatorSinkInput & input ) const
overridevirtual

The sink method is called constantly with new input, as long as new input is available. Note that this method CAN be called in parallel, proper locking is needed when accessing dat a inside the GlobalSinkState.

Reimplemented from duckdb::PhysicalOperator.

200471 {
200472 auto &lstate = input.local_state.Cast<CTELocalState>();
200473 lstate.lhs_data.Append(lstate.append_state, chunk);
200474
200475 return SinkResultType::NEED_MORE_INPUT;
200476}
Here is the call graph for this function:

◆ GetGlobalSinkState()

unique_ptr< GlobalSinkState > duckdb::PhysicalCTE::GetGlobalSinkState ( ClientContext & context) const
overridevirtual

Reimplemented from duckdb::PhysicalOperator.

200461 {
200462 working_table->Reset();
200463 return make_uniq<CTEGlobalState>(context, *this);
200464}

◆ GetLocalSinkState()

unique_ptr< LocalSinkState > duckdb::PhysicalCTE::GetLocalSinkState ( ExecutionContext & context) const
overridevirtual

Reimplemented from duckdb::PhysicalOperator.

200466 {
200467 auto state = make_uniq<CTELocalState>(context.client, *this);
200468 return std::move(state);
200469}

◆ Combine()

SinkCombineResultType duckdb::PhysicalCTE::Combine ( ExecutionContext & context,
OperatorSinkCombineInput & input ) const
overridevirtual

The combine is called when a single thread has completed execution of its part of the pipeline, it is the final time that a specific LocalSinkState is accessible. This method can be called in parallel while other Sink() or Combine() calls are active on the same GlobalSinkState.

Reimplemented from duckdb::PhysicalOperator.

200478 {
200479 auto &lstate = input.local_state.Cast<CTELocalState>();
200480 auto &gstate = input.global_state.Cast<CTEGlobalState>();
200481 gstate.MergeIT(lstate.lhs_data);
200482
200483 return SinkCombineResultType::FINISHED;
200484}

◆ IsSink()

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

Reimplemented from duckdb::PhysicalOperator.

200385 {
200386 return true;
200387 }

◆ ParallelSink()

bool duckdb::PhysicalCTE::ParallelSink ( ) const
inlineoverridevirtual

Reimplemented from duckdb::PhysicalOperator.

200389 {
200390 return true;
200391 }

◆ SinkOrderDependent()

bool duckdb::PhysicalCTE::SinkOrderDependent ( ) const
inlineoverridevirtual

Whether or not the sink operator depends on the order of the input chunks If this is set to true, we cannot do things like caching intermediate vectors

Reimplemented from duckdb::PhysicalOperator.

200393 {
200394 return false;
200395 }

◆ ParamsToString()

InsertionOrderPreservingMap< string > duckdb::PhysicalCTE::ParamsToString ( ) const
overridevirtual

Reimplemented from duckdb::PhysicalOperator.

200510 {
200511 InsertionOrderPreservingMap<string> result;
200512 result["CTE Name"] = ctename;
200513 result["Table Index"] = StringUtil::Format("%llu", table_index);
200514 SetEstimatedCardinality(result, estimated_cardinality);
200515 return result;
200516}
static string Format(const string fmt_str, ARGS... params)
Format a string using printf semantics.
Definition duckdb.hpp:4002

◆ BuildPipelines()

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

Reimplemented from duckdb::PhysicalOperator.

200489 {
200490 D_ASSERT(children.size() == 2);
200491 op_state.reset();
200492 sink_state.reset();
200493
200494 auto &state = meta_pipeline.GetState();
200495
200496 auto &child_meta_pipeline = meta_pipeline.CreateChildMetaPipeline(current, *this);
200497 child_meta_pipeline.Build(children[0]);
200498
200499 for (auto &cte_scan : cte_scans) {
200500 state.cte_dependencies.insert(make_pair(cte_scan, reference<Pipeline>(*child_meta_pipeline.GetBasePipeline())));
200501 }
200502
200503 children[1].get().BuildPipelines(current, meta_pipeline);
200504}
unique_ptr< GlobalOperatorState > op_state
The global operator state.
Definition duckdb.hpp:22159
unique_ptr< GlobalSinkState > sink_state
The global sink state.
Definition duckdb.hpp:22157

◆ GetSources()

vector< const_reference< PhysicalOperator > > duckdb::PhysicalCTE::GetSources ( ) const
overridevirtual

Reimplemented from duckdb::PhysicalOperator.

200506 {
200507 return children[1].get().GetSources();
200508}

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