ivan-kiselev opened a new pull request, #27961: URL: https://github.com/apache/datafusion/pull/27961
## Which issue does this PR close? Closes #27960 ## Rationale for this change Grouped `array_agg(DISTINCT x)` panics when `x` is a run-end-encoded array of dictionary strings. Arrow's `RowConverter` decodes the dictionary values to plain strings but keeps the run-end encoding. The accumulator then tries to build a list whose declared element type no longer matches its values. ## What changes are included in this PR? Teach `datatype_contains_dictionary` to inspect the value field of `RunEndEncoded`. The accumulator's existing cast then restores the declared element type before building the list. ## What is the testing strategy for this PR? Extended the grouped dictionary regression test with `RunEndEncoded(Int32, Dictionary(UInt32, Utf8))` input. Four rows across two groups reproduce the panic before the fix. With the fix, the test checks that the groups contain `[a, b]` and `[a]` and that the list preserves the input element type. The plain-dictionary case still passes. ## Are there any user-facing changes? The affected query returns distinct values without requiring a cast to `VARCHAR`. -- 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]
