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

Public Member Functions

 PhysicalLeftDelimJoin (PhysicalPlan &physical_plan, PhysicalPlanGenerator &planner, vector< LogicalType > types, PhysicalOperator &original_join, PhysicalOperator &distinct, const vector< const_reference< PhysicalOperator > > &delim_scans, idx_t estimated_cardinality, optional_idx delim_idx)
unique_ptr< GlobalSinkState > GetGlobalSinkState (ClientContext &context) const override
unique_ptr< LocalSinkState > GetLocalSinkState (ExecutionContext &context) const override
SinkResultType Sink (ExecutionContext &context, DataChunk &chunk, OperatorSinkInput &input) const override
SinkCombineResultType Combine (ExecutionContext &context, OperatorSinkCombineInput &input) const override
void PrepareFinalize (ClientContext &context, GlobalSinkState &sink_state) const override
SinkFinalizeType Finalize (Pipeline &pipeline, Event &event, ClientContext &context, OperatorSinkFinalizeInput &input) const override
void BuildPipelines (Pipeline &current, MetaPipeline &meta_pipeline) override
Public Member Functions inherited from duckdb::PhysicalDelimJoin
 PhysicalDelimJoin (PhysicalPlan &physical_plan, PhysicalOperatorType type, vector< LogicalType > types, PhysicalOperator &original_join, PhysicalOperator &distinct, const vector< const_reference< PhysicalOperator > > &delim_scans, idx_t estimated_cardinality, optional_idx delim_idx)
vector< const_reference< PhysicalOperator > > GetChildren () const override
bool IsSink () const override
bool ParallelSink () const override
OrderPreservationType SourceOrder () const override
 The type of order emitted by the operator (as a source).
bool SinkOrderDependent () const override
InsertionOrderPreservingMap< string > ParamsToString () 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
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 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 SinkNextBatchType NextBatch (ExecutionContext &context, OperatorSinkNextBatchInput &input) const
virtual OperatorPartitionInfo RequiredPartitionInfo () 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 Attributes

static constexpr const PhysicalOperatorType TYPE = PhysicalOperatorType::LEFT_DELIM_JOIN
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.
Public Attributes inherited from duckdb::PhysicalDelimJoin
PhysicalOperator & join
PhysicalHashAggregate & distinct
vector< const_reference< PhysicalOperator > > delim_scans
optional_idx delim_idx
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.
Protected Member Functions inherited from duckdb::PhysicalOperator
virtual SourceResultType GetDataInternal (ExecutionContext &context, DataChunk &chunk, OperatorSourceInput &input) const

Detailed Description

PhysicalLeftDelimJoin represents a join where the LHS will be duplicate eliminated and pushed into a PhysicalColumnDataScan in the RHS.

Constructor & Destructor Documentation

◆ PhysicalLeftDelimJoin()

duckdb::PhysicalLeftDelimJoin::PhysicalLeftDelimJoin ( PhysicalPlan & physical_plan,
PhysicalPlanGenerator & planner,
vector< LogicalType > types,
PhysicalOperator & original_join,
PhysicalOperator & distinct,
const vector< const_reference< PhysicalOperator > > & delim_scans,
idx_t estimated_cardinality,
optional_idx delim_idx )
187921 : PhysicalDelimJoin(physical_plan, PhysicalOperatorType::LEFT_DELIM_JOIN, std::move(types), original_join, distinct,
187922 delim_scans, estimated_cardinality, delim_idx) {
187923 D_ASSERT(join.children.size() == 2);
187924 // now for the original join
187925 // we take its left child, this is the side that we will duplicate eliminate
187926 children.push_back(join.children[0]);
187927
187928 // we replace it with a PhysicalColumnDataScan, that scans the ColumnDataCollection that we keep cached
187929 // the actual chunk collection to scan will be created in the LeftDelimJoinGlobalState
187930 auto &cached_scan = planner.Make<PhysicalColumnDataScan>(
187931 children[0].get().GetTypes(), PhysicalOperatorType::COLUMN_DATA_SCAN, estimated_cardinality, nullptr);
187932 if (delim_idx.IsValid()) {
187933 auto &cast_cached_scan = cached_scan.Cast<PhysicalColumnDataScan>();
187934 cast_cached_scan.cte_index = delim_idx.GetIndex();
187935 }
187936 join.children[0] = cached_scan;
187937}
vector< LogicalType > types
The return types.
Definition duckdb.hpp:22152
const vector< LogicalType > & GetTypes() const
Return a vector of the types that will be returned by this operator.
Definition duckdb.hpp:22174
idx_t estimated_cardinality
The estimated cardinality.
Definition duckdb.hpp:22154
ArenaLinkedList< reference< PhysicalOperator > > children
The child operators.
Definition duckdb.hpp:22148

Member Function Documentation

◆ GetGlobalSinkState()

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

Reimplemented from duckdb::PhysicalOperator.

187977 {
187978 auto state = make_uniq<LeftDelimJoinGlobalState>(context, *this);
187979 distinct.sink_state = distinct.GetGlobalSinkState(context);
187980 if (delim_scans.size() > 1) {
187981 PhysicalHashAggregate::SetMultiScan(*distinct.sink_state);
187982 }
187983 return std::move(state);
187984}
static void SetMultiScan(GlobalSinkState &state)
Definition duckdb.cpp:160199

◆ GetLocalSinkState()

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

Reimplemented from duckdb::PhysicalOperator.

187986 {
187987 auto state = make_uniq<LeftDelimJoinLocalState>(context.client, *this);
187988 state->distinct_state = distinct.GetLocalSinkState(context);
187989 return std::move(state);
187990}

◆ Sink()

SinkResultType duckdb::PhysicalLeftDelimJoin::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.

187993 {
187994 auto &lstate = input.local_state.Cast<LeftDelimJoinLocalState>();
187995 lstate.lhs_data.Append(lstate.append_state, chunk);
187996 OperatorSinkInput distinct_sink_input {*distinct.sink_state, *lstate.distinct_state, input.interrupt_state};
187997 distinct.Sink(context, chunk, distinct_sink_input);
187998 return SinkResultType::NEED_MORE_INPUT;
187999}
Here is the call graph for this function:

◆ Combine()

SinkCombineResultType duckdb::PhysicalLeftDelimJoin::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.

188001 {
188002 auto &lstate = input.local_state.Cast<LeftDelimJoinLocalState>();
188003 auto &gstate = input.global_state.Cast<LeftDelimJoinGlobalState>();
188004 gstate.Merge(lstate.lhs_data);
188005
188006 OperatorSinkCombineInput distinct_combine_input {*distinct.sink_state, *lstate.distinct_state,
188007 input.interrupt_state};
188008 distinct.Combine(context, distinct_combine_input);
188009
188010 return SinkCombineResultType::FINISHED;
188011}

◆ PrepareFinalize()

void duckdb::PhysicalLeftDelimJoin::PrepareFinalize ( ClientContext & context,
GlobalSinkState & sink_state ) const
overridevirtual

(optional) function that will be called before Finalize For now, its only use is to to communicate memory usage in multi-join pipelines through TemporaryMemoryManager

Reimplemented from duckdb::PhysicalOperator.

188013 {
188014 distinct.PrepareFinalize(context, *distinct.sink_state);
188015}

◆ Finalize()

SinkFinalizeType duckdb::PhysicalLeftDelimJoin::Finalize ( Pipeline & pipeline,
Event & event,
ClientContext & context,
OperatorSinkFinalizeInput & input ) const
overridevirtual

The finalize is called when ALL threads are finished execution. It is called only once per pipeline, and is entirely single threaded. If Finalize returns SinkResultType::Finished, the sink is marked as finished

Reimplemented from duckdb::PhysicalOperator.

188018 {
188019 // Finalize the distinct hash table.
188020 OperatorSinkFinalizeInput finalize_input {*distinct.sink_state, input.interrupt_state};
188021 distinct.Finalize(pipeline, event, client, finalize_input);
188022 return SinkFinalizeType::READY;
188023}

◆ BuildPipelines()

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

Reimplemented from duckdb::PhysicalOperator.

188028 {
188029 op_state.reset();
188030 sink_state.reset();
188031
188032 auto &child_meta_pipeline = meta_pipeline.CreateChildMetaPipeline(current, *this);
188033 child_meta_pipeline.Build(children[0]);
188034
188035 D_ASSERT(type == PhysicalOperatorType::LEFT_DELIM_JOIN);
188036 // recurse into the actual join
188037 // any pipelines in there depend on the main pipeline
188038 // any scan of the duplicate eliminated data on the RHS depends on this pipeline
188039 // we add an entry to the mapping of (PhysicalOperator*) -> (Pipeline*)
188040 auto &state = meta_pipeline.GetState();
188041 for (auto &delim_scan : delim_scans) {
188042 state.delim_join_dependencies.insert(
188043 make_pair(delim_scan, reference<Pipeline>(*child_meta_pipeline.GetBasePipeline())));
188044 }
188045 join.BuildPipelines(current, meta_pipeline);
188046}
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
PhysicalOperatorType type
The physical operator type.
Definition duckdb.hpp:22150

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