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::LogicalJoin Class Reference

LogicalJoin represents a join between two relations. More...

Inheritance diagram for duckdb::LogicalJoin:
Collaboration diagram for duckdb::LogicalJoin:

Public Member Functions

 LogicalJoin (JoinType type, LogicalOperatorType logical_type=LogicalOperatorType::LOGICAL_JOIN)
bool HasProjectionMap () const override
vector< ColumnBinding > GetColumnBindings () override
vector< idx_t > GetTableIndex () const override
 Returns the set of table indexes of this operator.
string GetName () const override
Public Member Functions inherited from duckdb::LogicalOperator
 LogicalOperator (LogicalOperatorType type)
 LogicalOperator (LogicalOperatorType type, vector< unique_ptr< Expression > > expressions)
virtual idx_t GetRootIndex ()
void PrintColumnBindings ()
void ResolveOperatorTypes ()
 Resolve the types of the logical operator and its children.
virtual InsertionOrderPreservingMap< string > ParamsToString () const
virtual string ToString (ExplainFormat format=ExplainFormat::DEFAULT) const
DUCKDB_API void Print ()
virtual void Verify (ClientContext &context)
 Debug method: verify that the integrity of expressions & child nodes are maintained.
void AddChild (unique_ptr< LogicalOperator > child)
virtual idx_t EstimateCardinality (ClientContext &context)
void SetEstimatedCardinality (idx_t _estimated_cardinality)
void SetParamsEstimatedCardinality (InsertionOrderPreservingMap< string > &result) const
virtual void Serialize (Serializer &serializer) const
virtual unique_ptr< LogicalOperator > Copy (ClientContext &context) const
virtual bool RequireOptimizer () const
virtual bool SupportSerialization () const
 Allows LogicalOperators to opt out of serialization.
template<class TARGET>
TARGET & Cast ()
template<class TARGET>
const TARGET & Cast () const

Static Public Member Functions

static void GetTableReferences (LogicalOperator &op, unordered_set< idx_t > &bindings)
 Gets the set of table references that are reachable from this node.
static void GetExpressionBindings (const Expression &expr, unordered_set< idx_t > &bindings)
Static Public Member Functions inherited from duckdb::LogicalOperator
static string ColumnBindingsToString (const vector< ColumnBinding > &bindings)
static vector< ColumnBinding > GenerateColumnBindings (idx_t table_idx, idx_t column_count)
static vector< LogicalType > MapTypes (const vector< LogicalType > &types, const vector< idx_t > &projection_map)
static vector< ColumnBinding > MapBindings (const vector< ColumnBinding > &types, const vector< idx_t > &projection_map)
static unique_ptr< LogicalOperator > Deserialize (Deserializer &deserializer)

Public Attributes

JoinType join_type
 The type of the join (INNER, OUTER, etc...).
idx_t mark_index {}
 Table index used to refer to the MARK column (in case of a MARK join).
vector< idx_t > left_projection_map
 The columns of the LHS that are output by the join.
vector< idx_t > right_projection_map
 The columns of the RHS that are output by the join.
vector< unique_ptr< BaseStatistics > > join_stats
 Join Keys statistics (optional).
Public Attributes inherited from duckdb::LogicalOperator
LogicalOperatorType type
 The type of the logical operator.
vector< unique_ptr< LogicalOperator > > children
 The set of children of the operator.
vector< unique_ptr< Expression > > expressions
 The set of expressions contained within the operator, if any.
vector< LogicalType > types
 The types returned by this logical operator. Set by calling LogicalOperator::ResolveTypes.
idx_t estimated_cardinality
 Estimated Cardinality.
bool has_estimated_cardinality

Static Public Attributes

static constexpr const LogicalOperatorType TYPE = LogicalOperatorType::LOGICAL_INVALID

Protected Member Functions

void ResolveTypes () override
 Resolve types for this specific operator.

Detailed Description

LogicalJoin represents a join between two relations.

Constructor & Destructor Documentation

◆ LogicalJoin()

duckdb::LogicalJoin::LogicalJoin ( JoinType type,
LogicalOperatorType logical_type = LogicalOperatorType::LOGICAL_JOIN )
explicit
382641 : LogicalOperator(logical_type), join_type(join_type) {
382642}
JoinType join_type
The type of the join (INNER, OUTER, etc...).
Definition duckdb.cpp:147060

Member Function Documentation

◆ GetTableReferences()

void duckdb::LogicalJoin::GetTableReferences ( LogicalOperator & op,
unordered_set< idx_t > & bindings )
static

Gets the set of table references that are reachable from this node.

382702 {
382703 auto column_bindings = op.GetColumnBindings();
382704 for (auto binding : column_bindings) {
382705 bindings.insert(binding.table_index);
382706 }
382707}
Here is the caller graph for this function:

◆ GetExpressionBindings()

void duckdb::LogicalJoin::GetExpressionBindings ( const Expression & expr,
unordered_set< idx_t > & bindings )
static
382709 {
382710 ExpressionIterator::VisitExpression<BoundColumnRefExpression>(root_expr,
382711 [&](const BoundColumnRefExpression &colref) {
382712 D_ASSERT(colref.depth == 0);
382713 bindings.insert(colref.binding.table_index);
382714 });
382715}

◆ HasProjectionMap()

bool duckdb::LogicalJoin::HasProjectionMap ( ) const
inlineoverridevirtual

Reimplemented from duckdb::LogicalOperator.

147055 {
147056 return !left_projection_map.empty() || !right_projection_map.empty();
147057 }
vector< idx_t > right_projection_map
The columns of the RHS that are output by the join.
Definition duckdb.cpp:147066
vector< idx_t > left_projection_map
The columns of the LHS that are output by the join.
Definition duckdb.cpp:147064

◆ GetColumnBindings()

vector< ColumnBinding > duckdb::LogicalJoin::GetColumnBindings ( )
overridevirtual

Reimplemented from duckdb::LogicalOperator.

382644 {
382645 auto left_bindings = MapBindings(children[0]->GetColumnBindings(), left_projection_map);
382646 if (join_type == JoinType::SEMI || join_type == JoinType::ANTI) {
382647 // for SEMI and ANTI join we only project the left hand side
382648 return left_bindings;
382649 }
382650
382651 if (join_type == JoinType::MARK) {
382652 // for MARK join we project the left hand side plus the MARK column
382653 left_bindings.emplace_back(mark_index, 0);
382654 return left_bindings;
382655 }
382656 // for other join types we project both the LHS and the RHS
382657 auto right_bindings = MapBindings(children[1]->GetColumnBindings(), right_projection_map);
382658 if (join_type == JoinType::RIGHT_SEMI || join_type == JoinType::RIGHT_ANTI) {
382659 return right_bindings;
382660 }
382661 left_bindings.insert(left_bindings.end(), right_bindings.begin(), right_bindings.end());
382662 return left_bindings;
382663}
idx_t mark_index
Table index used to refer to the MARK column (in case of a MARK join).
Definition duckdb.cpp:147062
vector< unique_ptr< LogicalOperator > > children
The set of children of the operator.
Definition duckdb.hpp:21262

◆ GetTableIndex()

vector< idx_t > duckdb::LogicalJoin::GetTableIndex ( ) const
overridevirtual

Returns the set of table indexes of this operator.

Reimplemented from duckdb::LogicalOperator.

382665 {
382666 vector<idx_t> result;
382667 if (join_type == JoinType::MARK) {
382668 result.emplace_back(mark_index);
382669 }
382670 return result;
382671}

◆ GetName()

string duckdb::LogicalJoin::GetName ( ) const
overridevirtual

Reimplemented from duckdb::LogicalOperator.

382673 {
382674#ifdef DEBUG
382675 if (DBConfigOptions::debug_print_bindings && join_type == JoinType::MARK) {
382676 return LogicalOperator::GetName() + StringUtil::Format(" #%llu", mark_index);
382677 }
382678#endif
382679 return LogicalOperator::GetName();
382680}
static string Format(const string fmt_str, ARGS... params)
Format a string using printf semantics.
Definition duckdb.hpp:4002
static bool debug_print_bindings
Whether to print bindings when printing the plan (debug mode only).
Definition duckdb.hpp:40040

◆ ResolveTypes()

void duckdb::LogicalJoin::ResolveTypes ( )
overrideprotectedvirtual

Resolve types for this specific operator.

Implements duckdb::LogicalOperator.

382682 {
382683 types = MapTypes(children[0]->types, left_projection_map);
382684 if (join_type == JoinType::SEMI || join_type == JoinType::ANTI) {
382685 // for SEMI and ANTI join we only project the left hand side
382686 return;
382687 }
382688 if (join_type == JoinType::MARK) {
382689 // for MARK join we project the left hand side, plus a BOOLEAN column indicating the MARK
382690 types.emplace_back(LogicalType::BOOLEAN);
382691 return;
382692 }
382693 // for any other join we project both sides
382694 auto right_types = MapTypes(children[1]->types, right_projection_map);
382695 if (join_type == JoinType::RIGHT_SEMI || join_type == JoinType::RIGHT_ANTI) {
382696 types = right_types;
382697 return;
382698 }
382699 types.insert(types.end(), right_types.begin(), right_types.end());
382700}
vector< LogicalType > types
The types returned by this logical operator. Set by calling LogicalOperator::ResolveTypes.
Definition duckdb.hpp:21266

Member Data Documentation

◆ mark_index

idx_t duckdb::LogicalJoin::mark_index {}

Table index used to refer to the MARK column (in case of a MARK join).

147062{};

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