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

Public Member Functions

 BoundAggregateExpression (AggregateFunction function, vector< unique_ptr< Expression > > children, unique_ptr< Expression > filter, unique_ptr< FunctionData > bind_info, AggregateType aggr_type)
bool IsDistinct () const
bool IsAggregate () const override
 Returns true if this expression is an aggregate or not.
bool IsFoldable () const override
bool PropagatesNullValues () const override
string ToString () const override
 Convert the Expression to a String.
hash_t Hash () const override
bool Equals (const BaseExpression &other) const override
 Returns true if this expression is equal to another expression.
unique_ptr< Expression > Copy () const override
 Create a copy of this expression.
void Serialize (Serializer &serializer) const override
Public Member Functions inherited from duckdb::Expression
 Expression (ExpressionType type, ExpressionClass expression_class, LogicalType return_type)
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.
virtual bool IsVolatile () const
virtual bool IsConsistent () const
virtual bool CanThrow () const
hash_t Hash () const override
bool Equals (const BaseExpression &other) const override
 Returns true if this expression is equal to another expression.
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 unique_ptr< Expression > Deserialize (Deserializer &deserializer)
Static Public Member Functions inherited from duckdb::Expression
static bool Equals (const Expression &left, const Expression &right)
static bool Equals (const unique_ptr< Expression > &left, const unique_ptr< Expression > &right)
static bool ListEquals (const vector< unique_ptr< Expression > > &left, const vector< unique_ptr< Expression > > &right)
static unique_ptr< Expression > Deserialize (Deserializer &deserializer)
Static Public Member Functions inherited from duckdb::BaseExpression
static bool Equals (const BaseExpression &left, const BaseExpression &right)

Public Attributes

AggregateFunction function
 The bound function expression.
vector< unique_ptr< Expression > > children
 List of arguments to the function.
unique_ptr< FunctionData > bind_info
 The bound function data (if any).
AggregateType aggr_type
 The aggregate type (distinct or non-distinct).
unique_ptr< Expression > filter
 Filter for this aggregate.
unique_ptr< BoundOrderModifier > order_bys
 The order by expression for this aggregate - if any.
Public Attributes inherited from duckdb::Expression
LogicalType return_type
 The return type of the expression.
unique_ptr< BaseStatistics > verification_stats
 Expression statistics (if any) - ONLY USED FOR VERIFICATION.
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::BOUND_AGGREGATE

Additional Inherited Members

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

Constructor & Destructor Documentation

◆ BoundAggregateExpression()

duckdb::BoundAggregateExpression::BoundAggregateExpression ( AggregateFunction function,
vector< unique_ptr< Expression > > children,
unique_ptr< Expression > filter,
unique_ptr< FunctionData > bind_info,
AggregateType aggr_type )
375562 : Expression(ExpressionType::BOUND_AGGREGATE, ExpressionClass::BOUND_AGGREGATE, function.GetReturnType()),
375563 function(std::move(function)), children(std::move(children)), bind_info(std::move(bind_info)),
375564 aggr_type(aggr_type), filter(std::move(filter)) {
375565 D_ASSERT(!this->function.name.empty());
375566}
unique_ptr< Expression > filter
Filter for this aggregate.
Definition duckdb.cpp:99023
vector< unique_ptr< Expression > > children
List of arguments to the function.
Definition duckdb.cpp:99016
AggregateType aggr_type
The aggregate type (distinct or non-distinct).
Definition duckdb.cpp:99020
unique_ptr< FunctionData > bind_info
The bound function data (if any).
Definition duckdb.cpp:99018
AggregateFunction function
The bound function expression.
Definition duckdb.cpp:99014

Member Function Documentation

◆ IsDistinct()

bool duckdb::BoundAggregateExpression::IsDistinct ( ) const
inline
99028 {
99029 return aggr_type == AggregateType::DISTINCT;
99030 }

◆ IsAggregate()

bool duckdb::BoundAggregateExpression::IsAggregate ( ) const
inlineoverridevirtual

Returns true if this expression is an aggregate or not.

Examples:

(1) SUM(a) + 1 – True

(2) a + 1 – False

Implements duckdb::BaseExpression.

99032 {
99033 return true;
99034 }

◆ IsFoldable()

bool duckdb::BoundAggregateExpression::IsFoldable ( ) const
inlineoverridevirtual

Reimplemented from duckdb::Expression.

99035 {
99036 return false;
99037 }

◆ PropagatesNullValues()

bool duckdb::BoundAggregateExpression::PropagatesNullValues ( ) const
overridevirtual

Reimplemented from duckdb::Expression.

375611 {
375612 return function.GetNullHandling() == FunctionNullHandling::SPECIAL_HANDLING ? false
375613 : Expression::PropagatesNullValues();
375614}

◆ ToString()

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

Convert the Expression to a String.

Implements duckdb::BaseExpression.

375568 {
375570 *this, string(), string(), function.name, false, IsDistinct(), filter.get(), order_bys.get());
375571}
unique_ptr< BoundOrderModifier > order_bys
The order by expression for this aggregate - if any.
Definition duckdb.cpp:99025
string ToString() const override
Convert the Expression to a String.
Definition duckdb.cpp:336803
Here is the call graph for this function:

◆ Hash()

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

375573 {
375574 hash_t result = Expression::Hash();
375575 result = CombineHash(result, function.Hash());
375576 result = CombineHash(result, duckdb::Hash(IsDistinct()));
375577 return result;
375578}
hash_t Hash() const override
Definition duckdb.cpp:377203
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:

◆ Equals()

bool duckdb::BoundAggregateExpression::Equals ( const BaseExpression & other) const
overridevirtual

Returns true if this expression is equal to another expression.

Reimplemented from duckdb::BaseExpression.

375580 {
375581 if (!Expression::Equals(other_p)) {
375582 return false;
375583 }
375584 auto &other = other_p.Cast<BoundAggregateExpression>();
375585 if (other.aggr_type != aggr_type) {
375586 return false;
375587 }
375588 if (other.function != function) {
375589 return false;
375590 }
375591 if (children.size() != other.children.size()) {
375592 return false;
375593 }
375594 if (!Expression::Equals(other.filter, filter)) {
375595 return false;
375596 }
375597 for (idx_t i = 0; i < children.size(); i++) {
375598 if (!Expression::Equals(*children[i], *other.children[i])) {
375599 return false;
375600 }
375601 }
375602 if (!FunctionData::Equals(bind_info.get(), other.bind_info.get())) {
375603 return false;
375604 }
375605 if (!BoundOrderModifier::Equals(order_bys, other.order_bys)) {
375606 return false;
375607 }
375608 return true;
375609}
bool Equals(const BaseExpression &other) const override
Returns true if this expression is equal to another expression.
Definition duckdb.hpp:17762
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237
Here is the call graph for this function:

◆ Copy()

unique_ptr< Expression > duckdb::BoundAggregateExpression::Copy ( ) const
overridevirtual

Create a copy of this expression.

Implements duckdb::Expression.

375616 {
375617 vector<unique_ptr<Expression>> new_children;
375618 new_children.reserve(children.size());
375619 for (auto &child : children) {
375620 new_children.push_back(child->Copy());
375621 }
375622 auto new_bind_info = bind_info ? bind_info->Copy() : nullptr;
375623 auto new_filter = filter ? filter->Copy() : nullptr;
375624 auto copy = make_uniq<BoundAggregateExpression>(function, std::move(new_children), std::move(new_filter),
375625 std::move(new_bind_info), aggr_type);
375626 copy->CopyProperties(*this);
375627 copy->order_bys = order_bys ? order_bys->Copy() : nullptr;
375628 return std::move(copy);
375629}

◆ Serialize()

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

Reimplemented from duckdb::Expression.

375631 {
375632 Expression::Serialize(serializer);
375633 serializer.WriteProperty(200, "return_type", return_type);
375634 serializer.WriteProperty(201, "children", children);
375635 FunctionSerializer::Serialize(serializer, function, bind_info.get());
375636 serializer.WriteProperty(203, "aggregate_type", aggr_type);
375637 serializer.WritePropertyWithDefault(204, "filter", filter, unique_ptr<Expression>());
375638 serializer.WritePropertyWithDefault(205, "order_bys", order_bys, unique_ptr<BoundOrderModifier>());
375639}
LogicalType return_type
The return type of the expression.
Definition duckdb.hpp:17743

◆ Deserialize()

unique_ptr< Expression > duckdb::BoundAggregateExpression::Deserialize ( Deserializer & deserializer)
static
375641 {
375642 auto return_type = deserializer.ReadProperty<LogicalType>(200, "return_type");
375643 auto children = deserializer.ReadProperty<vector<unique_ptr<Expression>>>(201, "children");
375644 auto entry = FunctionSerializer::Deserialize<AggregateFunction, AggregateFunctionCatalogEntry>(
375645 deserializer, CatalogType::AGGREGATE_FUNCTION_ENTRY, children, return_type);
375646 auto aggregate_type = deserializer.ReadProperty<AggregateType>(203, "aggregate_type");
375647 auto filter =
375648 deserializer.ReadPropertyWithExplicitDefault<unique_ptr<Expression>>(204, "filter", unique_ptr<Expression>());
375649 auto result = make_uniq<BoundAggregateExpression>(std::move(entry.first), std::move(children), std::move(filter),
375650 std::move(entry.second), aggregate_type);
375651 if (result->return_type != return_type) {
375652 // return type mismatch - push a cast
375653 auto &context = deserializer.Get<ClientContext &>();
375654 return BoundCastExpression::AddCastToType(context, std::move(result), return_type);
375655 }
375656 deserializer.ReadPropertyWithExplicitDefault(205, "order_bys", result->order_bys, unique_ptr<BoundOrderModifier>());
375657 return std::move(result);
375658}
static DUCKDB_API unique_ptr< Expression > AddCastToType(ClientContext &context, unique_ptr< Expression > expr, const LogicalType &target_type, bool try_cast=false)
Cast an expression to the specified SQL type if required.
Definition duckdb.cpp:375869

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