//===----------------------------------------------------------------------===// // DuckDB // // duckdb/planner/expression/bound_window_expression.hpp // // //===----------------------------------------------------------------------===// #pragma once #include "duckdb/parser/expression/window_expression.hpp" #include "duckdb/function/function.hpp" #include "duckdb/planner/bound_query_node.hpp" #include "duckdb/planner/expression.hpp" namespace duckdb { class AggregateFunction; class BoundWindowExpression : public Expression { public: static constexpr const ExpressionClass TYPE = ExpressionClass::BOUND_WINDOW; public: BoundWindowExpression(ExpressionType type, LogicalType return_type, unique_ptr aggregate, unique_ptr bind_info); //! The bound aggregate function unique_ptr aggregate; //! The bound function info unique_ptr bind_info; //! The child expressions of the main window function vector> children; //! The set of expressions to partition by vector> partitions; //! Statistics belonging to the partitions expressions vector> partitions_stats; //! The set of ordering clauses vector orders; //! Expression representing a filter, only used for aggregates unique_ptr filter_expr; //! True to ignore NULL values bool ignore_nulls; //! The window boundaries WindowBoundary start = WindowBoundary::INVALID; WindowBoundary end = WindowBoundary::INVALID; unique_ptr start_expr; unique_ptr end_expr; //! Offset and default expressions for WINDOW_LEAD and WINDOW_LAG functions unique_ptr offset_expr; unique_ptr default_expr; public: bool IsWindow() const override { return true; } bool IsFoldable() const override { return false; } string ToString() const override; bool KeysAreCompatible(const BoundWindowExpression &other) const; bool Equals(const BaseExpression &other) const override; unique_ptr Copy() override; void Serialize(FieldWriter &writer) const override; static unique_ptr Deserialize(ExpressionDeserializationState &state, FieldReader &reader); }; } // namespace duckdb