### Is your feature request related to a problem or challenge? This is a follow on to https://github.com/apache/datafusion/pull/15646 Now that we have metadata handling for scalar UDFs we need to do the same treatment for Aggregate and Window functions. ### Describe the solution you'd like Change points at which we pass in `DataType` into and out of aggregates and window functions in planning. Change these to use `Field`. We need to add unit tests to demonstrate both metadata processing on the input and generation of metadata on the output. We should also have a unit test using extension types as an example to users. ### Describe alternatives you've considered None ### Additional context _No response_