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::Relation Class Referenceabstract
Inheritance diagram for duckdb::Relation:
Collaboration diagram for duckdb::Relation:

Public Member Functions

 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 const vector< ColumnDefinition > & Columns ()=0
virtual DUCKDB_API unique_ptr< QueryNode > GetQueryNode ()=0
virtual DUCKDB_API string GetQuery ()
virtual DUCKDB_API BoundStatement Bind (Binder &binder)
virtual DUCKDB_API string GetAlias ()
DUCKDB_API unique_ptr< QueryResult > ExecuteOrThrow ()
DUCKDB_API unique_ptr< QueryResult > Execute ()
DUCKDB_API string ToString ()
virtual DUCKDB_API string ToString (idx_t depth)=0
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 DUCKDB_API unique_ptr< TableRef > GetTableRef ()
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

shared_ptr< ClientContextWrapper > context
RelationType type
const string alias
vector< shared_ptr< ExternalDependency > > external_dependencies

Static Protected Member Functions

static DUCKDB_API string RenderWhitespace (idx_t depth)

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

Constructor & Destructor Documentation

◆ Relation() [1/3]

duckdb::Relation::Relation ( const shared_ptr< ClientContext > & context_p,
const RelationType type )
inline
42083 : type(type) {
42084 context = make_shared_ptr<ClientContextWrapper>(context_p);
42085 }

◆ Relation() [2/3]

duckdb::Relation::Relation ( const shared_ptr< ClientContextWrapper > & context,
RelationType type,
const string & alias_p = "" )
inline
42087 : context(context), type(type), alias(CreateRelationAlias(type, alias_p)) {
42088 }

◆ Relation() [3/3]

duckdb::Relation::Relation ( const shared_ptr< RelationContextWrapper > & context,
RelationType type,
const string & alias_p = "" )
inline
42091 : context(context), type(type), alias(CreateRelationAlias(type, alias_p)) {
42092 }

Member Function Documentation

◆ GetQuery()

string duckdb::Relation::GetQuery ( )
virtual
299621 {
299622 return GetQueryNode()->ToString();
299623}

◆ Bind()

BoundStatement duckdb::Relation::Bind ( Binder & binder)
virtual
299440 {
299441 SelectStatement stmt;
299442 stmt.node = GetQueryNode();
299443 return binder.Bind(stmt.Cast<SQLStatement>());
299444}

◆ GetAlias()

string duckdb::Relation::GetAlias ( )
virtual
299417 {
299418 return alias;
299419}

◆ ExecuteOrThrow()

unique_ptr< QueryResult > duckdb::Relation::ExecuteOrThrow ( )
299431 {
299432 auto res = Execute();
299433 D_ASSERT(res);
299434 if (res->HasError()) {
299435 res->ThrowError();
299436 }
299437 return res;
299438}

◆ Execute()

unique_ptr< QueryResult > duckdb::Relation::Execute ( )
299427 {
299428 return context->GetContext()->Execute(shared_from_this());
299429}

◆ ToString()

string duckdb::Relation::ToString ( )
299603 {
299604 string str;
299605 str += "---------------------\n";
299606 str += "--- Relation Tree ---\n";
299607 str += "---------------------\n";
299608 str += ToString(0);
299609 str += "\n\n";
299610 str += "---------------------\n";
299611 str += "-- Result Columns --\n";
299612 str += "---------------------\n";
299613 auto &cols = Columns();
299614 for (idx_t i = 0; i < cols.size(); i++) {
299615 str += "- " + cols[i].Name() + " (" + cols[i].Type().ToString() + ")\n";
299616 }
299617 return str;
299618}
int cols
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237

◆ Print()

void duckdb::Relation::Print ( )
299631 {
299632 Printer::Print(ToString());
299633}
static DUCKDB_API void Print(OutputStream stream, const string &str)
Print the object to the stream.
Definition duckdb.cpp:92556

◆ Head()

void duckdb::Relation::Head ( idx_t limit = 10)
299625 {
299626 auto limit_node = Limit(NumericCast<int64_t>(limit));
299627 limit_node->Execute()->Print();
299628}

◆ CreateView() [1/2]

shared_ptr< Relation > duckdb::Relation::CreateView ( const string & name,
bool replace = true,
bool temporary = false )
299543 {
299544 return CreateView(INVALID_SCHEMA, name, replace, temporary);
299545}

◆ CreateView() [2/2]

shared_ptr< Relation > duckdb::Relation::CreateView ( const string & schema_name,
const string & name,
bool replace = true,
bool temporary = false )
299547 {
299548 auto view = make_shared_ptr<CreateViewRelation>(shared_from_this(), schema_name, name, replace, temporary);
299549 auto res = view->Execute();
299550 if (res->HasError()) {
299551 const string prepended_message = "Failed to create view '" + name + "': ";
299552 res->ThrowError(prepended_message);
299553 }
299554 return shared_from_this();
299555}

◆ Query() [1/2]

unique_ptr< QueryResult > duckdb::Relation::Query ( const string & sql) const
299557 {
299558 return context->GetContext()->Query(sql, false);
299559}

◆ Query() [2/2]

unique_ptr< QueryResult > duckdb::Relation::Query ( const string & name,
const string & sql )
299561 {
299562 bool replace = true;
299563 bool temp = IsReadOnly();
299564 CreateView(name, replace, temp);
299565 return Query(sql);
299566}

◆ Explain()

unique_ptr< QueryResult > duckdb::Relation::Explain ( ExplainType type = ExplainType::EXPLAIN_STANDARD,
ExplainFormat explain_format = ExplainFormat::DEFAULT )

Explain the query plan of this relation.

299568 {
299569 auto explain = make_shared_ptr<ExplainRelation>(shared_from_this(), type, format);
299570 return explain->Execute();
299571}
std::basic_string< Char > format(const S &format_str, Args &&... args)
Definition duckdb.cpp:16295
Here is the call graph for this function:

◆ GetTableRef()

unique_ptr< TableRef > duckdb::Relation::GetTableRef ( )
virtual
299421 {
299422 auto select = make_uniq<SelectStatement>();
299423 select->node = GetQueryNode();
299424 return make_uniq<SubqueryRef>(std::move(select), GetAlias());
299425}
GMat select(const GMat &src1, const GMat &src2, const GMat &mask)

◆ IsReadOnly()

virtual bool duckdb::Relation::IsReadOnly ( )
inlinevirtual
42127 {
42128 return true;
42129 }

◆ TryBindRelation()

void duckdb::Relation::TryBindRelation ( vector< ColumnDefinition > & columns)
299573 {
299574 context->TryBindRelation(*this, columns);
299575}

◆ Project() [1/6]

shared_ptr< Relation > duckdb::Relation::Project ( const string & select_list)
299235 {
299236 return Project(select_list, vector<string>());
299237}

◆ Project() [2/6]

shared_ptr< Relation > duckdb::Relation::Project ( const string & expression,
const string & alias )
299239 {
299240 return Project(expression, vector<string>({alias}));
299241}

◆ Project() [3/6]

shared_ptr< Relation > duckdb::Relation::Project ( const string & select_list,
const vector< string > & aliases )
299243 {
299244 auto expressions = Parser::ParseExpressionList(select_list, context->GetContext()->GetParserOptions());
299245 return make_shared_ptr<ProjectionRelation>(shared_from_this(), std::move(expressions), aliases);
299246}
static DUCKDB_API vector< unique_ptr< ParsedExpression > > ParseExpressionList(const string &select_list, ParserOptions options=ParserOptions())
Parses a list of expressions (i.e. the list found in a SELECT clause).
Definition duckdb.cpp:347532

◆ Project() [4/6]

shared_ptr< Relation > duckdb::Relation::Project ( const vector< string > & expressions)
299248 {
299249 vector<string> aliases;
299250 return Project(expressions, aliases);
299251}

◆ Project() [5/6]

shared_ptr< Relation > duckdb::Relation::Project ( const vector< string > & expressions,
const vector< string > & aliases )
299274 {
299275 auto result_list = StringListToExpressionList(*context->GetContext(), expressions);
299276 return make_shared_ptr<ProjectionRelation>(shared_from_this(), std::move(result_list), aliases);
299277}

◆ Project() [6/6]

shared_ptr< Relation > duckdb::Relation::Project ( vector< unique_ptr< ParsedExpression > > expressions,
const vector< string > & aliases )
299254 {
299255 return make_shared_ptr<ProjectionRelation>(shared_from_this(), std::move(expressions), aliases);
299256}

◆ Filter() [1/3]

shared_ptr< Relation > duckdb::Relation::Filter ( const string & expression)
299279 {
299280 auto expression_list = Parser::ParseExpressionList(expression, context->GetContext()->GetParserOptions());
299281 if (expression_list.size() != 1) {
299282 throw ParserException("Expected a single expression as filter condition");
299283 }
299284 return Filter(std::move(expression_list[0]));
299285}

◆ Filter() [2/3]

shared_ptr< Relation > duckdb::Relation::Filter ( unique_ptr< ParsedExpression > expression)
299287 {
299288 return make_shared_ptr<FilterRelation>(shared_from_this(), std::move(expression));
299289}

◆ Filter() [3/3]

shared_ptr< Relation > duckdb::Relation::Filter ( const vector< string > & expressions)
299291 {
299292 // if there are multiple expressions, we AND them together
299293 auto expression_list = StringListToExpressionList(*context->GetContext(), expressions);
299294 D_ASSERT(!expression_list.empty());
299295
299296 auto expr = std::move(expression_list[0]);
299297 for (idx_t i = 1; i < expression_list.size(); i++) {
299298 expr = make_uniq<ConjunctionExpression>(ExpressionType::CONJUNCTION_AND, std::move(expr),
299299 std::move(expression_list[i]));
299300 }
299301 return make_shared_ptr<FilterRelation>(shared_from_this(), std::move(expr));
299302}

◆ Limit()

shared_ptr< Relation > duckdb::Relation::Limit ( int64_t n,
int64_t offset = 0 )
299304 {
299305 return make_shared_ptr<LimitRelation>(shared_from_this(), limit, offset);
299306}

◆ Order() [1/3]

shared_ptr< Relation > duckdb::Relation::Order ( const string & expression)
299308 {
299309 auto order_list = Parser::ParseOrderList(expression, context->GetContext()->GetParserOptions());
299310 return Order(std::move(order_list));
299311}
static vector< OrderByNode > ParseOrderList(const string &select_list, ParserOptions options=ParserOptions())
Parses a list as found in an ORDER BY expression (i.e. including optional ASCENDING/DESCENDING modifi...
Definition duckdb.cpp:347584

◆ Order() [2/3]

shared_ptr< Relation > duckdb::Relation::Order ( const vector< string > & expressions)
299317 {
299318 if (expressions.empty()) {
299319 throw ParserException("Zero ORDER BY expressions provided");
299320 }
299321 vector<OrderByNode> order_list;
299322 for (auto &expression : expressions) {
299323 auto inner_list = Parser::ParseOrderList(expression, context->GetContext()->GetParserOptions());
299324 if (inner_list.size() != 1) {
299325 throw ParserException("Expected a single ORDER BY expression in the expression list");
299326 }
299327 order_list.push_back(std::move(inner_list[0]));
299328 }
299329 return Order(std::move(order_list));
299330}

◆ Order() [3/3]

shared_ptr< Relation > duckdb::Relation::Order ( vector< OrderByNode > expressions)
299313 {
299314 return make_shared_ptr<OrderRelation>(shared_from_this(), std::move(order_list));
299315}

◆ Join() [1/2]

shared_ptr< Relation > duckdb::Relation::Join ( const shared_ptr< Relation > & other,
const string & condition,
JoinType type = JoinType::INNER,
JoinRefType ref_type = JoinRefType::REGULAR )
299333 {
299334 auto expression_list = Parser::ParseExpressionList(condition, context->GetContext()->GetParserOptions());
299335 D_ASSERT(!expression_list.empty());
299336 return Join(other, std::move(expression_list), type, ref_type);
299337}

◆ Join() [2/2]

shared_ptr< Relation > duckdb::Relation::Join ( const shared_ptr< Relation > & other,
vector< unique_ptr< ParsedExpression > > condition,
JoinType type = JoinType::INNER,
JoinRefType ref_type = JoinRefType::REGULAR )
299341 {
299342 if (expression_list.size() > 1 || expression_list[0]->GetExpressionType() == ExpressionType::COLUMN_REF) {
299343 // multiple columns or single column ref: the condition is a USING list
299344 vector<string> using_columns;
299345 for (auto &expr : expression_list) {
299346 if (expr->GetExpressionType() != ExpressionType::COLUMN_REF) {
299347 throw ParserException("Expected a single expression as join condition");
299348 }
299349 auto &colref = expr->Cast<ColumnRefExpression>();
299350 if (colref.IsQualified()) {
299351 throw ParserException("Expected unqualified column for column in USING clause");
299352 }
299353 using_columns.push_back(colref.column_names[0]);
299354 }
299355 return make_shared_ptr<JoinRelation>(shared_from_this(), other, std::move(using_columns), type, ref_type);
299356 } else {
299357 // single expression that is not a column reference: use the expression as a join condition
299358 return make_shared_ptr<JoinRelation>(shared_from_this(), other, std::move(expression_list[0]), type, ref_type);
299359 }
299360}

◆ CrossProduct()

shared_ptr< Relation > duckdb::Relation::CrossProduct ( const shared_ptr< Relation > & other,
JoinRefType join_ref_type = JoinRefType::CROSS )
299362 {
299363 return make_shared_ptr<CrossProductRelation>(shared_from_this(), other, join_ref_type);
299364}

◆ Union()

shared_ptr< Relation > duckdb::Relation::Union ( const shared_ptr< Relation > & other)
299366 {
299367 return make_shared_ptr<SetOpRelation>(shared_from_this(), other, SetOperationType::UNION, true);
299368}

◆ Except()

shared_ptr< Relation > duckdb::Relation::Except ( const shared_ptr< Relation > & other)
299370 {
299371 return make_shared_ptr<SetOpRelation>(shared_from_this(), other, SetOperationType::EXCEPT, true);
299372}

◆ Intersect()

shared_ptr< Relation > duckdb::Relation::Intersect ( const shared_ptr< Relation > & other)
299374 {
299375 return make_shared_ptr<SetOpRelation>(shared_from_this(), other, SetOperationType::INTERSECT, true);
299376}

◆ Distinct()

shared_ptr< Relation > duckdb::Relation::Distinct ( )
299378 {
299379 return make_shared_ptr<DistinctRelation>(shared_from_this());
299380}

◆ Aggregate() [1/6]

shared_ptr< Relation > duckdb::Relation::Aggregate ( const string & aggregate_list)
299386 {
299387 auto expression_list = Parser::ParseExpressionList(aggregate_list, context->GetContext()->GetParserOptions());
299388 return make_shared_ptr<AggregateRelation>(shared_from_this(), std::move(expression_list));
299389}

◆ Aggregate() [2/6]

shared_ptr< Relation > duckdb::Relation::Aggregate ( const vector< string > & aggregates)
299401 {
299402 auto aggregate_list = StringListToExpressionList(*context->GetContext(), aggregates);
299403 return make_shared_ptr<AggregateRelation>(shared_from_this(), std::move(aggregate_list));
299404}

◆ Aggregate() [3/6]

shared_ptr< Relation > duckdb::Relation::Aggregate ( vector< unique_ptr< ParsedExpression > > expressions)
299391 {
299392 return make_shared_ptr<AggregateRelation>(shared_from_this(), std::move(expressions));
299393}

◆ Aggregate() [4/6]

shared_ptr< Relation > duckdb::Relation::Aggregate ( const string & aggregate_list,
const string & group_list )
299395 {
299396 auto expression_list = Parser::ParseExpressionList(aggregate_list, context->GetContext()->GetParserOptions());
299397 auto groups = Parser::ParseGroupByList(group_list, context->GetContext()->GetParserOptions());
299398 return make_shared_ptr<AggregateRelation>(shared_from_this(), std::move(expression_list), std::move(groups));
299399}
static GroupByNode ParseGroupByList(const string &group_by, ParserOptions options=ParserOptions())
Parses a list of GROUP BY expressions.
Definition duckdb.cpp:347568

◆ Aggregate() [5/6]

shared_ptr< Relation > duckdb::Relation::Aggregate ( const vector< string > & aggregates,
const vector< string > & groups )
299406 {
299407 auto aggregate_list = StringUtil::Join(aggregates, ", ");
299408 auto group_list = StringUtil::Join(groups, ", ");
299409 return this->Aggregate(aggregate_list, group_list);
299410}
static DUCKDB_API string Join(const vector< string > &input, const string &separator)
Join multiple strings into one string. Components are concatenated by the given separator.
Definition duckdb.cpp:109497

◆ Aggregate() [6/6]

shared_ptr< Relation > duckdb::Relation::Aggregate ( vector< unique_ptr< ParsedExpression > > expressions,
const string & group_list )
299412 {
299413 auto groups = Parser::ParseGroupByList(group_list, context->GetContext()->GetParserOptions());
299414 return make_shared_ptr<AggregateRelation>(shared_from_this(), std::move(expressions), std::move(groups));
299415}

◆ Alias()

shared_ptr< Relation > duckdb::Relation::Alias ( const string & alias)
299382 {
299383 return make_shared_ptr<SubqueryRelation>(shared_from_this(), alias);
299384}

◆ InsertRel() [1/2]

shared_ptr< Relation > duckdb::Relation::InsertRel ( const string & schema_name,
const string & table_name )

Insert the data from this relation into a table.

299446 {
299447 return InsertRel(INVALID_CATALOG, schema_name, table_name);
299448}
DUCKDB_API shared_ptr< Relation > InsertRel(const string &schema_name, const string &table_name)
Insert the data from this relation into a table.
Definition duckdb.cpp:299446
Here is the call graph for this function:
Here is the caller graph for this function:

◆ InsertRel() [2/2]

shared_ptr< Relation > duckdb::Relation::InsertRel ( const string & catalog_name,
const string & schema_name,
const string & table_name )
299451 {
299452 return make_shared_ptr<InsertRelation>(shared_from_this(), catalog_name, schema_name, table_name);
299453}

◆ Insert() [1/5]

void duckdb::Relation::Insert ( const string & table_name)
299455 {
299456 Insert(INVALID_SCHEMA, table_name);
299457}

◆ Insert() [2/5]

void duckdb::Relation::Insert ( const string & schema_name,
const string & table_name )
299459 {
299460 Insert(INVALID_CATALOG, schema_name, table_name);
299461}

◆ Insert() [3/5]

void duckdb::Relation::Insert ( const string & catalog_name,
const string & schema_name,
const string & table_name )
299463 {
299464 auto insert = InsertRel(catalog_name, schema_name, table_name);
299465 auto res = insert->Execute();
299466 if (res->HasError()) {
299467 const string prepended_message = "Failed to insert into table '" + table_name + "': ";
299468 res->ThrowError(prepended_message);
299469 }
299470}

◆ Insert() [4/5]

void duckdb::Relation::Insert ( const vector< vector< Value > > & values)
virtual

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

Reimplemented in duckdb::TableRelation.

299472 {
299473 throw InvalidInputException("INSERT with values can only be used on base tables!");
299474}

◆ Insert() [5/5]

void duckdb::Relation::Insert ( vector< vector< unique_ptr< ParsedExpression > > > && expressions)
virtual
299476 {
299477 (void)std::move(expressions);
299478 throw InvalidInputException("INSERT with expressions can only be used on base tables!");
299479}

◆ CreateRel() [1/2]

shared_ptr< Relation > duckdb::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.

299482 {
299483 return CreateRel(INVALID_CATALOG, schema_name, table_name, temporary, on_conflict);
299484}
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.
Definition duckdb.cpp:299481
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CreateRel() [2/2]

shared_ptr< Relation > duckdb::Relation::CreateRel ( const string & catalog_name,
const string & schema_name,
const string & table_name,
bool temporary = false,
OnCreateConflict on_conflict = OnCreateConflict::ERROR_ON_CONFLICT )
299487 {
299488 return make_shared_ptr<CreateTableRelation>(shared_from_this(), catalog_name, schema_name, table_name, temporary,
299489 on_conflict);
299490}

◆ Create() [1/3]

void duckdb::Relation::Create ( const string & table_name,
bool temporary = false,
OnCreateConflict on_conflict = OnCreateConflict::ERROR_ON_CONFLICT )
299492 {
299493 Create(INVALID_CATALOG, INVALID_SCHEMA, table_name, temporary, on_conflict);
299494}

◆ Create() [2/3]

void duckdb::Relation::Create ( const string & schema_name,
const string & table_name,
bool temporary = false,
OnCreateConflict on_conflict = OnCreateConflict::ERROR_ON_CONFLICT )
299497 {
299498 Create(INVALID_CATALOG, schema_name, table_name, temporary, on_conflict);
299499}

◆ Create() [3/3]

void duckdb::Relation::Create ( const string & catalog_name,
const string & schema_name,
const string & table_name,
bool temporary = false,
OnCreateConflict on_conflict = OnCreateConflict::ERROR_ON_CONFLICT )
299502 {
299503 if (table_name.empty()) {
299504 throw ParserException("Empty table name not supported");
299505 }
299506 auto create = CreateRel(catalog_name, schema_name, table_name, temporary, on_conflict);
299507 auto res = create->Execute();
299508 if (res->HasError()) {
299509 const string prepended_message = "Failed to create table '" + table_name + "': ";
299510 res->ThrowError(prepended_message);
299511 }
299512}
static cv::Ptr< QuasiDenseStereo > create(cv::Size monoImgSize, cv::String paramFilepath=cv::String())

◆ WriteCSVRel()

shared_ptr< Relation > duckdb::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.

299514 {
299515 return make_shared_ptr<duckdb::WriteCSVRelation>(shared_from_this(), csv_file, std::move(options));
299516}

◆ WriteCSV()

void duckdb::Relation::WriteCSV ( const string & csv_file,
case_insensitive_map_t< vector< Value > > options = case_insensitive_map_t<vector<Value>>() )
299518 {
299519 auto write_csv = WriteCSVRel(csv_file, std::move(options));
299520 auto res = write_csv->Execute();
299521 if (res->HasError()) {
299522 const string prepended_message = "Failed to write '" + csv_file + "': ";
299523 res->ThrowError(prepended_message);
299524 }
299525}
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.
Definition duckdb.cpp:299514

◆ WriteParquetRel()

shared_ptr< Relation > duckdb::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.

299528 {
299529 auto write_parquet =
299530 make_shared_ptr<duckdb::WriteParquetRelation>(shared_from_this(), parquet_file, std::move(options));
299531 return std::move(write_parquet);
299532}

◆ WriteParquet()

void duckdb::Relation::WriteParquet ( const string & parquet_file,
case_insensitive_map_t< vector< Value > > options = case_insensitive_map_t<vector<Value>>() )
299534 {
299535 auto write_parquet = WriteParquetRel(parquet_file, std::move(options));
299536 auto res = write_parquet->Execute();
299537 if (res->HasError()) {
299538 const string prepended_message = "Failed to write '" + parquet_file + "': ";
299539 res->ThrowError(prepended_message);
299540 }
299541}
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.
Definition duckdb.cpp:299527

◆ Update() [1/2]

void duckdb::Relation::Update ( const string & update,
const string & condition = string() )
virtual

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

Reimplemented in duckdb::TableRelation.

299577 {
299578 throw InvalidInputException("UPDATE can only be used on base tables!");
299579}

◆ Update() [2/2]

void duckdb::Relation::Update ( vector< string > column_names,
vector< unique_ptr< ParsedExpression > > && update,
unique_ptr< ParsedExpression > condition = nullptr )
virtual
299583 { // NOLINT: unused variable
299584 (void)std::move(update);
299585 (void)std::move(condition);
299586 throw InvalidInputException("UPDATE can only be used on base tables!");
299587}

◆ Delete()

void duckdb::Relation::Delete ( const string & condition = string())
virtual

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

Reimplemented in duckdb::TableRelation.

299589 {
299590 throw InvalidInputException("DELETE can only be used on base tables!");
299591}

◆ TableFunction() [1/2]

shared_ptr< Relation > duckdb::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.

299599 {
299600 return make_shared_ptr<TableFunctionRelation>(context->GetContext(), fname, values, shared_from_this());
299601}

◆ TableFunction() [2/2]

shared_ptr< Relation > duckdb::Relation::TableFunction ( const std::string & fname,
const vector< Value > & values,
const named_parameter_map_t & named_parameters )
299594 {
299595 return make_shared_ptr<TableFunctionRelation>(context->GetContext(), fname, values, named_parameters,
299596 shared_from_this());
299597}

◆ InheritsColumnBindings()

virtual bool duckdb::Relation::InheritsColumnBindings ( )
inlinevirtual

Whether or not the relation inherits column bindings from its child or not, only relevant for binding.

Reimplemented in duckdb::DistinctRelation, duckdb::FilterRelation, duckdb::LimitRelation, duckdb::OrderRelation, and duckdb::SubqueryRelation.

42237 {
42238 return false;
42239 }

◆ ChildRelation()

virtual Relation * duckdb::Relation::ChildRelation ( )
inlinevirtual
42240 {
42241 return nullptr;
42242 }

◆ AddExternalDependency()

void duckdb::Relation::AddExternalDependency ( shared_ptr< ExternalDependency > dependency)
299639 {
299640 external_dependencies.push_back(std::move(dependency));
299641}

◆ GetAllDependencies()

vector< shared_ptr< ExternalDependency > > duckdb::Relation::GetAllDependencies ( )
299643 {
299644 vector<shared_ptr<ExternalDependency>> all_dependencies;
299645 Relation *cur = this;
299646 while (cur) {
299647 for (auto &dep : cur->external_dependencies) {
299648 all_dependencies.push_back(dep);
299649 }
299650 cur = cur->ChildRelation();
299651 }
299652 return all_dependencies;
299653}

◆ RenderWhitespace()

string duckdb::Relation::RenderWhitespace ( idx_t depth)
staticprotected
299635 {
299636 return string(depth * 2, ' ');
299637}

◆ Cast() [1/2]

template<class TARGET>
TARGET & duckdb::Relation::Cast ( )
inline
42251 {
42252 DynamicCastCheck<TARGET>(this);
42253 return reinterpret_cast<TARGET &>(*this);
42254 }

◆ Cast() [2/2]

template<class TARGET>
const TARGET & duckdb::Relation::Cast ( ) const
inline
42256 {
42257 DynamicCastCheck<TARGET>(this);
42258 return reinterpret_cast<const TARGET &>(*this);
42259 }

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