Jefffrey commented on code in PR #17085:
URL: https://github.com/apache/datafusion/pull/17085#discussion_r2394652327
##########
datafusion/expr/src/udaf.rs:
##########
@@ -762,7 +762,24 @@ pub trait AggregateUDFImpl: Debug + DynEq + DynHash + Send
+ Sync {
/// group during query execution.
///
/// acc_args: [`AccumulatorArgs`] contains information about how the
- /// aggregate function was called.
+ /// aggregate function was called. Use `acc_args.exprs` together with
+ /// `acc_args.schema` to inspect the [`FieldRef`] of each input.
+ ///
+ /// Example: retrieving metadata and return field for input `i`:
+ /// ```ignore
+ /// let metadata = acc_args.schema.field(i).metadata();
+ /// let field = acc_args.exprs[i].return_field(&acc_args.schema)?;
+ /// ```
Review Comment:
> The snippet is meant to illustrate the sentence immediately above it: you
pair `acc_args.exprs` with `acc_args.schema` to recover the full `FieldRef` for
argument _i_.
This may be a silly question, but what's the difference between
`acc_args.exprs[i].return_field(&acc_args.schema)` and
`acc_args.schema.field(i)`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]