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

A helper binder for WhereBinder and HavingBinder which support alias as a columnref. More...

Collaboration diagram for duckdb::ColumnAliasBinder:

Public Member Functions

 ColumnAliasBinder (SelectBindState &bind_state)
bool BindAlias (ExpressionBinder &enclosing_binder, unique_ptr< ParsedExpression > &expr_ptr, idx_t depth, bool root_expression, BindResult &result)
bool DoesColumnAliasExist (const ColumnRefExpression &colref)

Private Attributes

SelectBindState & bind_state
unordered_set< idx_t > visited_select_indexes

Detailed Description

A helper binder for WhereBinder and HavingBinder which support alias as a columnref.

Constructor & Destructor Documentation

◆ ColumnAliasBinder()

duckdb::ColumnAliasBinder::ColumnAliasBinder ( SelectBindState & bind_state)
explicit
377535 : bind_state(bind_state), visited_select_indexes() {
377536}

Member Function Documentation

◆ BindAlias()

bool duckdb::ColumnAliasBinder::BindAlias ( ExpressionBinder & enclosing_binder,
unique_ptr< ParsedExpression > & expr_ptr,
idx_t depth,
bool root_expression,
BindResult & result )
377539 {
377540 D_ASSERT(expr_ptr->GetExpressionClass() == ExpressionClass::COLUMN_REF);
377541 auto &expr = expr_ptr->Cast<ColumnRefExpression>();
377542
377543 if (!ExpressionBinder::IsPotentialAlias(expr)) {
377544 return false;
377545 }
377546
377547 // We try to find the alias in the alias_map and return false, if no alias exists.
377548 auto alias_entry = bind_state.alias_map.find(expr.column_names.back());
377549 if (alias_entry == bind_state.alias_map.end()) {
377550 return false;
377551 }
377552
377553 if (visited_select_indexes.find(alias_entry->second) != visited_select_indexes.end()) {
377554 // self-referential alias cannot be resolved
377555 return false;
377556 }
377557
377558 // We found an alias, so we copy the alias expression into this expression.
377559 auto original_expr = bind_state.BindAlias(alias_entry->second);
377560 expr_ptr = std::move(original_expr);
377561 visited_select_indexes.insert(alias_entry->second);
377562
377563 result = enclosing_binder.BindExpression(expr_ptr, depth, root_expression);
377564 visited_select_indexes.erase(alias_entry->second);
377565 return true;
377566}

◆ DoesColumnAliasExist()

bool duckdb::ColumnAliasBinder::DoesColumnAliasExist ( const ColumnRefExpression & colref)
377568 {
377569 if (!ExpressionBinder::IsPotentialAlias(colref)) {
377570 return false;
377571 }
377572 return bind_state.alias_map.find(colref.column_names[0]) != bind_state.alias_map.end();
377573}

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