From 1edd82bee5e5c4817787c4d818bdbbcd71818515 Mon Sep 17 00:00:00 2001 From: Jay Zhan Date: Tue, 16 Jul 2024 01:55:49 +0800 Subject: [PATCH] Docs: Explain the usage of logical expressions for `create_aggregate_expr` (#11458) * doc: comment Signed-off-by: jayzhan211 * fmt Signed-off-by: jayzhan211 * fix Signed-off-by: jayzhan211 --------- Signed-off-by: jayzhan211 --- datafusion/physical-expr-common/src/aggregate/mod.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/datafusion/physical-expr-common/src/aggregate/mod.rs b/datafusion/physical-expr-common/src/aggregate/mod.rs index 35666f199ace9..db4581a622acc 100644 --- a/datafusion/physical-expr-common/src/aggregate/mod.rs +++ b/datafusion/physical-expr-common/src/aggregate/mod.rs @@ -43,6 +43,14 @@ use datafusion_expr::utils::AggregateOrderSensitivity; /// Creates a physical expression of the UDAF, that includes all necessary type coercion. /// This function errors when `args`' can't be coerced to a valid argument type of the UDAF. +/// +/// `input_exprs` and `sort_exprs` are used for customizing Accumulator +/// whose behavior depends on arguments such as the `ORDER BY`. +/// +/// For example to call `ARRAY_AGG(x ORDER BY y)` would pass `y` to `sort_exprs`, `x` to `input_exprs` +/// +/// `input_exprs` and `sort_exprs` are used for customizing Accumulator as the arguments in `AccumulatorArgs`, +/// if you don't need them it is fine to pass empty slice `&[]`. #[allow(clippy::too_many_arguments)] pub fn create_aggregate_expr( fun: &AggregateUDF,