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

Public Member Functions

 BindContext (Binder &binder)
 
optional_ptr< BindingGetMatchingBinding (const string &column_name, QueryErrorContext context=QueryErrorContext())
 
vector< reference< Binding > > GetMatchingBindings (const string &column_name)
 
vector< string > GetSimilarBindings (const string &column_name)
 
optional_ptr< CTEBindingGetCTEBinding (const BindingAlias &ctename)
 
BindResult BindColumn (ColumnRefExpression &colref, idx_t depth)
 
string BindColumn (PositionalReferenceExpression &ref, string &table_name, string &column_name)
 
unique_ptr< ColumnRefExpressionPositionToColumn (PositionalReferenceExpression &ref)
 
unique_ptr< ParsedExpressionExpandGeneratedColumn (TableBinding &table_binding, const string &column_name)
 
unique_ptr< ParsedExpressionCreateColumnReference (const string &table_name, const string &column_name, ColumnBindType bind_type=ColumnBindType::EXPAND_GENERATED_COLUMNS)
 
unique_ptr< ParsedExpressionCreateColumnReference (const string &schema_name, const string &table_name, const string &column_name, ColumnBindType bind_type=ColumnBindType::EXPAND_GENERATED_COLUMNS)
 
unique_ptr< ParsedExpressionCreateColumnReference (const string &catalog_name, const string &schema_name, const string &table_name, const string &column_name, ColumnBindType bind_type=ColumnBindType::EXPAND_GENERATED_COLUMNS)
 
unique_ptr< ParsedExpressionCreateColumnReference (const BindingAlias &table_alias, const string &column_name, ColumnBindType bind_type=ColumnBindType::EXPAND_GENERATED_COLUMNS)
 
void GenerateAllColumnExpressions (StarExpression &expr, vector< unique_ptr< ParsedExpression > > &new_select_list)
 
const vector< unique_ptr< Binding > > & GetBindingsList ()
 
vector< BindingAliasGetBindingAliases ()
 
void GetTypesAndNames (vector< string > &result_names, vector< LogicalType > &result_types)
 
void AddBaseTable (idx_t index, const string &alias, const vector< string > &names, const vector< LogicalType > &types, vector< ColumnIndex > &bound_column_ids, TableCatalogEntry &entry, bool add_row_id=true)
 Adds a base table with the given alias to the BindContext.
 
void AddBaseTable (idx_t index, const string &alias, const vector< string > &names, const vector< LogicalType > &types, vector< ColumnIndex > &bound_column_ids, const string &table_name)
 
void AddBaseTable (idx_t index, const string &alias, const vector< string > &names, const vector< LogicalType > &types, vector< ColumnIndex > &bound_column_ids, TableCatalogEntry &entry, virtual_column_map_t virtual_columns)
 
void AddTableFunction (idx_t index, const string &alias, const vector< string > &names, const vector< LogicalType > &types, vector< ColumnIndex > &bound_column_ids, optional_ptr< StandardEntry > entry, virtual_column_map_t virtual_columns)
 Adds a call to a table function with the given alias to the BindContext.
 
void AddView (idx_t index, const string &alias, SubqueryRef &ref, BoundStatement &subquery, ViewCatalogEntry &view)
 Adds a table view with a given alias to the BindContext.
 
void AddSubquery (idx_t index, const string &alias, SubqueryRef &ref, BoundStatement &subquery)
 Adds a subquery with a given alias to the BindContext.
 
void AddSubquery (idx_t index, const string &alias, TableFunctionRef &ref, BoundStatement &subquery)
 Adds a subquery with a given alias to the BindContext.
 
void AddEntryBinding (idx_t index, const string &alias, const vector< string > &names, const vector< LogicalType > &types, StandardEntry &entry)
 Adds a binding to a catalog entry with a given alias to the BindContext.
 
void AddGenericBinding (idx_t index, const string &alias, const vector< string > &names, const vector< LogicalType > &types)
 Adds a base table with the given alias to the BindContext.
 
void AddCTEBinding (idx_t index, BindingAlias alias, const vector< string > &names, const vector< LogicalType > &types, CTEType cte_type=CTEType::CAN_BE_REFERENCED)
 
void AddCTEBinding (unique_ptr< CTEBinding > binding)
 
void AddUsingBinding (const string &column_name, UsingColumnSet &set)
 Add an implicit join condition (e.g. USING (x))
 
void AddUsingBindingSet (unique_ptr< UsingColumnSet > set)
 
optional_ptr< UsingColumnSetGetUsingBinding (const string &column_name)
 
optional_ptr< UsingColumnSetGetUsingBinding (const string &column_name, const BindingAlias &binding)
 Returns any using column set for the given column name, or nullptr if there is none.
 
void RemoveUsingBinding (const string &column_name, UsingColumnSet &set)
 Erase a using binding from the set of using bindings.
 
void TransferUsingBinding (BindContext &current_context, optional_ptr< UsingColumnSet > current_set, UsingColumnSet &new_set, const string &using_column)
 Transfer a using binding from one bind context to this bind context.
 
string GetActualColumnName (const BindingAlias &binding_alias, const string &column_name)
 
string GetActualColumnName (Binding &binding, const string &column_name)
 
void AddContext (BindContext other)
 Add all the bindings from a BindContext to this BindContext. The other BindContext is destroyed in the process.
 
void RemoveContext (const vector< BindingAlias > &aliases)
 For semi and anti joins we remove the binding context of the right table after binding the condition.
 
optional_ptr< BindingGetBinding (const string &name, ErrorData &out_error)
 
optional_ptr< BindingGetBinding (const BindingAlias &alias, ErrorData &out_error)
 
optional_ptr< BindingGetBinding (const BindingAlias &alias, const string &column_name, ErrorData &out_error)
 
vector< reference< Binding > > GetBindings (const BindingAlias &alias, ErrorData &out_error)
 Get all bindings that match a specific binding alias - returns an error if none match.
 

Static Public Member Functions

static vector< string > AliasColumnNames (const string &table_name, const vector< string > &names, const vector< string > &column_aliases)
 

Private Member Functions

void AddBinding (unique_ptr< Binding > binding)
 

Static Private Member Functions

static string AmbiguityException (const BindingAlias &alias, const vector< reference< Binding > > &bindings)
 

Private Attributes

Binderbinder
 
vector< unique_ptr< Binding > > bindings_list
 The list of bindings in insertion order.
 
case_insensitive_map_t< reference_set_t< UsingColumnSet > > using_columns
 The set of columns used in USING join conditions.
 
vector< unique_ptr< CTEBinding > > cte_bindings
 The set of CTE bindings.
 

Detailed Description

The BindContext object keeps track of all the tables and columns that are encountered during the binding process.

Member Function Documentation

◆ GetMatchingBinding()

optional_ptr< Binding > duckdb::BindContext::GetMatchingBinding ( const string &  column_name,
QueryErrorContext  context = QueryErrorContext() 
)

Given a column name, find the matching table it belongs to. Throws an exception if no table has a column of the given name.

◆ GetMatchingBindings()

vector< reference< Binding > > duckdb::BindContext::GetMatchingBindings ( const string &  column_name)

Like GetMatchingBinding, but instead of throwing an error if multiple tables have the same binding it will return a list of all the matching ones

◆ GetSimilarBindings()

vector< string > duckdb::BindContext::GetSimilarBindings ( const string &  column_name)

Like GetMatchingBindings, but returns the top 3 most similar bindings (in levenshtein distance) instead of the matching ones

◆ BindColumn()

BindResult duckdb::BindContext::BindColumn ( ColumnRefExpression colref,
idx_t  depth 
)

Binds a column expression to the base table. Returns the bound expression or throws an exception if the column could not be bound.

◆ GenerateAllColumnExpressions()

void duckdb::BindContext::GenerateAllColumnExpressions ( StarExpression expr,
vector< unique_ptr< ParsedExpression > > &  new_select_list 
)

Generate column expressions for all columns that are present in the referenced tables. This is used to resolve the * expression in a selection list.

◆ GetBindingsList()

const vector< unique_ptr< Binding > > & duckdb::BindContext::GetBindingsList ( )
inline
1527 {
1528 return bindings_list;
1529 }
vector< unique_ptr< Binding > > bindings_list
The list of bindings in insertion order.
Definition duckdb.cpp:1615

◆ AddCTEBinding()

void duckdb::BindContext::AddCTEBinding ( idx_t  index,
BindingAlias  alias,
const vector< string > &  names,
const vector< LogicalType > &  types,
CTEType  cte_type = CTEType::CAN_BE_REFERENCED 
)

Adds a base table with the given alias to the CTE BindContext. We need this to correctly bind recursive CTEs with multiple references.

◆ GetUsingBinding()

optional_ptr< UsingColumnSet > duckdb::BindContext::GetUsingBinding ( const string &  column_name)

Returns any using column set for the given column name, or nullptr if there is none. On conflict (multiple using column sets with the same name) throw an exception.

◆ GetActualColumnName()

string duckdb::BindContext::GetActualColumnName ( const BindingAlias binding_alias,
const string &  column_name 
)

Fetch the actual column name from the given binding, or throws if none exists This can be different from "column_name" because of case insensitivity (e.g. "column_name" might return "COLUMN_NAME")

◆ AliasColumnNames()

static vector< string > duckdb::BindContext::AliasColumnNames ( const string &  table_name,
const vector< string > &  names,
const vector< string > &  column_aliases 
)
static

Alias a set of column names for the specified table, using the original names if there are not enough aliases specified.

◆ GetBinding()

optional_ptr< Binding > duckdb::BindContext::GetBinding ( const string &  name,
ErrorData out_error 
)

Gets a binding of the specified name. Returns a nullptr and sets the out_error if the binding could not be found.


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