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

Represents a reference to a lambda parameter. More...

Inheritance diagram for duckdb::LambdaRefExpression:
Collaboration diagram for duckdb::LambdaRefExpression:

Public Member Functions

 LambdaRefExpression (idx_t lambda_idx, string column_name_p)
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 unique_ptr< ParsedExpression > FindMatchingBinding (optional_ptr< vector< DummyBinding > > &lambda_bindings, const string &parameter_name)
 Traverses the lambda_bindings to find a matching binding for the column_name.
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

idx_t lambda_idx
 The index of the lambda parameter in the lambda_bindings vector.
string column_name
 The name of the lambda parameter (in a specific Binding in lambda_bindings).
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::LAMBDA_REF

Additional Inherited Members

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

Detailed Description

Represents a reference to a lambda parameter.

Constructor & Destructor Documentation

◆ LambdaRefExpression()

duckdb::LambdaRefExpression::LambdaRefExpression ( idx_t lambda_idx,
string column_name_p )

Constructs a LambdaRefExpression from a lambda_idx and a column_name. We do not specify a table name, because we use dummy tables to bind lambda parameters

337010 : ParsedExpression(ExpressionType::LAMBDA_REF, ExpressionClass::LAMBDA_REF), lambda_idx(lambda_idx),
337011 column_name(std::move(column_name_p)) {
337012 alias = column_name;
337013}
string alias
The alias of the expression,.
Definition duckdb.hpp:13293
idx_t lambda_idx
The index of the lambda parameter in the lambda_bindings vector.
Definition duckdb.cpp:812
string column_name
The name of the lambda parameter (in a specific Binding in lambda_bindings).
Definition duckdb.cpp:814
ParsedExpression(ExpressionType type, ExpressionClass expression_class)
Create an Expression.
Definition duckdb.hpp:13557
Here is the call graph for this function:

Member Function Documentation

◆ IsScalar()

bool duckdb::LambdaRefExpression::IsScalar ( ) const
overridevirtual

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

Implements duckdb::BaseExpression.

337015 {
337016 throw InternalException("lambda reference expressions are transient, IsScalar should never be called");
337017}

◆ GetName()

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

Get the name of the expression.

Reimplemented from duckdb::BaseExpression.

337019 {
337020 return column_name;
337021}
Here is the caller graph for this function:

◆ ToString()

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

Convert the Expression to a String.

Implements duckdb::BaseExpression.

337023 {
337024 throw InternalException("lambda reference expressions are transient, ToString should never be called");
337025}

◆ Hash()

hash_t duckdb::LambdaRefExpression::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.

337027 {
337028 hash_t result = ParsedExpression::Hash();
337029 result = CombineHash(result, lambda_idx);
337030 result = CombineHash(result, StringUtil::CIHash(column_name));
337031 return result;
337032}
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::LambdaRefExpression::Copy ( ) const
overridevirtual

Create a copy of this expression.

Implements duckdb::ParsedExpression.

337034 {
337035 throw InternalException("lambda reference expressions are transient, Copy should never be called");
337036}

◆ FindMatchingBinding()

unique_ptr< ParsedExpression > duckdb::LambdaRefExpression::FindMatchingBinding ( optional_ptr< vector< DummyBinding > > & lambda_bindings,
const string & parameter_name )
static

Traverses the lambda_bindings to find a matching binding for the column_name.

337040 {
337041 // if this is a lambda parameter, then we temporarily add a BoundLambdaRef,
337042 // which we capture and remove later
337043
337044 // inner lambda parameters have precedence over outer lambda parameters, and
337045 // lambda parameters have precedence over macros and columns
337046
337047 if (lambda_bindings) {
337048 for (idx_t i = lambda_bindings->size(); i > 0; i--) {
337049 if ((*lambda_bindings)[i - 1].HasMatchingBinding(column_name)) {
337050 D_ASSERT((*lambda_bindings)[i - 1].GetBindingAlias().IsSet());
337051 return make_uniq<LambdaRefExpression>(i - 1, column_name);
337052 }
337053 }
337054 }
337055
337056 return nullptr;
337057}
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237
Here is the caller graph for this function:

◆ Serialize()

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

Reimplemented from duckdb::ParsedExpression.

418881 {
418882 ParsedExpression::Serialize(serializer);
418883 serializer.WritePropertyWithDefault<idx_t>(200, "lambda_idx", lambda_idx);
418884 serializer.WritePropertyWithDefault<string>(201, "column_name", column_name);
418885}

◆ Deserialize()

unique_ptr< ParsedExpression > duckdb::LambdaRefExpression::Deserialize ( Deserializer & deserializer)
static
418887 {
418888 auto lambda_idx = deserializer.ReadPropertyWithDefault<idx_t>(200, "lambda_idx");
418889 auto column_name = deserializer.ReadPropertyWithDefault<string>(201, "column_name");
418890 auto result = duckdb::unique_ptr<LambdaRefExpression>(new LambdaRefExpression(lambda_idx, std::move(column_name)));
418891 return std::move(result);
418892}
LambdaRefExpression(idx_t lambda_idx, string column_name_p)
Definition duckdb.cpp:337009

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