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

Public Member Functions

 ColumnRefExpression (string column_name, string table_name)
 Specify both the column and table name.
 ColumnRefExpression (string column_name, const BindingAlias &alias)
 Specify both the column and table alias.
 ColumnRefExpression (string column_name)
 Only specify the column name, the table name will be derived later.
 ColumnRefExpression (vector< string > column_names)
 Specify a set of names.
bool IsQualified () const
const string & GetColumnName () const
const string & GetTableName () const
bool IsScalar () const override
 Returns true if expression does not contain a group ref or col ref or parameter.
string GetName () const override
 Get the name of the expression.
string ToString () const override
 Convert the Expression to a String.
hash_t Hash () const override
unique_ptr< ParsedExpression > Copy () const override
 Create a copy of this expression.
void Serialize (Serializer &serializer) const override
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.
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 ColumnRefExpression &a, const ColumnRefExpression &b)
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

vector< string > column_names
 The stack of names in order of which they appear (column_names[0].column_names[1].column_names[2]....).
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::COLUMN_REF

Additional Inherited Members

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

Detailed Description

Represents a reference to a column from either the FROM clause or from an alias

Constructor & Destructor Documentation

◆ ColumnRefExpression() [1/5]

duckdb::ColumnRefExpression::ColumnRefExpression ( string column_name,
string table_name )

Specify both the column and table name.

336466 : ColumnRefExpression(table_name.empty() ? vector<string> {std::move(column_name)}
336467 : vector<string> {std::move(table_name), std::move(column_name)}) {
336468}
ColumnRefExpression(string column_name, string table_name)
Specify both the column and table name.
Definition duckdb.cpp:336465
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ColumnRefExpression() [2/5]

duckdb::ColumnRefExpression::ColumnRefExpression ( string column_name,
const BindingAlias & alias )

Specify both the column and table alias.

336471 : ParsedExpression(ExpressionType::COLUMN_REF, ExpressionClass::COLUMN_REF) {
336472 if (alias.IsSet()) {
336473 if (!alias.GetCatalog().empty()) {
336474 column_names.push_back(alias.GetCatalog());
336475 }
336476 if (!alias.GetSchema().empty()) {
336477 column_names.push_back(alias.GetSchema());
336478 }
336479 column_names.push_back(alias.GetAlias());
336480 }
336481 column_names.push_back(std::move(column_name));
336482}
string alias
The alias of the expression,.
Definition duckdb.hpp:13293
vector< string > column_names
The stack of names in order of which they appear (column_names[0].column_names[1]....
Definition duckdb.cpp:617
ParsedExpression(ExpressionType type, ExpressionClass expression_class)
Create an Expression.
Definition duckdb.hpp:13557
Here is the call graph for this function:

◆ ColumnRefExpression() [3/5]

duckdb::ColumnRefExpression::ColumnRefExpression ( string column_name)
explicit

Only specify the column name, the table name will be derived later.

336485 : ColumnRefExpression(vector<string> {std::move(column_name)}) {
336486}
Here is the call graph for this function:

◆ ColumnRefExpression() [4/5]

duckdb::ColumnRefExpression::ColumnRefExpression ( vector< string > column_names)
explicit

Specify a set of names.

336489 : ParsedExpression(ExpressionType::COLUMN_REF, ExpressionClass::COLUMN_REF),
336490 column_names(std::move(column_names_p)) {
336491#ifdef DEBUG
336492 for (auto &col_name : column_names) {
336493 D_ASSERT(!col_name.empty());
336494 }
336495#endif
336496}
Here is the call graph for this function:

◆ ColumnRefExpression() [5/5]

duckdb::ColumnRefExpression::ColumnRefExpression ( )
private
336462 : ParsedExpression(ExpressionType::COLUMN_REF, ExpressionClass::COLUMN_REF) {
336463}

Member Function Documentation

◆ IsQualified()

bool duckdb::ColumnRefExpression::IsQualified ( ) const
336498 {
336499 return column_names.size() > 1;
336500}

◆ GetColumnName()

const string & duckdb::ColumnRefExpression::GetColumnName ( ) const
336502 {
336503 D_ASSERT(column_names.size() <= 4);
336504 return column_names.back();
336505}

◆ GetTableName()

const string & duckdb::ColumnRefExpression::GetTableName ( ) const
336507 {
336508 D_ASSERT(column_names.size() >= 2 && column_names.size() <= 4);
336509 if (column_names.size() == 4) {
336510 return column_names[2];
336511 }
336512 if (column_names.size() == 3) {
336513 return column_names[1];
336514 }
336515 return column_names[0];
336516}

◆ IsScalar()

bool duckdb::ColumnRefExpression::IsScalar ( ) const
inlineoverridevirtual

Returns true if expression does not contain a group ref or col ref or parameter.

Implements duckdb::BaseExpression.

623 {
624 return false;
625 }

◆ GetName()

string duckdb::ColumnRefExpression::GetName ( ) const
overridevirtual

Get the name of the expression.

Reimplemented from duckdb::BaseExpression.

336518 {
336519 return !alias.empty() ? alias : column_names.back();
336520}
Here is the caller graph for this function:

◆ ToString()

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

Convert the Expression to a String.

Implements duckdb::BaseExpression.

336522 {
336523 string result;
336524 for (idx_t i = 0; i < column_names.size(); i++) {
336525 if (i > 0) {
336526 result += ".";
336527 }
336529 }
336530 return result;
336531}
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
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237
Here is the call graph for this function:

◆ Equal()

bool duckdb::ColumnRefExpression::Equal ( const ColumnRefExpression & a,
const ColumnRefExpression & b )
static
336533 {
336534 if (a.column_names.size() != b.column_names.size()) {
336535 return false;
336536 }
336537 for (idx_t i = 0; i < a.column_names.size(); i++) {
336538 if (!StringUtil::CIEquals(a.column_names[i], b.column_names[i])) {
336539 return false;
336540 }
336541 }
336542 return true;
336543}
static DUCKDB_API bool CIEquals(const string &l1, const string &l2)
Case insensitive equals.
Definition duckdb.cpp:109696

◆ Hash()

hash_t duckdb::ColumnRefExpression::Hash ( ) const
overridevirtual

Creates a hash value of this expression. It is important that if two expressions are identical (i.e. Expression::Equals() returns true), that their hash value is identical as well.

Implements duckdb::BaseExpression.

336545 {
336546 hash_t result = ParsedExpression::Hash();
336547 for (auto &column_name : column_names) {
336548 result = CombineHash(result, StringUtil::CIHash(column_name));
336549 }
336550 return result;
336551}
hash_t Hash() const override
Definition duckdb.cpp:340509
static DUCKDB_API uint64_t CIHash(const string &str)
Case insensitive hash.
Definition duckdb.cpp:109666
uint64_t hash_t
The type used for hashes.
Definition duckdb.hpp:243
hash_t CombineHash(hash_t left, hash_t right)
Combine two hashes by XORing them.
Definition duckdb.hpp:4635
Here is the call graph for this function:

◆ Copy()

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

Create a copy of this expression.

Implements duckdb::ParsedExpression.

336553 {
336554 auto copy = make_uniq<ColumnRefExpression>(column_names);
336555 copy->CopyProperties(*this);
336556 return std::move(copy);
336557}

◆ Serialize()

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

Reimplemented from duckdb::ParsedExpression.

418781 {
418782 ParsedExpression::Serialize(serializer);
418783 serializer.WritePropertyWithDefault<vector<string>>(200, "column_names", column_names);
418784}

◆ Deserialize()

unique_ptr< ParsedExpression > duckdb::ColumnRefExpression::Deserialize ( Deserializer & deserializer)
static
418786 {
418787 auto result = duckdb::unique_ptr<ColumnRefExpression>(new ColumnRefExpression());
418788 deserializer.ReadPropertyWithDefault<vector<string>>(200, "column_names", result->column_names);
418789 return std::move(result);
418790}

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