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

Public Member Functions

 TableFunctionRelation (const shared_ptr< ClientContext > &context, string name, vector< Value > parameters, named_parameter_map_t named_parameters, shared_ptr< Relation > input_relation_p=nullptr, bool auto_init=true)
 TableFunctionRelation (const shared_ptr< RelationContextWrapper > &context, string name, vector< Value > parameters, named_parameter_map_t named_parameters, shared_ptr< Relation > input_relation_p=nullptr, bool auto_init=true)
 TableFunctionRelation (const shared_ptr< ClientContext > &context, string name, vector< Value > parameters, shared_ptr< Relation > input_relation_p=nullptr, bool auto_init=true)
unique_ptr< QueryNode > GetQueryNode () override
unique_ptr< TableRef > GetTableRef () override
const vector< ColumnDefinition > & Columns () override
string ToString (idx_t depth) override
string GetAlias () override
void AddNamedParameter (const string &name, Value argument)
void RemoveNamedParameterIfExists (const string &name)
void SetNamedParameters (named_parameter_map_t &&named_parameters)
Public Member Functions inherited from duckdb::Relation
 Relation (const shared_ptr< ClientContext > &context_p, const RelationType type)
 Relation (const shared_ptr< ClientContextWrapper > &context, RelationType type, const string &alias_p="")
 Relation (const shared_ptr< RelationContextWrapper > &context, RelationType type, const string &alias_p="")
virtual DUCKDB_API string GetQuery ()
virtual DUCKDB_API BoundStatement Bind (Binder &binder)
DUCKDB_API unique_ptr< QueryResult > ExecuteOrThrow ()
DUCKDB_API unique_ptr< QueryResult > Execute ()
DUCKDB_API string ToString ()
DUCKDB_API void Print ()
DUCKDB_API void Head (idx_t limit=10)
DUCKDB_API shared_ptr< Relation > CreateView (const string &name, bool replace=true, bool temporary=false)
DUCKDB_API shared_ptr< Relation > CreateView (const string &schema_name, const string &name, bool replace=true, bool temporary=false)
DUCKDB_API unique_ptr< QueryResult > Query (const string &sql) const
DUCKDB_API unique_ptr< QueryResult > Query (const string &name, const string &sql)
DUCKDB_API unique_ptr< QueryResult > Explain (ExplainType type=ExplainType::EXPLAIN_STANDARD, ExplainFormat explain_format=ExplainFormat::DEFAULT)
 Explain the query plan of this relation.
virtual bool IsReadOnly ()
DUCKDB_API void TryBindRelation (vector< ColumnDefinition > &columns)
DUCKDB_API shared_ptr< Relation > Project (const string &select_list)
DUCKDB_API shared_ptr< Relation > Project (const string &expression, const string &alias)
DUCKDB_API shared_ptr< Relation > Project (const string &select_list, const vector< string > &aliases)
DUCKDB_API shared_ptr< Relation > Project (const vector< string > &expressions)
DUCKDB_API shared_ptr< Relation > Project (const vector< string > &expressions, const vector< string > &aliases)
DUCKDB_API shared_ptr< Relation > Project (vector< unique_ptr< ParsedExpression > > expressions, const vector< string > &aliases)
DUCKDB_API shared_ptr< Relation > Filter (const string &expression)
DUCKDB_API shared_ptr< Relation > Filter (unique_ptr< ParsedExpression > expression)
DUCKDB_API shared_ptr< Relation > Filter (const vector< string > &expressions)
DUCKDB_API shared_ptr< Relation > Limit (int64_t n, int64_t offset=0)
DUCKDB_API shared_ptr< Relation > Order (const string &expression)
DUCKDB_API shared_ptr< Relation > Order (const vector< string > &expressions)
DUCKDB_API shared_ptr< Relation > Order (vector< OrderByNode > expressions)
DUCKDB_API shared_ptr< Relation > Join (const shared_ptr< Relation > &other, const string &condition, JoinType type=JoinType::INNER, JoinRefType ref_type=JoinRefType::REGULAR)
shared_ptr< Relation > Join (const shared_ptr< Relation > &other, vector< unique_ptr< ParsedExpression > > condition, JoinType type=JoinType::INNER, JoinRefType ref_type=JoinRefType::REGULAR)
DUCKDB_API shared_ptr< Relation > CrossProduct (const shared_ptr< Relation > &other, JoinRefType join_ref_type=JoinRefType::CROSS)
DUCKDB_API shared_ptr< Relation > Union (const shared_ptr< Relation > &other)
DUCKDB_API shared_ptr< Relation > Except (const shared_ptr< Relation > &other)
DUCKDB_API shared_ptr< Relation > Intersect (const shared_ptr< Relation > &other)
DUCKDB_API shared_ptr< Relation > Distinct ()
DUCKDB_API shared_ptr< Relation > Aggregate (const string &aggregate_list)
DUCKDB_API shared_ptr< Relation > Aggregate (const vector< string > &aggregates)
DUCKDB_API shared_ptr< Relation > Aggregate (vector< unique_ptr< ParsedExpression > > expressions)
DUCKDB_API shared_ptr< Relation > Aggregate (const string &aggregate_list, const string &group_list)
DUCKDB_API shared_ptr< Relation > Aggregate (const vector< string > &aggregates, const vector< string > &groups)
DUCKDB_API shared_ptr< Relation > Aggregate (vector< unique_ptr< ParsedExpression > > expressions, const string &group_list)
DUCKDB_API shared_ptr< Relation > Alias (const string &alias)
DUCKDB_API shared_ptr< Relation > InsertRel (const string &schema_name, const string &table_name)
 Insert the data from this relation into a table.
DUCKDB_API shared_ptr< Relation > InsertRel (const string &catalog_name, const string &schema_name, const string &table_name)
DUCKDB_API void Insert (const string &table_name)
DUCKDB_API void Insert (const string &schema_name, const string &table_name)
DUCKDB_API void Insert (const string &catalog_name, const string &schema_name, const string &table_name)
virtual DUCKDB_API void Insert (const vector< vector< Value > > &values)
 Insert a row (i.e.,list of values) into a table.
virtual DUCKDB_API void Insert (vector< vector< unique_ptr< ParsedExpression > > > &&expressions)
DUCKDB_API shared_ptr< Relation > CreateRel (const string &schema_name, const string &table_name, bool temporary=false, OnCreateConflict on_conflict=OnCreateConflict::ERROR_ON_CONFLICT)
 Create a table and insert the data from this relation into that table.
DUCKDB_API shared_ptr< Relation > CreateRel (const string &catalog_name, const string &schema_name, const string &table_name, bool temporary=false, OnCreateConflict on_conflict=OnCreateConflict::ERROR_ON_CONFLICT)
DUCKDB_API void Create (const string &table_name, bool temporary=false, OnCreateConflict on_conflict=OnCreateConflict::ERROR_ON_CONFLICT)
DUCKDB_API void Create (const string &schema_name, const string &table_name, bool temporary=false, OnCreateConflict on_conflict=OnCreateConflict::ERROR_ON_CONFLICT)
DUCKDB_API void Create (const string &catalog_name, const string &schema_name, const string &table_name, bool temporary=false, OnCreateConflict on_conflict=OnCreateConflict::ERROR_ON_CONFLICT)
DUCKDB_API shared_ptr< Relation > WriteCSVRel (const string &csv_file, case_insensitive_map_t< vector< Value > > options=case_insensitive_map_t< vector< Value > >())
 Write a relation to a CSV file.
DUCKDB_API void WriteCSV (const string &csv_file, case_insensitive_map_t< vector< Value > > options=case_insensitive_map_t< vector< Value > >())
DUCKDB_API shared_ptr< Relation > WriteParquetRel (const string &parquet_file, case_insensitive_map_t< vector< Value > > options=case_insensitive_map_t< vector< Value > >())
 Write a relation to a Parquet file.
DUCKDB_API void WriteParquet (const string &parquet_file, case_insensitive_map_t< vector< Value > > options=case_insensitive_map_t< vector< Value > >())
virtual DUCKDB_API void Update (const string &update, const string &condition=string())
 Update a table, can only be used on a TableRelation.
virtual DUCKDB_API void Update (vector< string > column_names, vector< unique_ptr< ParsedExpression > > &&update, unique_ptr< ParsedExpression > condition=nullptr)
virtual DUCKDB_API void Delete (const string &condition=string())
 Delete from a table, can only be used on a TableRelation.
DUCKDB_API shared_ptr< Relation > TableFunction (const std::string &fname, const vector< Value > &values)
 Create a relation from calling a table in/out function on the input relation Create a relation from calling a table in/out function on the input relation.
DUCKDB_API shared_ptr< Relation > TableFunction (const std::string &fname, const vector< Value > &values, const named_parameter_map_t &named_parameters)
virtual bool InheritsColumnBindings ()
 Whether or not the relation inherits column bindings from its child or not, only relevant for binding.
virtual Relation * ChildRelation ()
void AddExternalDependency (shared_ptr< ExternalDependency > dependency)
DUCKDB_API vector< shared_ptr< ExternalDependency > > GetAllDependencies ()
template<class TARGET>
TARGET & Cast ()
template<class TARGET>
const TARGET & Cast () const
Public Member Functions inherited from duckdb::enable_shared_from_this< Relation >
shared_ptr< Relation > shared_from_this ()

Public Attributes

string name
vector< Value > parameters
named_parameter_map_t named_parameters
vector< ColumnDefinition > columns
shared_ptr< Relation > input_relation
Public Attributes inherited from duckdb::Relation
shared_ptr< ClientContextWrapper > context
RelationType type
const string alias
vector< shared_ptr< ExternalDependency > > external_dependencies

Private Member Functions

void InitializeColumns ()

Private Attributes

bool auto_initialize
 Whether or not to auto initialize the columns on construction.

Additional Inherited Members

Protected Member Functions inherited from duckdb::enable_shared_from_this< Relation >
enable_shared_from_this & operator= (enable_shared_from_this const &) noexcept
Static Protected Member Functions inherited from duckdb::Relation
static DUCKDB_API string RenderWhitespace (idx_t depth)

Constructor & Destructor Documentation

◆ TableFunctionRelation() [1/3]

duckdb::TableFunctionRelation::TableFunctionRelation ( const shared_ptr< ClientContext > & context,
string name,
vector< Value > parameters,
named_parameter_map_t named_parameters,
shared_ptr< Relation > input_relation_p = nullptr,
bool auto_init = true )
298557 : Relation(context, RelationType::TABLE_FUNCTION_RELATION), name(std::move(name_p)),
298558 parameters(std::move(parameters_p)), named_parameters(std::move(named_parameters)),
298559 input_relation(std::move(input_relation_p)), auto_initialize(auto_init) {
298560 InitializeColumns();
298561}
bool auto_initialize
Whether or not to auto initialize the columns on construction.
Definition duckdb.cpp:275618

◆ TableFunctionRelation() [2/3]

duckdb::TableFunctionRelation::TableFunctionRelation ( const shared_ptr< RelationContextWrapper > & context,
string name,
vector< Value > parameters,
named_parameter_map_t named_parameters,
shared_ptr< Relation > input_relation_p = nullptr,
bool auto_init = true )
298566 : Relation(context, RelationType::TABLE_FUNCTION_RELATION), name(std::move(name_p)),
298567 parameters(std::move(parameters_p)), named_parameters(std::move(named_parameters)),
298568 input_relation(std::move(input_relation_p)), auto_initialize(auto_init) {
298569 InitializeColumns();
298570}

◆ TableFunctionRelation() [3/3]

duckdb::TableFunctionRelation::TableFunctionRelation ( const shared_ptr< ClientContext > & context,
string name,
vector< Value > parameters,
shared_ptr< Relation > input_relation_p = nullptr,
bool auto_init = true )
298575 : Relation(context, RelationType::TABLE_FUNCTION_RELATION), name(std::move(name_p)),
298576 parameters(std::move(parameters_p)), input_relation(std::move(input_relation_p)), auto_initialize(auto_init) {
298577 InitializeColumns();
298578}

◆ ~TableFunctionRelation()

duckdb::TableFunctionRelation::~TableFunctionRelation ( )
inlineoverride
275593 {
275594 }

Member Function Documentation

◆ GetQueryNode()

unique_ptr< QueryNode > duckdb::TableFunctionRelation::GetQueryNode ( )
overridevirtual

Implements duckdb::Relation.

298587 {
298588 auto result = make_uniq<SelectNode>();
298589 result->select_list.push_back(make_uniq<StarExpression>());
298590 result->from_table = GetTableRef();
298591 return std::move(result);
298592}

◆ GetTableRef()

unique_ptr< TableRef > duckdb::TableFunctionRelation::GetTableRef ( )
overridevirtual

Reimplemented from duckdb::Relation.

298594 {
298595 vector<unique_ptr<ParsedExpression>> children;
298596 if (input_relation) { // input relation becomes first parameter if present, always
298597 auto subquery = make_uniq<SubqueryExpression>();
298598 subquery->subquery = make_uniq<SelectStatement>();
298599 subquery->subquery->node = input_relation->GetQueryNode();
298600 subquery->subquery_type = SubqueryType::SCALAR;
298601 children.push_back(std::move(subquery));
298602 }
298603 for (auto &parameter : parameters) {
298604 children.push_back(make_uniq<ConstantExpression>(parameter));
298605 }
298606
298607 for (auto &parameter : named_parameters) {
298608 // Hackity-hack some comparisons with column refs
298609 // This is all but pretty, basically the named parameter is the column, the table is empty because that's what
298610 // the function binder likes
298611 auto column_ref = make_uniq<ColumnRefExpression>(parameter.first);
298612 auto constant_value = make_uniq<ConstantExpression>(parameter.second);
298613 auto comparison = make_uniq<ComparisonExpression>(ExpressionType::COMPARE_EQUAL, std::move(column_ref),
298614 std::move(constant_value));
298615 children.push_back(std::move(comparison));
298616 }
298617
298618 auto table_function = make_uniq<TableFunctionRef>();
298619 auto function = make_uniq<FunctionExpression>(name, std::move(children));
298620 table_function->function = std::move(function);
298621 return std::move(table_function);
298622}

◆ Columns()

const vector< ColumnDefinition > & duckdb::TableFunctionRelation::Columns ( )
overridevirtual

Implements duckdb::Relation.

298628 {
298629 return columns;
298630}

◆ ToString()

string duckdb::TableFunctionRelation::ToString ( idx_t depth)
overridevirtual

Implements duckdb::Relation.

298632 {
298633 string function_call = name + "(";
298634 for (idx_t i = 0; i < parameters.size(); i++) {
298635 if (i > 0) {
298636 function_call += ", ";
298637 }
298638 function_call += parameters[i].ToString();
298639 }
298640 function_call += ")";
298641 return RenderWhitespace(depth) + function_call;
298642}
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237

◆ GetAlias()

string duckdb::TableFunctionRelation::GetAlias ( )
overridevirtual

Reimplemented from duckdb::Relation.

298624 {
298625 return name;
298626}

◆ AddNamedParameter()

void duckdb::TableFunctionRelation::AddNamedParameter ( const string & name,
Value argument )
298539 {
298540 named_parameters[name] = std::move(argument);
298541}

◆ RemoveNamedParameterIfExists()

void duckdb::TableFunctionRelation::RemoveNamedParameterIfExists ( const string & name)
298543 {
298544 if (named_parameters.find(name) != named_parameters.end()) {
298545 named_parameters.erase(name);
298546 }
298547}

◆ SetNamedParameters()

void duckdb::TableFunctionRelation::SetNamedParameters ( named_parameter_map_t && named_parameters)
298549 {
298550 D_ASSERT(named_parameters.empty());
298551 named_parameters = std::move(options);
298552}

◆ InitializeColumns()

void duckdb::TableFunctionRelation::InitializeColumns ( )
private
298580 {
298581 if (!auto_initialize) {
298582 return;
298583 }
298584 TryBindRelation(columns);
298585}

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