-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
enhancementAny new improvement worthy of a entry in the changelogAny new improvement worthy of a entry in the changelog
Description
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 apache/datafusion#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:
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementAny new improvement worthy of a entry in the changelogAny new improvement worthy of a entry in the changelog