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

Public Member Functions

 TableRelation (const shared_ptr< ClientContext > &context, unique_ptr< TableDescription > description)
 TableRelation (const shared_ptr< RelationContextWrapper > &context, unique_ptr< TableDescription > description)
unique_ptr< QueryNode > GetQueryNode () override
const vector< ColumnDefinition > & Columns () override
string ToString (idx_t depth) override
string GetAlias () override
unique_ptr< TableRef > GetTableRef () override
void Insert (const vector< vector< Value > > &values) override
 Insert a row (i.e.,list of values) into a table.
void Insert (vector< vector< unique_ptr< ParsedExpression > > > &&expressions) override
void Update (const string &update, const string &condition=string()) override
 Update a table, can only be used on a TableRelation.
void Update (vector< string > column_names, vector< unique_ptr< ParsedExpression > > &&update, unique_ptr< ParsedExpression > condition=nullptr) override
void Delete (const string &condition=string()) override
 Delete from a table, can only be used on a TableRelation.
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)
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 > >())
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

unique_ptr< TableDescription > description
Public Attributes inherited from duckdb::Relation
shared_ptr< ClientContextWrapper > context
RelationType type
const string alias
vector< shared_ptr< ExternalDependency > > external_dependencies

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

◆ TableRelation() [1/2]

duckdb::TableRelation::TableRelation ( const shared_ptr< ClientContext > & context,
unique_ptr< TableDescription > description )
298699 : Relation(context, RelationType::TABLE_RELATION), description(std::move(description)) {
298700}

◆ TableRelation() [2/2]

duckdb::TableRelation::TableRelation ( const shared_ptr< RelationContextWrapper > & context,
unique_ptr< TableDescription > description )
298704 : Relation(context, RelationType::TABLE_RELATION), description(std::move(description)) {
298705}

Member Function Documentation

◆ GetQueryNode()

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

Implements duckdb::Relation.

298707 {
298708 auto result = make_uniq<SelectNode>();
298709 result->select_list.push_back(make_uniq<StarExpression>());
298710 result->from_table = GetTableRef();
298711 return std::move(result);
298712}

◆ Columns()

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

Implements duckdb::Relation.

298726 {
298727 return description->columns;
298728}

◆ ToString()

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

Implements duckdb::Relation.

298730 {
298731 return RenderWhitespace(depth) + "Scan Table [" +
298732 ParseInfo::QualifierToString(description->database, description->schema, description->table) + "]";
298733}

◆ GetAlias()

string duckdb::TableRelation::GetAlias ( )
overridevirtual

Reimplemented from duckdb::Relation.

298722 {
298723 return description->table;
298724}

◆ GetTableRef()

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

Reimplemented from duckdb::Relation.

298714 {
298715 auto table_ref = make_uniq<BaseTableRef>();
298716 table_ref->schema_name = description->schema;
298717 table_ref->table_name = description->table;
298718 table_ref->catalog_name = description->database;
298719 return std::move(table_ref);
298720}

◆ Insert() [1/2]

void duckdb::TableRelation::Insert ( const vector< vector< Value > > & values)
overridevirtual

Insert a row (i.e.,list of values) into a table.

Reimplemented from duckdb::Relation.

298776 {
298777 vector<string> column_names;
298778 auto rel = make_shared_ptr<ValueRelation>(context->GetContext(), values, std::move(column_names), "values");
298779 rel->Insert(description->database, description->schema, description->table);
298780}

◆ Insert() [2/2]

void duckdb::TableRelation::Insert ( vector< vector< unique_ptr< ParsedExpression > > > && expressions)
overridevirtual

Reimplemented from duckdb::Relation.

298782 {
298783 vector<string> column_names;
298784 auto rel = make_shared_ptr<ValueRelation>(context->GetContext(), std::move(expressions), std::move(column_names),
298785 "values");
298786 rel->Insert(description->database, description->schema, description->table);
298787}

◆ Update() [1/2]

void duckdb::TableRelation::Update ( const string & update,
const string & condition = string() )
overridevirtual

Update a table, can only be used on a TableRelation.

Reimplemented from duckdb::Relation.

298758 {
298759 vector<string> update_columns;
298760 vector<unique_ptr<ParsedExpression>> expressions;
298761 auto cond = ParseCondition(*context->GetContext(), condition);
298762 Parser::ParseUpdateList(update_list, update_columns, expressions, context->GetContext()->GetParserOptions());
298763 auto update =
298764 make_shared_ptr<UpdateRelation>(context, std::move(cond), description->database, description->schema,
298765 description->table, std::move(update_columns), std::move(expressions));
298766 update->Execute();
298767}
static void ParseUpdateList(const string &update_list, vector< string > &update_columns, vector< unique_ptr< ParsedExpression > > &expressions, ParserOptions options=ParserOptions())
Parses an update list (i.e. the list found in the SET clause of an UPDATE statement).
Definition duckdb.cpp:347605
Here is the call graph for this function:

◆ Update() [2/2]

void duckdb::TableRelation::Update ( vector< string > column_names,
vector< unique_ptr< ParsedExpression > > && update,
unique_ptr< ParsedExpression > condition = nullptr )
overridevirtual

Reimplemented from duckdb::Relation.

298748 {
298749 vector<string> update_columns = std::move(names);
298750 vector<unique_ptr<ParsedExpression>> expressions = std::move(update);
298751
298752 auto update_relation =
298753 make_shared_ptr<UpdateRelation>(context, std::move(condition), description->database, description->schema,
298754 description->table, std::move(update_columns), std::move(expressions));
298755 update_relation->Execute();
298756}

◆ Delete()

void duckdb::TableRelation::Delete ( const string & condition = string())
overridevirtual

Delete from a table, can only be used on a TableRelation.

Reimplemented from duckdb::Relation.

298769 {
298770 auto cond = ParseCondition(*context->GetContext(), condition);
298771 auto del = make_shared_ptr<DeleteRelation>(context, std::move(cond), description->database, description->schema,
298772 description->table);
298773 del->Execute();
298774}

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