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
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 >
TARGETCast ()
 
template<class TARGET >
const TARGETCast () 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

◆ ~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 }

◆ GetExpressionType()

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

Returns the type of the expression.

13238 {
13239 return type;
13240 }

◆ 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

◆ 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 }

◆ 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::ParsedExpression, and duckdb::Expression.

◆ IsWindow()

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

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

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

◆ HasSubquery()

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

Returns true if the query contains a subquery.

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

◆ IsScalar()

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

◆ HasParameter()

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

Returns true if the expression has a parameter.

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

◆ GetName()

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

Get the name of the expression.

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

◆ ToString()

◆ Hash()

◆ Equals() [1/2]

virtual bool duckdb::BaseExpression::Equals ( const BaseExpression other) const
virtual

◆ Equals() [2/2]

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

◆ 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 file: