//===----------------------------------------------------------------------===// // DuckDB // // duckdb/planner/operator/logical_aggregate.hpp // // //===----------------------------------------------------------------------===// #pragma once #include "duckdb/planner/logical_operator.hpp" #include "duckdb/planner/column_binding.hpp" #include "duckdb/storage/statistics/base_statistics.hpp" #include "duckdb/parser/group_by_node.hpp" namespace duckdb { //! LogicalAggregate represents an aggregate operation with (optional) GROUP BY //! operator. class LogicalAggregate : public LogicalOperator { public: static constexpr const LogicalOperatorType TYPE = LogicalOperatorType::LOGICAL_AGGREGATE_AND_GROUP_BY; public: LogicalAggregate(idx_t group_index, idx_t aggregate_index, vector> select_list); //! The table index for the groups of the LogicalAggregate idx_t group_index; //! The table index for the aggregates of the LogicalAggregate idx_t aggregate_index; //! The table index for the GROUPING function calls of the LogicalAggregate idx_t groupings_index; //! The set of groups (optional). vector> groups; //! The set of grouping sets (optional). vector grouping_sets; //! The list of grouping function calls (optional) vector> grouping_functions; //! Group statistics (optional) vector> group_stats; public: string ParamsToString() const override; vector GetColumnBindings() override; void Serialize(FieldWriter &writer) const override; static unique_ptr Deserialize(LogicalDeserializationState &state, FieldReader &reader); idx_t EstimateCardinality(ClientContext &context) override; vector GetTableIndex() const override; string GetName() const override; protected: void ResolveTypes() override; }; } // namespace duckdb