This is an automated email from the ASF dual-hosted git repository.
jonah pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion.git
The following commit(s) were added to refs/heads/main by this push:
new 61afb0d486 Minor: Document output schema of LogicalPlan::Aggregate and
LogicalPlan::Window (#14047)
61afb0d486 is described below
commit 61afb0d486b4617ddc79cb01e8765fedd3ae247b
Author: Andrew Lamb <[email protected]>
AuthorDate: Wed Jan 8 21:42:52 2025 -0500
Minor: Document output schema of LogicalPlan::Aggregate and
LogicalPlan::Window (#14047)
---
datafusion/expr/src/logical_plan/plan.rs | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/datafusion/expr/src/logical_plan/plan.rs
b/datafusion/expr/src/logical_plan/plan.rs
index 005bf4b984..24fb0609b0 100644
--- a/datafusion/expr/src/logical_plan/plan.rs
+++ b/datafusion/expr/src/logical_plan/plan.rs
@@ -215,10 +215,14 @@ pub enum LogicalPlan {
/// Windows input based on a set of window spec and window
/// function (e.g. SUM or RANK). This is used to implement SQL
/// window functions, and the `OVER` clause.
+ ///
+ /// See [`Window`] for more details
Window(Window),
/// Aggregates its input based on a set of grouping and aggregate
/// expressions (e.g. SUM). This is used to implement SQL aggregates
/// and `GROUP BY`.
+ ///
+ /// See [`Aggregate`] for more details
Aggregate(Aggregate),
/// Sorts its input according to a list of sort expressions. This
/// is used to implement SQL `ORDER BY`
@@ -2365,6 +2369,19 @@ impl Filter {
}
/// Window its input based on a set of window spec and window function (e.g.
SUM or RANK)
+///
+/// # Output Schema
+///
+/// The output schema is the input schema followed by the window function
+/// expressions, in order.
+///
+/// For example, given the input schema `"A", "B", "C"` and the window function
+/// `SUM(A) OVER (PARTITION BY B+1 ORDER BY C)`, the output schema will be
`"A",
+/// "B", "C", "SUM(A) OVER ..."` where `"SUM(A) OVER ..."` is the name of the
+/// output column.
+///
+/// Note that the `PARTITION BY` expression "B+1" is not produced in the output
+/// schema.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct Window {
/// The incoming logical plan
@@ -2968,6 +2985,16 @@ impl PartialOrd for DistinctOn {
/// Aggregates its input based on a set of grouping and aggregate
/// expressions (e.g. SUM).
+///
+/// # Output Schema
+///
+/// The output schema is the group expressions followed by the aggregate
+/// expressions in order.
+///
+/// For example, given the input schema `"A", "B", "C"` and the aggregate
+/// `SUM(A) GROUP BY C+B`, the output schema will be `"C+B", "SUM(A)"` where
+/// "C+B" and "SUM(A)" are the names of the output columns. Note that "C+B" is
a
+/// single new column
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
// mark non_exhaustive to encourage use of try_new/new()
#[non_exhaustive]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]