Ruchirtripathi opened a new pull request, #24029:
URL: https://github.com/apache/datafusion/pull/24029
## Which issue does this PR close?
- Closes #24022
## Rationale for this change
Fixes a bug where `ScalarValue::new_list`, `new_list_nullable`, and
`new_large_list` silently ignored the
`data_type` argument when the `values` array was non-empty. This caused
issues where accumulators like
`collect_list` could produce outputs with a slightly different type than
declared (e.g., in the nullability of
nested fields), leading to invalid argument errors in
`GroupedHashAggregateStream::emit`.
## What changes are included in this PR?
- Added a `cast_with_options` call for non-empty lists in
`ScalarValue::new_list`, `new_list_from_iter`, and
`new_large_list`.
- Used `DEFAULT_CAST_OPTIONS` to ensure the concatenated array is
properly reconciled with the requested
`data_type`.
## Are these changes tested?
Yes, this is covered by existing tests. It resolves the
`GroupedHashAggregateStream` output batch validation
failures for accumulators.
## Are there any user-facing changes?
No, this is an internal bug fix.
--
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]