friendlymatthew opened a new issue, #9225: URL: https://github.com/apache/arrow-rs/issues/9225
**Is your feature request related to a problem or challenge? Please describe what you are trying to do.** Arrow's cast kernel currently doesn't support casting Union types to other types. This blocks useful operations like comparing Union columns with scalar values in query engines like Datafusion (see https://github.com/apache/datafusion/issues/18825) I propose the following behavior: When casting `Union(Int32, Utf8)` to Int32: - extract values from the int32 variant - non-matching variants (Utf8) become Null There's also an intermediary cast that could occur, for instance when casting `Union(Int32, Utf8)` to Int64: - extract values from the int32 variant - cast them if needed (e.g., Int32 -> int64) - non-matching variants (Utf8) become null This implementation is quite greedy: it finds the matching variant by exact type match first, then by cast-compatibility. (Users can determine precedence by a Union variant's `type_id`). Motivation: - Related https://github.com/pydantic/datafusion/pull/49 - Related https://github.com/apache/arrow-rs/issues/8881 -- 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]
