kosiew opened a new pull request, #17085: URL: https://github.com/apache/datafusion/pull/17085
## Which issue does this PR close? Closes #16997 ## Rationale for this change Currently, when a user-defined aggregate function (UDAF) is invoked with literal values, any associated field-level metadata (such as Arrow extension types or custom tags) is lost due to the lack of a proper schema. This PR ensures that UDAFs can access metadata for literal inputs by synthesizing a schema from those literals. This empowers UDAFs to exhibit metadata-driven behavior. ## What changes are included in this PR? * Synthesized a schema from literal inputs inside `AggregateFunctionExpr::args_schema` to retain metadata. * Updated `AccumulatorArgs` documentation and usage across `datafusion` to reflect and utilize the synthesized schema. * Added a new test `test_scalar_udaf_schema_metadata` to validate metadata-driven behavior in UDAFs. * Improved internal comments and docs to clarify the relationship between `AccumulatorArgs`, metadata, and field inference. ## Are these changes tested? Yes 🎉 * The new functionality is validated with a dedicated test: `test_scalar_udaf_schema_metadata`, ensuring that metadata is preserved and interpreted correctly in user-defined accumulators. ## Are there any user-facing changes? Yes, but non-breaking: * Users writing UDAFs now have access to field metadata even when arguments are literals. * Enhanced documentation and behavior for advanced UDAF use cases relying on metadata. These changes are backwards compatible and additive, providing new capabilities without breaking existing functionality. --- -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org