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::StarExpression Class Reference

Represents a * expression in the SELECT clause. More...

Inheritance diagram for duckdb::StarExpression:
Collaboration diagram for duckdb::StarExpression:

Public Member Functions

 StarExpression (string relation_name=string())
string ToString () const override
 Convert the Expression to a String.
unique_ptr< ParsedExpression > Copy () const override
 Create a copy of this expression.
void Serialize (Serializer &serializer) const override
 StarExpression (const case_insensitive_set_t &exclude_list, qualified_column_set_t qualified_set)
case_insensitive_set_t SerializedExcludeList () const
qualified_column_set_t SerializedQualifiedExcludeList () const
Public Member Functions inherited from duckdb::ParsedExpression
 ParsedExpression (ExpressionType type, ExpressionClass expression_class)
 Create an Expression.
bool IsAggregate () const override
 Returns true if this expression is an aggregate or not.
bool IsWindow () const override
 Returns true if the expression has a window function or not.
bool HasSubquery () const override
 Returns true if the query contains a subquery.
bool IsScalar () const override
 Returns true if expression does not contain a group ref or col ref or parameter.
bool HasParameter () const override
 Returns true if the expression has a parameter.
bool Equals (const BaseExpression &other) const override
 Returns true if this expression is equal to another expression.
hash_t Hash () const override
Public Member Functions inherited from duckdb::BaseExpression
 BaseExpression (ExpressionType type, ExpressionClass expression_class)
 Create an Expression.
ExpressionClass GetExpressionClass () const
 Returns the class of the expression.
ExpressionType GetExpressionType () const
 Returns the type of the expression.
void SetExpressionTypeUnsafe (ExpressionType new_type)
optional_idx GetQueryLocation () const
 Returns the location in the query (if any).
void SetQueryLocation (optional_idx location)
 Sets the location in the query.
bool HasAlias () const
 Returns true if the expression has a non-empty alias.
const string & GetAlias () const
 Returns the alias of the expression.
void SetAlias (const string &alias_p)
 Sets the alias of the expression.
void SetAlias (string &&alias_p)
 Sets the alias of the expression.
void ClearAlias ()
 Clears the alias of the expression.
virtual string GetName () const
 Get the name of the expression.
void Print () const
 Print the expression to stdout.
bool operator== (const BaseExpression &rhs) const
virtual void Verify () const
template<class TARGET>
TARGET & Cast ()
template<class TARGET>
const TARGET & Cast () const

Static Public Member Functions

static bool Equal (const StarExpression &a, const StarExpression &b)
static bool IsStar (const ParsedExpression &a)
static bool IsColumns (const ParsedExpression &a)
static bool IsColumnsUnpacked (const ParsedExpression &a)
static unique_ptr< ParsedExpression > DeserializeStarExpression (string &&relation_name, const case_insensitive_set_t &exclude_list, case_insensitive_map_t< unique_ptr< ParsedExpression > > &&replace_list, bool columns, unique_ptr< ParsedExpression > expr, bool unpacked, const qualified_column_set_t &qualified_exclude_list, qualified_column_map_t< string > &&rename_list)
static unique_ptr< ParsedExpression > Deserialize (Deserializer &deserializer)
Static Public Member Functions inherited from duckdb::ParsedExpression
static unique_ptr< ParsedExpression > Deserialize (Deserializer &deserializer)
static bool Equals (const unique_ptr< ParsedExpression > &left, const unique_ptr< ParsedExpression > &right)
static bool ListEquals (const vector< unique_ptr< ParsedExpression > > &left, const vector< unique_ptr< ParsedExpression > > &right)
Static Public Member Functions inherited from duckdb::BaseExpression
static bool Equals (const BaseExpression &left, const BaseExpression &right)

Public Attributes

string relation_name
 The relation name in case of tbl.*, or empty if this is a normal *.
qualified_column_set_t exclude_list
 List of columns to exclude from the STAR expression.
case_insensitive_map_t< unique_ptr< ParsedExpression > > replace_list
 List of columns to replace with another expression.
qualified_column_map_t< string > rename_list
 List of columns to rename.
unique_ptr< ParsedExpression > expr
 The expression to select the columns (regular expression or list).
bool columns = false
 Whether or not this is a COLUMNS expression.
Public Attributes inherited from duckdb::BaseExpression
ExpressionType type
 Type of the expression.
ExpressionClass expression_class
 The expression class of the node.
string alias
 The alias of the expression,.
optional_idx query_location
 The location in the query (if any).

Static Public Attributes

static constexpr const ExpressionClass TYPE = ExpressionClass::STAR

Additional Inherited Members

Protected Member Functions inherited from duckdb::ParsedExpression
void CopyProperties (const ParsedExpression &other)

Detailed Description

Represents a * expression in the SELECT clause.

Constructor & Destructor Documentation

◆ StarExpression() [1/2]

duckdb::StarExpression::StarExpression ( string relation_name = string())
explicit
337360 : ParsedExpression(ExpressionType::STAR, ExpressionClass::STAR), relation_name(std::move(relation_name_p)) {
337361}
ParsedExpression(ExpressionType type, ExpressionClass expression_class)
Create an Expression.
Definition duckdb.hpp:13557
string relation_name
The relation name in case of tbl.*, or empty if this is a normal *.
Definition duckdb.cpp:1705

◆ StarExpression() [2/2]

duckdb::StarExpression::StarExpression ( const case_insensitive_set_t & exclude_list,
qualified_column_set_t qualified_set )
337504 : ParsedExpression(ExpressionType::STAR, ExpressionClass::STAR), exclude_list(std::move(qualified_set)) {
337505 for (auto &entry : exclude_list_p) {
337506 exclude_list.insert(QualifiedColumnName(entry));
337507 }
337508}
qualified_column_set_t exclude_list
List of columns to exclude from the STAR expression.
Definition duckdb.cpp:1707

Member Function Documentation

◆ ToString()

string duckdb::StarExpression::ToString ( ) const
overridevirtual

Convert the Expression to a String.

Implements duckdb::BaseExpression.

337363 {
337364 string result;
337365 if (expr) {
337366 D_ASSERT(columns);
337367 result += "COLUMNS(" + expr->ToString() + ")";
337368 return result;
337369 }
337370 if (columns) {
337371 result += "COLUMNS(";
337372 }
337373 result += relation_name.empty() ? "*" : relation_name + ".*";
337374 if (!exclude_list.empty()) {
337375 result += " EXCLUDE (";
337376 bool first_entry = true;
337377 for (auto &entry : exclude_list) {
337378 if (!first_entry) {
337379 result += ", ";
337380 }
337381 result += entry.ToString();
337382 first_entry = false;
337383 }
337384 result += ")";
337385 }
337386 if (!replace_list.empty()) {
337387 result += " REPLACE (";
337388 bool first_entry = true;
337389 for (auto &entry : replace_list) {
337390 if (!first_entry) {
337391 result += ", ";
337392 }
337393 result += entry.second->ToString();
337394 result += " AS ";
337395 result += KeywordHelper::WriteOptionallyQuoted(entry.first);
337396 first_entry = false;
337397 }
337398 result += ")";
337399 }
337400 if (!rename_list.empty()) {
337401 result += " RENAME (";
337402 bool first_entry = true;
337403 for (auto &entry : rename_list) {
337404 if (!first_entry) {
337405 result += ", ";
337406 }
337407 result += entry.first.ToString();
337408 result += " AS ";
337409 result += KeywordHelper::WriteOptionallyQuoted(entry.second);
337410 first_entry = false;
337411 }
337412 result += ")";
337413 }
337414 if (columns) {
337415 result += ")";
337416 }
337417 return result;
337418}
static string WriteOptionallyQuoted(const string &text, char quote='"', bool allow_caps = true, KeywordCategory category = KeywordCategory::KEYWORD_NONE)
Writes a string that is optionally quoted + escaped so it can be used as an identifier.
Definition duckdb.cpp:338034
unique_ptr< ParsedExpression > expr
The expression to select the columns (regular expression or list).
Definition duckdb.cpp:1713
case_insensitive_map_t< unique_ptr< ParsedExpression > > replace_list
List of columns to replace with another expression.
Definition duckdb.cpp:1709
qualified_column_map_t< string > rename_list
List of columns to rename.
Definition duckdb.cpp:1711
bool columns
Whether or not this is a COLUMNS expression.
Definition duckdb.cpp:1715
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Equal()

bool duckdb::StarExpression::Equal ( const StarExpression & a,
const StarExpression & b )
static
337420 {
337421 if (a.relation_name != b.relation_name || a.exclude_list != b.exclude_list || a.rename_list != b.rename_list) {
337422 return false;
337423 }
337424 if (a.columns != b.columns) {
337425 return false;
337426 }
337427 if (a.replace_list.size() != b.replace_list.size()) {
337428 return false;
337429 }
337430 for (auto &entry : a.replace_list) {
337431 auto other_entry = b.replace_list.find(entry.first);
337432 if (other_entry == b.replace_list.end()) {
337433 return false;
337434 }
337435 if (!entry.second->Equals(*other_entry->second)) {
337436 return false;
337437 }
337438 }
337439 if (!ParsedExpression::Equals(a.expr, b.expr)) {
337440 return false;
337441 }
337442 return true;
337443}
bool Equals(const BaseExpression &other) const override
Returns true if this expression is equal to another expression.
Definition duckdb.cpp:340462

◆ IsStar()

bool duckdb::StarExpression::IsStar ( const ParsedExpression & a)
static
337445 {
337446 if (a.GetExpressionClass() != ExpressionClass::STAR) {
337447 return false;
337448 }
337449 auto &star = a.Cast<StarExpression>();
337450 return star.columns == false;
337451}

◆ IsColumns()

bool duckdb::StarExpression::IsColumns ( const ParsedExpression & a)
static
337453 {
337454 if (a.GetExpressionClass() != ExpressionClass::STAR) {
337455 return false;
337456 }
337457 auto &star = a.Cast<StarExpression>();
337458 return star.columns == true;
337459}

◆ IsColumnsUnpacked()

bool duckdb::StarExpression::IsColumnsUnpacked ( const ParsedExpression & a)
static
337461 {
337462 if (a.GetExpressionType() != ExpressionType::OPERATOR_UNPACK) {
337463 return false;
337464 }
337465 return true;
337466}

◆ Copy()

unique_ptr< ParsedExpression > duckdb::StarExpression::Copy ( ) const
overridevirtual

Create a copy of this expression.

Implements duckdb::ParsedExpression.

337490 {
337491 auto copy = make_uniq<StarExpression>(relation_name);
337492 copy->exclude_list = exclude_list;
337493 for (auto &entry : replace_list) {
337494 copy->replace_list[entry.first] = entry.second->Copy();
337495 }
337496 copy->rename_list = rename_list;
337497 copy->columns = columns;
337498 copy->expr = expr ? expr->Copy() : nullptr;
337499 copy->CopyProperties(*this);
337500 return std::move(copy);
337501}
Here is the caller graph for this function:

◆ DeserializeStarExpression()

unique_ptr< ParsedExpression > duckdb::StarExpression::DeserializeStarExpression ( string && relation_name,
const case_insensitive_set_t & exclude_list,
case_insensitive_map_t< unique_ptr< ParsedExpression > > && replace_list,
bool columns,
unique_ptr< ParsedExpression > expr,
bool unpacked,
const qualified_column_set_t & qualified_exclude_list,
qualified_column_map_t< string > && rename_list )
static

This was previously a member of StarExpression, but not anymore We wrap it into an OPERATOR_UNPACK instead

337473 {
337474 auto result = duckdb::unique_ptr<StarExpression>(new StarExpression(exclude_list, qualified_exclude_list));
337475 result->relation_name = std::move(relation_name);
337476 result->replace_list = std::move(replace_list);
337477 result->columns = columns;
337478 result->expr = std::move(expr);
337479 result->rename_list = std::move(rename_list);
337480 if (unpacked) {
337483 vector<unique_ptr<ParsedExpression>> unpack_children;
337484 unpack_children.push_back(std::move(result));
337485 return make_uniq<OperatorExpression>(ExpressionType::OPERATOR_UNPACK, std::move(unpack_children));
337486 }
337487 return std::move(result);
337488}

◆ Serialize()

void duckdb::StarExpression::Serialize ( Serializer & serializer) const
overridevirtual

Reimplemented from duckdb::ParsedExpression.

418927 {
418928 ParsedExpression::Serialize(serializer);
418929 serializer.WritePropertyWithDefault<string>(200, "relation_name", relation_name);
418930 serializer.WriteProperty<case_insensitive_set_t>(201, "exclude_list", SerializedExcludeList());
418931 serializer.WritePropertyWithDefault<case_insensitive_map_t<unique_ptr<ParsedExpression>>>(202, "replace_list", replace_list);
418932 serializer.WritePropertyWithDefault<bool>(203, "columns", columns);
418933 serializer.WritePropertyWithDefault<unique_ptr<ParsedExpression>>(204, "expr", expr);
418934 /* [Deleted] (bool) "unpacked" */
418935 serializer.WritePropertyWithDefault<qualified_column_set_t>(206, "qualified_exclude_list", SerializedQualifiedExcludeList(), qualified_column_set_t());
418936 serializer.WritePropertyWithDefault<qualified_column_map_t<string>>(207, "rename_list", rename_list, qualified_column_map_t<string>());
418937}

◆ Deserialize()

unique_ptr< ParsedExpression > duckdb::StarExpression::Deserialize ( Deserializer & deserializer)
static
418939 {
418940 auto relation_name = deserializer.ReadPropertyWithDefault<string>(200, "relation_name");
418941 auto exclude_list = deserializer.ReadProperty<case_insensitive_set_t>(201, "exclude_list");
418942 auto replace_list = deserializer.ReadPropertyWithDefault<case_insensitive_map_t<unique_ptr<ParsedExpression>>>(202, "replace_list");
418943 auto columns = deserializer.ReadPropertyWithDefault<bool>(203, "columns");
418944 auto expr = deserializer.ReadPropertyWithDefault<unique_ptr<ParsedExpression>>(204, "expr");
418945 auto unpacked = deserializer.ReadPropertyWithExplicitDefault<bool>(205, "unpacked", false);
418946 auto qualified_exclude_list = deserializer.ReadPropertyWithExplicitDefault<qualified_column_set_t>(206, "qualified_exclude_list", qualified_column_set_t());
418947 auto rename_list = deserializer.ReadPropertyWithExplicitDefault<qualified_column_map_t<string>>(207, "rename_list", qualified_column_map_t<string>());
418948 auto result = StarExpression::DeserializeStarExpression(std::move(relation_name), exclude_list, std::move(replace_list), columns, std::move(expr), unpacked, qualified_exclude_list, std::move(rename_list));
418949 return result;
418950}
static unique_ptr< ParsedExpression > DeserializeStarExpression(string &&relation_name, const case_insensitive_set_t &exclude_list, case_insensitive_map_t< unique_ptr< ParsedExpression > > &&replace_list, bool columns, unique_ptr< ParsedExpression > expr, bool unpacked, const qualified_column_set_t &qualified_exclude_list, qualified_column_map_t< string > &&rename_list)
Definition duckdb.cpp:337469

◆ SerializedExcludeList()

case_insensitive_set_t duckdb::StarExpression::SerializedExcludeList ( ) const
337510 {
337511 // we serialize non-qualified elements in a separate list of only column names for backwards compatibility
337512 case_insensitive_set_t result;
337513 for (auto &entry : exclude_list) {
337514 if (!entry.IsQualified()) {
337515 result.insert(entry.column);
337516 }
337517 }
337518 return result;
337519}

◆ SerializedQualifiedExcludeList()

qualified_column_set_t duckdb::StarExpression::SerializedQualifiedExcludeList ( ) const
337521 {
337522 // we serialize only qualified elements in the qualified list for backwards compatibility
337523 qualified_column_set_t result;
337524 for (auto &entry : exclude_list) {
337525 if (entry.IsQualified()) {
337526 result.insert(entry);
337527 }
337528 }
337529 return result;
337530}

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