Skip to content

Conversation

@friendlymatthew
Copy link
Member

@friendlymatthew friendlymatthew commented Dec 18, 2025

NOTE:
For simplicity, this PR implements everything within datafusion. In a more complete design, some pieces like casting support would likely belong in arrow's cast kernel. If this PR is directionally sound and aligned with other folks, I'm happy to follow up with a properly layered implementation

Which issue does this PR close?

Rationale for this change

This PR adds coercion logic for union data types. This way, you are able to compare union data types with scalar types.

Specifically making queries like the following work. (Note attributes->'id' is a DataType::Union)

select * from records where attributes->'id' = 67

When comparing a union type with a scalar type, the logic will check if the scalar type matches any Union variant

The scalar type matching is greedy, meaning if you have a Union type with variants of the same field, it will match by the smaller type id (since union variants are sorted by type id)

@friendlymatthew friendlymatthew force-pushed the friendlymatthew/union-coercion branch from c160c6e to f108898 Compare January 9, 2026 19:18
@github-actions github-actions bot removed documentation Improvements or additions to documentation optimizer labels Jan 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants