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

The LATERAL binder is responsible for binding an expression within a LATERAL join. More...

Inheritance diagram for duckdb::LateralBinder:
Collaboration diagram for duckdb::LateralBinder:

Public Member Functions

 LateralBinder (Binder &binder, ClientContext &context)
bool HasCorrelatedColumns () const
Public Member Functions inherited from duckdb::ExpressionBinder
 ExpressionBinder (Binder &binder, ClientContext &context, bool replace_binder=false)
virtual bool TryResolveAliasReference (ColumnRefExpression &colref, idx_t depth, bool root_expression, BindResult &result, unique_ptr< ParsedExpression > &expr_ptr)
virtual bool DoesColumnAliasExist (const ColumnRefExpression &colref)
unique_ptr< Expression > Bind (unique_ptr< ParsedExpression > &expr, optional_ptr< LogicalType > result_type=nullptr, bool root_expression=true)
bool HasBoundColumns ()
 Returns whether or not any columns have been bound by the expression binder.
const vector< BoundColumnReferenceInfo > & GetBoundColumns ()
void SetCatalogLookupCallback (catalog_entry_callback_t callback)
ErrorData Bind (unique_ptr< ParsedExpression > &expr, idx_t depth, bool root_expression=false)
unique_ptr< ParsedExpression > CreateStructExtract (unique_ptr< ParsedExpression > base, const string &field_name)
 Returns the STRUCT_EXTRACT operator expression.
unique_ptr< ParsedExpression > CreateStructPack (ColumnRefExpression &col_ref)
 Returns a STRUCT_PACK function expression.
BindResult BindQualifiedColumnName (ColumnRefExpression &colref, const string &table_name)
unique_ptr< ParsedExpression > QualifyColumnName (const ParsedExpression &expr, const string &column_name, ErrorData &error)
 Returns a qualified column reference from a column name.
unique_ptr< ParsedExpression > QualifyColumnNameWithManyDots (ColumnRefExpression &col_ref, ErrorData &error)
 Returns a qualified column reference from a column reference with column_names.size() > 2.
virtual unique_ptr< ParsedExpression > QualifyColumnName (ColumnRefExpression &col_ref, ErrorData &error)
 Returns a qualified column reference from a column reference.
void QualifyColumnNamesInLambda (FunctionExpression &function, vector< unordered_set< string > > &lambda_params)
 Enables special-handling of lambda parameters by tracking them in the lambda_params vector.
void QualifyColumnNames (unique_ptr< ParsedExpression > &expr, vector< unordered_set< string > > &lambda_params, const bool within_function_expression=false)
BindResult BindCorrelatedColumns (unique_ptr< ParsedExpression > &expr, ErrorData error_message)
void BindChild (unique_ptr< ParsedExpression > &expr, idx_t depth, ErrorData &error)
void ReplaceMacroParameters (unique_ptr< ParsedExpression > &expr, vector< unordered_set< string > > &lambda_params)
void ReplaceMacroParametersInLambda (FunctionExpression &function, vector< unordered_set< string > > &lambda_params)

Static Public Member Functions

static void ReduceExpressionDepth (LogicalOperator &op, const CorrelatedColumns &info)
Static Public Member Functions inherited from duckdb::ExpressionBinder
static bool IsPotentialAlias (const ColumnRefExpression &colref)
static void QualifyColumnNames (Binder &binder, unique_ptr< ParsedExpression > &expr)
 Entry point for qualifying the column references of the expression.
static void QualifyColumnNames (ExpressionBinder &binder, unique_ptr< ParsedExpression > &expr)
static bool PushCollation (ClientContext &context, unique_ptr< Expression > &source, const LogicalType &sql_type, CollationType type=CollationType::ALL_COLLATIONS)
static void TestCollation (ClientContext &context, const string &collation)
static void ExtractCorrelatedExpressions (Binder &binder, Expression &expr)
static bool ContainsNullType (const LogicalType &type)
static LogicalType ExchangeNullType (const LogicalType &type)
static bool ContainsType (const LogicalType &type, LogicalTypeId target)
static LogicalType ExchangeType (const LogicalType &type, LogicalTypeId target, LogicalType new_type)
static LogicalType GetExpressionReturnType (const Expression &expr)
static bool IsUnnestFunction (const string &function_name)
 Returns true if the function name is an alias for the UNNEST function.

Protected Member Functions

BindResult BindExpression (unique_ptr< ParsedExpression > &expr_ptr, idx_t depth, bool root_expression=false) override
string UnsupportedAggregateMessage () override
Protected Member Functions inherited from duckdb::ExpressionBinder
BindResult BindExpression (BetweenExpression &expr, idx_t depth)
BindResult BindExpression (CaseExpression &expr, idx_t depth)
BindResult BindExpression (CollateExpression &expr, idx_t depth)
BindResult BindExpression (CastExpression &expr, idx_t depth)
BindResult BindExpression (ColumnRefExpression &expr, idx_t depth, bool root_expression, unique_ptr< ParsedExpression > &expr_ptr)
BindResult BindExpression (LambdaRefExpression &expr, idx_t depth)
BindResult BindExpression (ComparisonExpression &expr, idx_t depth)
BindResult BindExpression (ConjunctionExpression &expr, idx_t depth)
BindResult BindExpression (ConstantExpression &expr, idx_t depth)
BindResult BindExpression (FunctionExpression &expr, idx_t depth, unique_ptr< ParsedExpression > &expr_ptr)
BindResult BindExpression (TypeExpression &expr, idx_t depth)
BindResult BindExpression (LambdaExpression &expr, idx_t depth, const vector< LogicalType > &function_child_types, optional_ptr< bind_lambda_function_t > bind_lambda_function)
BindResult BindExpression (OperatorExpression &expr, idx_t depth)
BindResult BindExpression (ParameterExpression &expr, idx_t depth)
BindResult BindExpression (SubqueryExpression &expr, idx_t depth)
BindResult BindPositionalReference (unique_ptr< ParsedExpression > &expr, idx_t depth, bool root_expression)
void TransformCapturedLambdaColumn (unique_ptr< Expression > &original, unique_ptr< Expression > &replacement, BoundLambdaExpression &bound_lambda_expr, const optional_ptr< bind_lambda_function_t > bind_lambda_function, const vector< LogicalType > &function_child_types)
void CaptureLambdaColumns (BoundLambdaExpression &bound_lambda_expr, unique_ptr< Expression > &expr, const optional_ptr< bind_lambda_function_t > bind_lambda_function, const vector< LogicalType > &function_child_types)
virtual unique_ptr< ParsedExpression > GetSQLValueFunction (const string &column_name)
LogicalType ResolveOperatorType (OperatorExpression &op, vector< unique_ptr< Expression > > &children)
LogicalType ResolveCoalesceType (OperatorExpression &op, vector< unique_ptr< Expression > > &children)
LogicalType ResolveNotType (OperatorExpression &op, vector< unique_ptr< Expression > > &children)
BindResult BindUnsupportedExpression (ParsedExpression &expr, idx_t depth, const string &message)
optional_ptr< CatalogEntry > BindAndQualifyFunction (FunctionExpression &function, bool allow_throw)
virtual BindResult BindGroupingFunction (OperatorExpression &op, idx_t depth)
virtual BindResult BindFunction (FunctionExpression &expr, ScalarFunctionCatalogEntry &function, idx_t depth)
virtual BindResult BindLambdaFunction (FunctionExpression &expr, ScalarFunctionCatalogEntry &function, idx_t depth)
virtual BindResult BindAggregate (FunctionExpression &expr, AggregateFunctionCatalogEntry &function, idx_t depth)
virtual BindResult BindUnnest (FunctionExpression &expr, idx_t depth, bool root_expression)
virtual BindResult BindMacro (FunctionExpression &expr, ScalarMacroCatalogEntry &macro, idx_t depth, unique_ptr< ParsedExpression > &expr_ptr)
void UnfoldMacroExpression (FunctionExpression &function, ScalarMacroCatalogEntry &macro_func, unique_ptr< ParsedExpression > &expr, idx_t depth)
virtual string UnsupportedUnnestMessage ()
optional_ptr< CatalogEntry > GetCatalogEntry (const string &catalog, const string &schema, const EntryLookupInfo &lookup_info, OnEntryNotFound on_entry_not_found)
BindResult TryBindLambdaOrJson (FunctionExpression &function, idx_t depth, CatalogEntry &func, const LambdaSyntaxType syntax_type)
unique_ptr< ParsedExpression > QualifyColumnNameWithManyDotsInternal (ColumnRefExpression &col_ref, ErrorData &error, idx_t &struct_extract_start)
virtual void ThrowIfUnnestInLambda (const ColumnBinding &column_binding)

Private Member Functions

BindResult BindColumnRef (unique_ptr< ParsedExpression > &expr_ptr, idx_t depth, bool root_expression)
void ExtractCorrelatedColumns (Expression &expr)

Private Attributes

CorrelatedColumns correlated_columns

Additional Inherited Members

Public Attributes inherited from duckdb::ExpressionBinder
LogicalType target_type
optional_ptr< DummyBinding > macro_binding
optional_ptr< vector< DummyBinding > > lambda_bindings
Protected Attributes inherited from duckdb::ExpressionBinder
Binder & binder
ClientContext & context
optional_ptr< ExpressionBinder > stored_binder
vector< BoundColumnReferenceInfo > bound_columns

Detailed Description

The LATERAL binder is responsible for binding an expression within a LATERAL join.

Constructor & Destructor Documentation

◆ LateralBinder()

duckdb::LateralBinder::LateralBinder ( Binder & binder,
ClientContext & context )
377985 : ExpressionBinder(binder, context) {
377986}

Member Function Documentation

◆ HasCorrelatedColumns()

bool duckdb::LateralBinder::HasCorrelatedColumns ( ) const
inline
371730 {
371731 return !correlated_columns.empty();
371732 }

◆ ReduceExpressionDepth()

void duckdb::LateralBinder::ReduceExpressionDepth ( LogicalOperator & op,
const CorrelatedColumns & info )
static
378111 {
378112 ExpressionDepthReducer depth_reducer(correlated);
378113 depth_reducer.VisitOperator(op);
378114}

◆ BindExpression()

BindResult duckdb::LateralBinder::BindExpression ( unique_ptr< ParsedExpression > & expr_ptr,
idx_t depth,
bool root_expression = false )
overrideprotectedvirtual

Bind the given expression. Unlike Bind(), this does not mute the given ParsedExpression. Exposed to be used from sub-binders that aren't subclasses of ExpressionBinder.

Reimplemented from duckdb::ExpressionBinder.

378014 {
378015 auto &expr = *expr_ptr;
378016 switch (expr.GetExpressionClass()) {
378017 case ExpressionClass::DEFAULT:
378018 return BindUnsupportedExpression(expr, depth, "LATERAL join cannot contain DEFAULT clause!");
378019 case ExpressionClass::WINDOW:
378020 return BindResult("LATERAL join cannot contain window functions!");
378021 case ExpressionClass::COLUMN_REF:
378022 return BindColumnRef(expr_ptr, depth, root_expression);
378023 default:
378024 return ExpressionBinder::BindExpression(expr_ptr, depth);
378025 }
378026}
virtual BindResult BindExpression(unique_ptr< ParsedExpression > &expr_ptr, idx_t depth, bool root_expression=false)
Definition duckdb.cpp:378842
Here is the call graph for this function:

◆ UnsupportedAggregateMessage()

string duckdb::LateralBinder::UnsupportedAggregateMessage ( )
overrideprotectedvirtual

Reimplemented from duckdb::ExpressionBinder.

378028 {
378029 return "LATERAL join cannot contain aggregates!";
378030}

◆ BindColumnRef()

BindResult duckdb::LateralBinder::BindColumnRef ( unique_ptr< ParsedExpression > & expr_ptr,
idx_t depth,
bool root_expression )
private
378002 {
378003 if (depth == 0) {
378004 throw InternalException("Lateral binder can only bind correlated columns");
378005 }
378006 auto result = ExpressionBinder::BindExpression(expr_ptr, depth);
378007 if (result.HasError()) {
378008 return result;
378009 }
378010 ExtractCorrelatedColumns(*result.expression);
378011 return result;
378012}

◆ ExtractCorrelatedColumns()

void duckdb::LateralBinder::ExtractCorrelatedColumns ( Expression & expr)
private
377988 {
377989 if (expr.GetExpressionType() == ExpressionType::BOUND_COLUMN_REF) {
377990 auto &bound_colref = expr.Cast<BoundColumnRefExpression>();
377991 if (bound_colref.depth > 0) {
377992 // add the correlated column info
377993 CorrelatedColumnInfo info(bound_colref);
377994 if (std::find(correlated_columns.begin(), correlated_columns.end(), info) == correlated_columns.end()) {
377995 correlated_columns.AddColumn(std::move(info)); // TODO is adding to the front OK here?
377996 }
377997 }
377998 }
377999 ExpressionIterator::EnumerateChildren(expr, [&](Expression &child) { ExtractCorrelatedColumns(child); });
378000}

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