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::Binding Struct Reference

A Binding represents a binding to a table, table-producing function or subquery with a specified table index. More...

Inheritance diagram for duckdb::Binding:
Collaboration diagram for duckdb::Binding:

Public Member Functions

 Binding (BindingType binding_type, BindingAlias alias, vector< LogicalType > types, vector< string > names, idx_t index)
bool TryGetBindingIndex (const string &column_name, column_t &column_index)
column_t GetBindingIndex (const string &column_name)
bool HasMatchingBinding (const string &column_name)
virtual ErrorData ColumnNotFoundError (const string &column_name) const
virtual BindResult Bind (ColumnRefExpression &colref, idx_t depth)
virtual optional_ptr< StandardEntry > GetStandardEntry ()
string GetAlias () const
BindingType GetBindingType ()
const BindingAlias & GetBindingAlias ()
idx_t GetIndex ()
const vector< LogicalType > & GetColumnTypes ()
const vector< string > & GetColumnNames ()
idx_t GetColumnCount ()
void SetColumnType (idx_t col_idx, LogicalType type)
template<class TARGET>
TARGET & Cast ()
template<class TARGET>
const TARGET & Cast () const

Static Public Member Functions

static BindingAlias GetAlias (const string &explicit_alias, const StandardEntry &entry)
static BindingAlias GetAlias (const string &explicit_alias, optional_ptr< StandardEntry > entry)

Protected Member Functions

void Initialize ()

Protected Attributes

BindingType binding_type
 The type of Binding.
BindingAlias alias
 The alias of the binding.
idx_t index
 The table index of the binding.
vector< LogicalType > types
 The types of the bound columns.
vector< string > names
 Column names of the subquery.
case_insensitive_map_t< column_t > name_map
 Name -> index for the names.

Detailed Description

A Binding represents a binding to a table, table-producing function or subquery with a specified table index.

Constructor & Destructor Documentation

◆ Binding()

duckdb::Binding::Binding ( BindingType binding_type,
BindingAlias alias,
vector< LogicalType > types,
vector< string > names,
idx_t index )
385545 : binding_type(binding_type), alias(std::move(alias_p)), index(index), types(std::move(coltypes)),
385546 names(std::move(colnames)) {
385547 Initialize();
385548}
idx_t index
The table index of the binding.
Definition duckdb.cpp:1343
vector< LogicalType > types
The types of the bound columns.
Definition duckdb.cpp:1345
BindingAlias alias
The alias of the binding.
Definition duckdb.cpp:1341
vector< string > names
Column names of the subquery.
Definition duckdb.cpp:1347
BindingType binding_type
The type of Binding.
Definition duckdb.cpp:1339

Member Function Documentation

◆ TryGetBindingIndex()

bool duckdb::Binding::TryGetBindingIndex ( const string & column_name,
column_t & column_index )
385594 {
385595 auto entry = name_map.find(column_name);
385596 if (entry == name_map.end()) {
385597 return false;
385598 }
385599 auto column_info = entry->second;
385600 result = column_info;
385601 return true;
385602}
case_insensitive_map_t< column_t > name_map
Name -> index for the names.
Definition duckdb.cpp:1349

◆ GetBindingIndex()

column_t duckdb::Binding::GetBindingIndex ( const string & column_name)
385604 {
385605 column_t result;
385606 if (!TryGetBindingIndex(column_name, result)) {
385607 throw InternalException("Binding index for column \"%s\" not found", column_name);
385608 }
385609 return result;
385610}
idx_t column_t
Type used for column identifiers.
Definition duckdb.hpp:259

◆ HasMatchingBinding()

bool duckdb::Binding::HasMatchingBinding ( const string & column_name)
385612 {
385613 column_t result;
385614 return TryGetBindingIndex(column_name, result);
385615}

◆ ColumnNotFoundError()

ErrorData duckdb::Binding::ColumnNotFoundError ( const string & column_name) const
virtual
385617 {
385618 return ErrorData(ExceptionType::BINDER, StringUtil::Format("Values list \"%s\" does not have a column named \"%s\"",
385619 GetAlias(), column_name));
385620}
static string Format(const string fmt_str, ARGS... params)
Format a string using printf semantics.
Definition duckdb.hpp:4002

◆ Bind()

BindResult duckdb::Binding::Bind ( ColumnRefExpression & colref,
idx_t depth )
virtual

Reimplemented in duckdb::DummyBinding.

385622 {
385623 column_t column_index;
385624 bool success = false;
385625 success = TryGetBindingIndex(colref.GetColumnName(), column_index);
385626 if (!success) {
385627 return BindResult(ColumnNotFoundError(colref.GetColumnName()));
385628 }
385629 ColumnBinding binding;
385630 binding.table_index = index;
385631 binding.column_index = column_index;
385632 LogicalType sql_type = types[column_index];
385633 if (colref.GetAlias().empty()) {
385634 colref.SetAlias(names[column_index]);
385635 }
385636 return BindResult(make_uniq<BoundColumnRefExpression>(colref.GetName(), sql_type, binding, depth));
385637}

◆ GetStandardEntry()

optional_ptr< StandardEntry > duckdb::Binding::GetStandardEntry ( )
virtual
385639 {
385640 return nullptr;
385641}

◆ GetAlias() [1/3]

string duckdb::Binding::GetAlias ( ) const
385590 {
385591 return alias.GetAlias();
385592}

◆ GetBindingType()

BindingType duckdb::Binding::GetBindingType ( )
385562 {
385563 return binding_type;
385564}

◆ GetBindingAlias()

const BindingAlias & duckdb::Binding::GetBindingAlias ( )
385566 {
385567 return alias;
385568}

◆ GetIndex()

idx_t duckdb::Binding::GetIndex ( )
385570 {
385571 return index;
385572}

◆ GetColumnTypes()

const vector< LogicalType > & duckdb::Binding::GetColumnTypes ( )
385574 {
385575 return types;
385576}

◆ GetColumnNames()

const vector< string > & duckdb::Binding::GetColumnNames ( )
385578 {
385579 return names;
385580}

◆ GetColumnCount()

idx_t duckdb::Binding::GetColumnCount ( )
385582 {
385583 return GetColumnNames().size();
385584}

◆ SetColumnType()

void duckdb::Binding::SetColumnType ( idx_t col_idx,
LogicalType type )
385586 {
385587 types[col_idx] = std::move(type_p);
385588}

◆ GetAlias() [2/3]

BindingAlias duckdb::Binding::GetAlias ( const string & explicit_alias,
const StandardEntry & entry )
static
385643 {
385644 if (!explicit_alias.empty()) {
385645 return BindingAlias(explicit_alias);
385646 }
385647 // no explicit alias provided - generate from entry
385648 return BindingAlias(entry);
385649}

◆ GetAlias() [3/3]

BindingAlias duckdb::Binding::GetAlias ( const string & explicit_alias,
optional_ptr< StandardEntry > entry )
static
385651 {
385652 if (!explicit_alias.empty()) {
385653 return BindingAlias(explicit_alias);
385654 }
385655 if (!entry) {
385656 throw InternalException("Binding::GetAlias called - but neither an alias nor an entry was provided");
385657 }
385658 // no explicit alias provided - generate from entry
385659 return BindingAlias(*entry);
385660}

◆ Cast() [1/2]

template<class TARGET>
TARGET & duckdb::Binding::Cast ( )
inline
1319 {
1320 if (binding_type != TARGET::TYPE) {
1321 throw InternalException("Failed to cast binding to type - binding type mismatch");
1322 }
1323 return reinterpret_cast<TARGET &>(*this);
1324 }

◆ Cast() [2/2]

template<class TARGET>
const TARGET & duckdb::Binding::Cast ( ) const
inline
1327 {
1328 if (binding_type != TARGET::TYPE) {
1329 throw InternalException("Failed to cast binding to type - binding type mismatch");
1330 }
1331 return reinterpret_cast<const TARGET &>(*this);
1332 }

◆ Initialize()

void duckdb::Binding::Initialize ( )
protected
385550 {
385551 D_ASSERT(types.size() == names.size());
385552 for (idx_t i = 0; i < names.size(); i++) {
385553 auto &name = names[i];
385554 D_ASSERT(!name.empty());
385555 if (name_map.find(name) != name_map.end()) {
385556 throw BinderException("table \"%s\" has duplicate column name \"%s\"", alias.GetAlias(), name);
385557 }
385558 name_map[name] = i;
385559 }
385560}
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237

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