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::BaseExpression Class Referenceabstract

#include <duckdb.hpp>

Inheritance diagram for duckdb::BaseExpression:
Collaboration diagram for duckdb::BaseExpression:

Public Member Functions

 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 bool IsAggregate () const =0
 Returns true if this expression is an aggregate or not.
virtual bool IsWindow () const =0
 Returns true if the expression has a window function or not.
virtual bool HasSubquery () const =0
 Returns true if the query contains a subquery.
virtual bool IsScalar () const =0
 Returns true if expression does not contain a group ref or col ref or parameter.
virtual bool HasParameter () const =0
 Returns true if the expression has a parameter.
virtual string GetName () const
 Get the name of the expression.
virtual string ToString () const =0
 Convert the Expression to a String.
void Print () const
 Print the expression to stdout.
virtual hash_t Hash () const =0
virtual bool Equals (const BaseExpression &other) const
 Returns true if this expression is equal to another expression.
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 Equals (const BaseExpression &left, const BaseExpression &right)

Public Attributes

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).

Detailed Description

The BaseExpression class is a base class that can represent any expression part of a SQL statement.

Constructor & Destructor Documentation

◆ BaseExpression()

duckdb::BaseExpression::BaseExpression ( ExpressionType type,
ExpressionClass expression_class )
inline

Create an Expression.

13228 }
ExpressionClass expression_class
The expression class of the node.
Definition duckdb.hpp:13290
ExpressionType type
Type of the expression.
Definition duckdb.hpp:13287
Here is the caller graph for this function:

◆ ~BaseExpression()

virtual duckdb::BaseExpression::~BaseExpression ( )
inlinevirtual
13229 {
13230 }

Member Function Documentation

◆ GetExpressionClass()

ExpressionClass duckdb::BaseExpression::GetExpressionClass ( ) const
inline

Returns the class of the expression.

13233 {
13234 return expression_class;
13235 }
Here is the caller graph for this function:

◆ GetExpressionType()

ExpressionType duckdb::BaseExpression::GetExpressionType ( ) const
inline

Returns the type of the expression.

13238 {
13239 return type;
13240 }
Here is the caller graph for this function:

◆ SetExpressionTypeUnsafe()

void duckdb::BaseExpression::SetExpressionTypeUnsafe ( ExpressionType new_type)
inline

Sets the type of the expression unsafely. In general expressions are immutable and should not be changed after creation. Only use this if you know what you are doing.

13244 {
13245 type = new_type;
13246 }

◆ GetQueryLocation()

optional_idx duckdb::BaseExpression::GetQueryLocation ( ) const
inline

Returns the location in the query (if any).

13249 {
13250 return query_location;
13251 }
optional_idx query_location
The location in the query (if any).
Definition duckdb.hpp:13296
Here is the caller graph for this function:

◆ SetQueryLocation()

void duckdb::BaseExpression::SetQueryLocation ( optional_idx location)
inline

Sets the location in the query.

13254 {
13255 query_location = location;
13256 }

◆ HasAlias()

bool duckdb::BaseExpression::HasAlias ( ) const
inline

Returns true if the expression has a non-empty alias.

13259 {
13260 return !alias.empty();
13261 }
string alias
The alias of the expression,.
Definition duckdb.hpp:13293

◆ GetAlias()

const string & duckdb::BaseExpression::GetAlias ( ) const
inline

Returns the alias of the expression.

13264 {
13265 return alias;
13266 }
Here is the caller graph for this function:

◆ SetAlias() [1/2]

void duckdb::BaseExpression::SetAlias ( const string & alias_p)
inline

Sets the alias of the expression.

13269 {
13270 alias = alias_p;
13271 }

◆ SetAlias() [2/2]

void duckdb::BaseExpression::SetAlias ( string && alias_p)
inline

Sets the alias of the expression.

13274 {
13275 alias = std::move(alias_p);
13276 }

◆ ClearAlias()

void duckdb::BaseExpression::ClearAlias ( )
inline

Clears the alias of the expression.

13279 {
13280 alias.clear();
13281 }

◆ IsAggregate()

virtual bool duckdb::BaseExpression::IsAggregate ( ) const
pure virtual

Returns true if this expression is an aggregate or not.

Examples:

(1) SUM(a) + 1 – True

(2) a + 1 – False

Implemented in duckdb::BoundAggregateExpression, duckdb::Expression, and duckdb::ParsedExpression.

◆ IsWindow()

virtual bool duckdb::BaseExpression::IsWindow ( ) const
pure virtual

Returns true if the expression has a window function or not.

Implemented in duckdb::BoundWindowExpression, duckdb::Expression, duckdb::ParsedExpression, and duckdb::WindowExpression.

◆ HasSubquery()

virtual bool duckdb::BaseExpression::HasSubquery ( ) const
pure virtual

Returns true if the query contains a subquery.

Implemented in duckdb::BoundSubqueryExpression, duckdb::Expression, duckdb::ParsedExpression, and duckdb::SubqueryExpression.

◆ IsScalar()

◆ HasParameter()

virtual bool duckdb::BaseExpression::HasParameter ( ) const
pure virtual

Returns true if the expression has a parameter.

Implemented in duckdb::BoundParameterExpression, duckdb::Expression, duckdb::ParameterExpression, and duckdb::ParsedExpression.

◆ GetName()

string duckdb::BaseExpression::GetName ( ) const
virtual

Get the name of the expression.

Reimplemented in duckdb::BoundColumnRefExpression, duckdb::ColumnRefExpression, and duckdb::LambdaRefExpression.

335551 {
335552#ifdef DEBUG
335554 return ToString();
335555 }
335556#endif
335557 return !alias.empty() ? alias : ToString();
335558}
virtual string ToString() const =0
Convert the Expression to a String.
static bool debug_print_bindings
Whether to print bindings when printing the plan (debug mode only).
Definition duckdb.hpp:40040
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ToString()

◆ Print()

void duckdb::BaseExpression::Print ( ) const

Print the expression to stdout.

335547 {
335549}
static DUCKDB_API void Print(OutputStream stream, const string &str)
Print the object to the stream.
Definition duckdb.cpp:92556
Here is the call graph for this function:

◆ Hash()

◆ Equals() [1/2]

◆ Equals() [2/2]

bool duckdb::BaseExpression::Equals ( const BaseExpression & left,
const BaseExpression & right )
inlinestatic
13330 {
13331 return left.Equals(right);
13332 }

◆ operator==()

bool duckdb::BaseExpression::operator== ( const BaseExpression & rhs) const
inline
13333 {
13334 return Equals(rhs);
13335 }
virtual bool Equals(const BaseExpression &other) const
Returns true if this expression is equal to another expression.
Definition duckdb.cpp:335560

◆ Verify()

void duckdb::BaseExpression::Verify ( ) const
virtual
335567 {
335568}

◆ Cast() [1/2]

template<class TARGET>
TARGET & duckdb::BaseExpression::Cast ( )
inline
13341 {
13342 if (expression_class != TARGET::TYPE) {
13343 throw InternalException("Failed to cast expression to type - expression type mismatch");
13344 }
13345 return reinterpret_cast<TARGET &>(*this);
13346 }

◆ Cast() [2/2]

template<class TARGET>
const TARGET & duckdb::BaseExpression::Cast ( ) const
inline
13349 {
13350 if (expression_class != TARGET::TYPE) {
13351 throw InternalException("Failed to cast expression to type - expression type mismatch");
13352 }
13353 return reinterpret_cast<const TARGET &>(*this);
13354 }

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