Skip to content

Apache DataFusion SQL Query Engine

docs: Document `WindowFn` and add comments (#24118)

Andrew Lambf3ef45a53c9b
diff --git a/datafusion/physical-expr/src/window/window_expr.rs b/datafusion/physical-expr/src/window/window_expr.rs
index 1c52ea4ea6..7fe768cfbe 100644
--- a/datafusion/physical-expr/src/window/window_expr.rs
+++ b/datafusion/physical-expr/src/window/window_expr.rs
@@ -610,9 +610,16 @@ pub(crate) fn get_orderby_values(order_by_columns: Vec<SortColumn>) -> Vec<Array
order_by_columns.into_iter().map(|s| s.values).collect()
}
+/// State for incrementally evaluating a window function
+/// within a partition, created by [`WindowExpr::create_window_fn`].
#[derive(Debug)]
pub enum WindowFn {
+ /// A "normal" window function, such as `lead` or `lag`, evaluated via a
+ /// [`PartitionEvaluator`]. Despite the name, it is used for all window
+ /// functions that are not aggregate functions.
Builtin(Box<dyn PartitionEvaluator>),
+ /// An aggregate function used as a window function, such as `avg` or
+ /// `sum`, which is evaluated via an [`Accumulator`].
Aggregate(Box<dyn Accumulator>),
}