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

Bind the parsed query tree to the actual columns present in the catalog. More...

Inheritance diagram for duckdb::Binder:
Collaboration diagram for duckdb::Binder:

Public Member Functions

DUCKDB_API BoundStatement Bind (SQLStatement &statement)
 
DUCKDB_API BoundStatement Bind (QueryNode &node)
 
unique_ptr< BoundCreateTableInfoBindCreateTableInfo (unique_ptr< CreateInfo > info)
 
unique_ptr< BoundCreateTableInfoBindCreateTableInfo (unique_ptr< CreateInfo > info, SchemaCatalogEntry &schema)
 
unique_ptr< BoundCreateTableInfoBindCreateTableInfo (unique_ptr< CreateInfo > info, SchemaCatalogEntry &schema, vector< unique_ptr< Expression > > &bound_defaults)
 
vector< unique_ptr< BoundConstraint > > BindConstraints (const vector< unique_ptr< Constraint > > &constraints, const string &table_name, const ColumnList &columns)
 
vector< unique_ptr< BoundConstraint > > BindConstraints (const TableCatalogEntry &table)
 
vector< unique_ptr< BoundConstraint > > BindNewConstraints (vector< unique_ptr< Constraint > > &constraints, const string &table_name, const ColumnList &columns)
 
unique_ptr< BoundConstraintBindConstraint (const Constraint &constraint, const string &table, const ColumnList &columns)
 
unique_ptr< BoundConstraintBindUniqueConstraint (const Constraint &constraint, const string &table, const ColumnList &columns)
 
BoundStatement BindAlterAddIndex (BoundStatement &result, CatalogEntry &entry, unique_ptr< AlterInfo > alter_info)
 
void SetCatalogLookupCallback (catalog_entry_callback_t callback)
 
void BindCreateViewInfo (CreateViewInfo &base)
 
void SearchSchema (CreateInfo &info)
 
SchemaCatalogEntryBindSchema (CreateInfo &info)
 
SchemaCatalogEntryBindCreateFunctionInfo (CreateInfo &info)
 
unique_ptr< BoundPragmaInfoBindPragma (PragmaInfo &info, QueryErrorContext error_context)
 
BoundStatement Bind (TableRef &ref)
 
idx_t GenerateTableIndex ()
 Generates an unused index for a table.
 
optional_ptr< CatalogEntryGetCatalogEntry (const string &catalog, const string &schema, const EntryLookupInfo &lookup_info, OnEntryNotFound on_entry_not_found)
 
optional_ptr< CTEBindingGetCTEBinding (const BindingAlias &name)
 Find all candidate common table expression by name; returns empty vector if none exists.
 
void AddBoundView (ViewCatalogEntry &view)
 Add the view to the set of currently bound views - used for detecting recursive view definitions.
 
void PushExpressionBinder (ExpressionBinder &binder)
 
void PopExpressionBinder ()
 
void SetActiveBinder (ExpressionBinder &binder)
 
ExpressionBinderGetActiveBinder ()
 
bool HasActiveBinder ()
 
vector< reference< ExpressionBinder > > & GetActiveBinders ()
 
void MergeCorrelatedColumns (CorrelatedColumns &other)
 
void AddCorrelatedColumn (const CorrelatedColumnInfo &info)
 Add a correlated column to this binder (if it does not exist)
 
unique_ptr< LogicalOperatorBindUpdateSet (LogicalOperator &op, unique_ptr< LogicalOperator > root, UpdateSetInfo &set_info, TableCatalogEntry &table, vector< PhysicalIndex > &columns, bool prioritize_table_when_binding=false)
 
void BindUpdateSet (idx_t proj_index, unique_ptr< LogicalOperator > &root, UpdateSetInfo &set_info, TableCatalogEntry &table, vector< PhysicalIndex > &columns, vector< unique_ptr< Expression > > &update_expressions, vector< unique_ptr< Expression > > &projection_expressions, bool prioritize_table_when_binding=false)
 
void BindVacuumTable (LogicalVacuum &vacuum, unique_ptr< LogicalOperator > &root)
 
void BindLogicalType (LogicalType &type)
 
optional_ptr< BindingGetMatchingBinding (const string &table_name, const string &column_name, ErrorData &error)
 
optional_ptr< BindingGetMatchingBinding (const string &schema_name, const string &table_name, const string &column_name, ErrorData &error)
 
optional_ptr< BindingGetMatchingBinding (const string &catalog_name, const string &schema_name, const string &table_name, const string &column_name, ErrorData &error)
 
void SetBindingMode (BindingMode mode)
 
BindingMode GetBindingMode ()
 
void AddTableName (string table_name)
 
void AddReplacementScan (const string &table_name, unique_ptr< TableRef > replacement)
 
const unordered_set< string > & GetTableNames ()
 
case_insensitive_map_t< unique_ptr< TableRef > > & GetReplacementScans ()
 
CatalogEntryRetrieverEntryRetriever ()
 
optional_ptr< BoundParameterMapGetParameters ()
 
void SetParameters (BoundParameterMap &parameters)
 
void SetCanContainNulls (bool can_contain_nulls)
 
void SetAlwaysRequireRebind ()
 
StatementPropertiesGetStatementProperties ()
 
unique_ptr< LogicalOperatorUnionOperators (vector< unique_ptr< LogicalOperator > > nodes)
 
void SetSearchPath (Catalog &catalog, const string &schema)
 
- Public Member Functions inherited from duckdb::enable_shared_from_this< Binder >
shared_ptr< Bindershared_from_this ()
 
shared_ptr< Binder constshared_from_this () const
 

Static Public Member Functions

static DUCKDB_API shared_ptr< BinderCreateBinder (ClientContext &context, optional_ptr< Binder > parent=nullptr, BinderType binder_type=BinderType::REGULAR_BINDER)
 
static unique_ptr< BoundCreateTableInfoBindCreateTableCheckpoint (unique_ptr< CreateInfo > info, SchemaCatalogEntry &schema)
 
static vector< unique_ptr< BoundConstraint > > BindConstraints (ClientContext &context, const vector< unique_ptr< Constraint > > &constraints, const string &table_name, const ColumnList &columns)
 
static void BindView (ClientContext &context, const SelectStatement &stmt, const string &catalog_name, const string &schema_name, optional_ptr< LogicalDependencyList > dependencies, const vector< string > &aliases, vector< LogicalType > &result_types, vector< string > &result_names)
 
static void BindNamedParameters (named_parameter_type_map_t &types, named_parameter_map_t &values, QueryErrorContext &error_context, string &func_name)
 Check usage, and cast named parameters to their types.
 
static void BindSchemaOrCatalog (ClientContext &context, string &catalog, string &schema)
 
static optional_ptr< ParsedExpressionGetResolvedColumnExpression (ParsedExpression &root_expr)
 Returns a ColumnRefExpression after it was resolved (i.e. past the STAR expression/USING clauses)
 
static void ReplaceStarExpression (unique_ptr< ParsedExpression > &expr, unique_ptr< ParsedExpression > &replacement)
 
static string ReplaceColumnsAlias (const string &alias, const string &column_name, optional_ptr< duckdb_re2::RE2 > regex)
 

Public Attributes

ClientContextcontext
 The client context.
 
BindContext bind_context
 The bind context.
 
CorrelatedColumns correlated_columns
 
string alias
 The alias for the currently processing subquery, if it exists.
 
optional_ptr< DummyBindingmacro_binding
 Macro parameter bindings (if any)
 
optional_ptr< vector< DummyBinding > > lambda_bindings
 The intermediate lambda bindings to bind nested lambdas (if any)
 
unordered_map< idx_t, LogicalOperator * > recursive_ctes
 

Private Member Functions

idx_t GetBinderDepth () const
 Determine the depth of the binder.
 
void IncreaseDepth ()
 Increase the depth of the binder.
 
void BindGeneratedColumns (BoundCreateTableInfo &info)
 Bind the expressions of generated columns to check for errors.
 
void BindDefaultValues (const ColumnList &columns, vector< unique_ptr< Expression > > &bound_defaults, const string &catalog="", const string &schema="")
 Bind the default values of the columns of a table.
 
BoundLimitNode BindLimitValue (OrderBinder &order_binder, unique_ptr< ParsedExpression > limit_val, bool is_percentage, bool is_offset)
 Bind a limit value (LIMIT or OFFSET)
 
void MoveCorrelatedExpressions (Binder &other)
 Move correlated expressions from the child binder to this binder.
 
BoundStatement BindWithReplacementScan (ClientContext &context, BaseTableRef &ref)
 Tries to bind the table name with replacement scans.
 
template<class T >
BoundStatement BindWithCTE (T &statement)
 
BoundStatement Bind (SelectStatement &stmt)
 
BoundStatement Bind (InsertStatement &stmt)
 
BoundStatement Bind (CopyStatement &stmt, CopyToType copy_to_type)
 
BoundStatement Bind (DeleteStatement &stmt)
 
BoundStatement Bind (UpdateStatement &stmt)
 
BoundStatement Bind (CreateStatement &stmt)
 
BoundStatement Bind (DropStatement &stmt)
 
BoundStatement Bind (AlterStatement &stmt)
 
BoundStatement Bind (PrepareStatement &stmt)
 
BoundStatement Bind (ExecuteStatement &stmt)
 
BoundStatement Bind (TransactionStatement &stmt)
 
BoundStatement Bind (PragmaStatement &stmt)
 
BoundStatement Bind (ExplainStatement &stmt)
 
BoundStatement Bind (VacuumStatement &stmt)
 
BoundStatement Bind (RelationStatement &stmt)
 
BoundStatement Bind (CallStatement &stmt)
 
BoundStatement Bind (ExportStatement &stmt)
 
BoundStatement Bind (ExtensionStatement &stmt)
 
BoundStatement Bind (SetStatement &stmt)
 
BoundStatement Bind (SetVariableStatement &stmt)
 
BoundStatement Bind (ResetVariableStatement &stmt)
 
BoundStatement Bind (LoadStatement &stmt)
 
BoundStatement Bind (LogicalPlanStatement &stmt)
 
BoundStatement Bind (AttachStatement &stmt)
 
BoundStatement Bind (DetachStatement &stmt)
 
BoundStatement Bind (CopyDatabaseStatement &stmt)
 
BoundStatement Bind (UpdateExtensionsStatement &stmt)
 
BoundStatement Bind (MergeIntoStatement &stmt)
 
void BindRowIdColumns (TableCatalogEntry &table, LogicalGet &get, vector< unique_ptr< Expression > > &expressions)
 
BoundStatement BindReturning (vector< unique_ptr< ParsedExpression > > returning_list, TableCatalogEntry &table, const string &alias, idx_t update_table_index, unique_ptr< LogicalOperator > child_operator, virtual_column_map_t virtual_columns=virtual_column_map_t())
 
unique_ptr< QueryNodeBindTableMacro (FunctionExpression &function, TableMacroCatalogEntry &macro_func, idx_t depth)
 
BoundStatement BindCTE (const string &ctename, CommonTableExpressionInfo &info)
 
BoundStatement BindNode (SelectNode &node)
 
BoundStatement BindNode (SetOperationNode &node)
 
BoundStatement BindNode (RecursiveCTENode &node)
 
BoundStatement BindNode (QueryNode &node)
 
BoundStatement BindNode (StatementNode &node)
 
unique_ptr< LogicalOperatorVisitQueryNode (BoundQueryNode &node, unique_ptr< LogicalOperator > root)
 
unique_ptr< LogicalOperatorCreatePlan (BoundSelectNode &statement)
 
unique_ptr< LogicalOperatorCreatePlan (BoundSetOperationNode &node)
 
unique_ptr< LogicalOperatorCreatePlan (BoundQueryNode &node)
 
void BuildUnionByNameInfo (BoundSetOperationNode &result)
 
BoundStatement BindJoin (Binder &parent, TableRef &ref)
 
BoundStatement Bind (BaseTableRef &ref)
 
BoundStatement Bind (BoundRefWrapper &ref)
 
BoundStatement Bind (JoinRef &ref)
 
BoundStatement Bind (SubqueryRef &ref)
 
BoundStatement Bind (TableFunctionRef &ref)
 
BoundStatement Bind (EmptyTableRef &ref)
 
BoundStatement Bind (DelimGetRef &ref)
 
BoundStatement Bind (ExpressionListRef &ref)
 
BoundStatement Bind (ColumnDataRef &ref)
 
BoundStatement Bind (PivotRef &expr)
 
BoundStatement Bind (ShowRef &ref)
 
unique_ptr< SelectNodeBindPivot (PivotRef &expr, vector< unique_ptr< ParsedExpression > > all_columns)
 
unique_ptr< SelectNodeBindUnpivot (Binder &child_binder, PivotRef &expr, vector< unique_ptr< ParsedExpression > > all_columns, unique_ptr< ParsedExpression > &where_clause)
 
BoundStatement BindBoundPivot (PivotRef &expr)
 
void ExtractUnpivotEntries (Binder &child_binder, PivotColumnEntry &entry, vector< UnpivotEntry > &unpivot_entries)
 
void ExtractUnpivotColumnName (ParsedExpression &expr, vector< string > &result)
 
unique_ptr< BoundAtClauseBindAtClause (optional_ptr< AtClause > at_clause)
 
bool BindTableFunctionParameters (TableFunctionCatalogEntry &table_function, vector< unique_ptr< ParsedExpression > > &expressions, vector< LogicalType > &arguments, vector< Value > &parameters, named_parameter_map_t &named_parameters, BoundStatement &subquery, ErrorData &error)
 
void BindTableInTableOutFunction (vector< unique_ptr< ParsedExpression > > &expressions, BoundStatement &subquery)
 
BoundStatement BindTableFunction (TableFunction &function, vector< Value > parameters)
 
BoundStatement BindTableFunctionInternal (TableFunction &table_function, const TableFunctionRef &ref, vector< Value > parameters, named_parameter_map_t named_parameters, vector< LogicalType > input_table_types, vector< string > input_table_names)
 
unique_ptr< LogicalOperatorCreatePlan (BoundJoinRef &ref)
 
BoundStatement BindCopyTo (CopyStatement &stmt, const CopyFunction &function, CopyToType copy_to_type)
 
BoundStatement BindCopyFrom (CopyStatement &stmt, const CopyFunction &function)
 
void BindCopyOptions (CopyInfo &info)
 
case_insensitive_map_t< CopyOptionGetFullCopyOptionsList (const CopyFunction &function, CopyOptionMode mode)
 
void PrepareModifiers (OrderBinder &order_binder, QueryNode &statement, BoundQueryNode &result)
 
void BindModifiers (BoundQueryNode &result, idx_t table_index, const vector< string > &names, const vector< LogicalType > &sql_types, const SelectBindState &bind_state)
 
unique_ptr< BoundResultModifierBindLimit (OrderBinder &order_binder, LimitModifier &limit_mod)
 
unique_ptr< BoundResultModifierBindLimitPercent (OrderBinder &order_binder, LimitPercentModifier &limit_mod)
 
unique_ptr< ExpressionBindOrderExpression (OrderBinder &order_binder, unique_ptr< ParsedExpression > expr)
 
unique_ptr< LogicalOperatorPlanFilter (unique_ptr< Expression > condition, unique_ptr< LogicalOperator > root)
 
void PlanSubqueries (unique_ptr< Expression > &expr, unique_ptr< LogicalOperator > &root)
 
unique_ptr< ExpressionPlanSubquery (BoundSubqueryExpression &expr, unique_ptr< LogicalOperator > &root)
 
unique_ptr< LogicalOperatorPlanLateralJoin (unique_ptr< LogicalOperator > left, unique_ptr< LogicalOperator > right, CorrelatedColumns &correlated_columns, JoinType join_type=JoinType::INNER, unique_ptr< Expression > condition=nullptr)
 
unique_ptr< LogicalOperatorCastLogicalOperatorToTypes (const vector< LogicalType > &source_types, const vector< LogicalType > &target_types, unique_ptr< LogicalOperator > op)
 
BindingAlias FindBinding (const string &using_column, const string &join_side)
 
bool TryFindBinding (const string &using_column, const string &join_side, BindingAlias &result)
 
void AddUsingBindingSet (unique_ptr< UsingColumnSet > set)
 
BindingAlias RetrieveUsingBinding (Binder &current_binder, optional_ptr< UsingColumnSet > current_set, const string &column_name, const string &join_side)
 
void ExpandStarExpressions (vector< unique_ptr< ParsedExpression > > &select_list, vector< unique_ptr< ParsedExpression > > &new_select_list)
 
void ExpandStarExpression (unique_ptr< ParsedExpression > expr, vector< unique_ptr< ParsedExpression > > &new_select_list)
 
StarExpressionType FindStarExpression (unique_ptr< ParsedExpression > &expr, StarExpression **star, bool is_root, bool in_columns)
 
void ReplaceUnpackedStarExpression (unique_ptr< ParsedExpression > &expr, vector< unique_ptr< ParsedExpression > > &replacements, StarExpression &star, optional_ptr< duckdb_re2::RE2 > regex)
 
void BindWhereStarExpression (unique_ptr< ParsedExpression > &expr)
 
void BindSchemaOrCatalog (string &catalog_name, string &schema_name)
 If only a schema name is provided (e.g. "a.b") then figure out if "a" is a schema or a catalog name.
 
const string BindCatalog (string &catalog_name)
 
SchemaCatalogEntryBindCreateSchema (CreateInfo &info)
 
vector< CatalogSearchEntryGetSearchPath (Catalog &catalog, const string &schema_name)
 
LogicalType BindLogicalTypeInternal (const unique_ptr< ParsedExpression > &type_expr)
 
BoundStatement BindSelectNode (SelectNode &statement, BoundStatement from_table)
 
unique_ptr< LogicalOperatorBindCopyDatabaseSchema (Catalog &source_catalog, const string &target_database_name)
 
unique_ptr< LogicalOperatorBindCopyDatabaseData (Catalog &source_catalog, const string &target_database_name)
 
BoundStatement BindShowQuery (ShowRef &ref)
 
BoundStatement BindShowTable (ShowRef &ref)
 
BoundStatement BindSummarize (ShowRef &ref)
 
void BindInsertColumnList (TableCatalogEntry &table, vector< string > &columns, bool default_values, vector< LogicalIndex > &named_column_map, vector< LogicalType > &expected_types, IndexVector< idx_t, PhysicalIndex > &column_index_map)
 
void TryReplaceDefaultExpression (unique_ptr< ParsedExpression > &expr, const ColumnDefinition &column)
 
void ExpandDefaultInValuesList (InsertStatement &stmt, TableCatalogEntry &table, optional_ptr< ExpressionListRef > values_list, const vector< LogicalIndex > &named_column_map)
 
unique_ptr< BoundMergeIntoActionBindMergeAction (LogicalMergeInto &merge_into, TableCatalogEntry &table, LogicalGet &get, idx_t proj_index, vector< unique_ptr< Expression > > &expressions, unique_ptr< LogicalOperator > &root, MergeIntoAction &action, const vector< BindingAlias > &source_aliases, const vector< string > &source_names)
 
unique_ptr< MergeIntoStatementGenerateMergeInto (InsertStatement &stmt, TableCatalogEntry &table)
 
BoundCTEData PrepareCTE (const string &ctename, CommonTableExpressionInfo &statement)
 
BoundStatement FinishCTE (BoundCTEData &bound_cte, BoundStatement child_data)
 
shared_ptr< BinderCreateBinderWithSearchPath (const string &catalog_name, const string &schema_name)
 
 Binder (ClientContext &context, shared_ptr< Binder > parent, BinderType binder_type)
 

Static Private Member Functions

static void BindSchemaOrCatalog (CatalogEntryRetriever &retriever, string &catalog, string &schema)
 
static void CheckInsertColumnCountMismatch (idx_t expected_columns, idx_t result_columns, bool columns_provided, const string &tname)
 

Private Attributes

shared_ptr< Binderparent
 The parent binder (if any)
 
BinderType binder_type = BinderType::REGULAR_BINDER
 What kind of node we are binding using this binder.
 
shared_ptr< GlobalBinderStateglobal_binder_state
 Global binder state.
 
shared_ptr< QueryBinderStatequery_binder_state
 Query binder state.
 
bool has_unplanned_dependent_joins = false
 Whether or not the binder has any unplanned dependent joins that still need to be planned/flattened.
 
bool is_outside_flattened = true
 Whether or not outside dependent joins have been planned and flattened.
 
bool can_contain_nulls = false
 Whether or not the binder can contain NULLs as the root of expressions.
 
reference_set_t< ViewCatalogEntrybound_views
 The set of bound views.
 
CatalogEntryRetriever entry_retriever
 Used to retrieve CatalogEntry's.
 
idx_t unnamed_subquery_index = 1
 Unnamed subquery index.
 
idx_t depth
 Binder depth.
 

Friends

class ExpressionBinder
 
class RecursiveDependentJoinPlanner
 

Additional Inherited Members

- Protected Member Functions inherited from duckdb::enable_shared_from_this< Binder >
 enable_shared_from_this (enable_shared_from_this const &) noexcept
 
enable_shared_from_thisoperator= (enable_shared_from_this const &) noexcept
 

Detailed Description

Bind the parsed query tree to the actual columns present in the catalog.

The binder is responsible for binding tables and columns to actual physical tables and columns in the catalog. In the process, it also resolves types of all expressions.

Member Function Documentation

◆ EntryRetriever()

CatalogEntryRetriever & duckdb::Binder::EntryRetriever ( )
inline
2079 {
2080 return entry_retriever;
2081 }
CatalogEntryRetriever entry_retriever
Used to retrieve CatalogEntry's.
Definition duckdb.cpp:2117

Member Data Documentation

◆ correlated_columns

CorrelatedColumns duckdb::Binder::correlated_columns

The set of correlated columns bound by this binder (FIXME: this should probably be an unordered_set and not a vector)


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