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::CTEBindState Struct Reference
Collaboration diagram for duckdb::CTEBindState:

Public Member Functions

 CTEBindState (Binder &parent_binder, QueryNode &cte_def, const vector< string > &aliases)
bool IsBound () const
void Bind (CTEBinding &binding)

Public Attributes

Binder & parent_binder
QueryNode & cte_def
const vector< string > & aliases
idx_t active_binder_count
shared_ptr< Binder > query_binder
BoundStatement query
vector< string > names
vector< LogicalType > types

Constructor & Destructor Documentation

◆ CTEBindState()

duckdb::CTEBindState::CTEBindState ( Binder & parent_binder,
QueryNode & cte_def,
const vector< string > & aliases )
363658 : parent_binder(parent_binder_p), cte_def(cte_def_p), aliases(aliases_p),
363659 active_binder_count(parent_binder.GetActiveBinders().size()) {
363660}

◆ ~CTEBindState()

duckdb::CTEBindState::~CTEBindState ( )
363662 {
363663}

Member Function Documentation

◆ IsBound()

bool duckdb::CTEBindState::IsBound ( ) const
363665 {
363666 return query_binder.get() != nullptr;
363667}

◆ Bind()

void duckdb::CTEBindState::Bind ( CTEBinding & binding)
363669 {
363670 // we are lazily binding the CTE
363671 // we need to bind it as if we were binding it during PrepareCTE
363672 query_binder = Binder::CreateBinder(parent_binder.context, parent_binder);
363673 query_binder->SetCanContainNulls(true);
363674
363675 // we clear any expression binders that were added in the mean-time, to ensure we are not binding to any newly added
363676 // correlated columns
363677 auto &active_binders = parent_binder.GetActiveBinders();
363678 vector<reference<ExpressionBinder>> stored_binders;
363679 for (idx_t i = active_binder_count; i < active_binders.size(); i++) {
363680 stored_binders.push_back(active_binders[i]);
363681 }
363682 active_binders.erase(active_binders.begin() + UnsafeNumericCast<int64_t>(active_binder_count),
363683 active_binders.end());
363684
363685 // add this CTE to the query binder on the RHS with "CANNOT_BE_REFERENCED" to detect recursive references to
363686 // ourselves
363687 query_binder->bind_context.AddCTEBinding(binding.GetIndex(), binding.GetBindingAlias(), vector<string>(),
363688 vector<LogicalType>(), CTEType::CANNOT_BE_REFERENCED);
363689
363690 // bind the actual CTE
363691 query = query_binder->Bind(cte_def);
363692
363693 // after binding - we add the active binders we removed back so we can leave the binder in its original state
363694 for (auto &stored_binder : stored_binders) {
363695 active_binders.push_back(stored_binder);
363696 }
363697
363698 // the result types of the CTE are the types of the LHS
363699 types = query.types;
363700 // names are picked from the LHS, unless aliases are explicitly specified
363701 names = query.names;
363702 for (idx_t i = 0; i < aliases.size() && i < names.size(); i++) {
363703 names[i] = aliases[i];
363704 }
363705
363706 // Rename columns if duplicate names are detected
363708}
static void DeduplicateColumns(vector< string > &names)
Deduplicate column names for interop with external libraries.
Definition duckdb.cpp:296062
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: