You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "friendlymatthew (via GitHub)" <gi...@apache.org> on 2025/11/19 17:22:49 UTC

[I] Support `Union` data type coercion [datafusion]

friendlymatthew opened a new issue, #18825:
URL: https://github.com/apache/datafusion/issues/18825

   ### Is your feature request related to a problem or challenge?
   
   Union arrays currently cannot be used in comparison operations with scalar values or other types. When attempting to filter or compare a union column against a constant value (e.g., `where union_column = 67`), datafusion fails during type coercion
   
   This prevents common filtering and selection ops on union-typed data. At work, we interact with a lot of JSON and accessing data with `->` returns Union types. Currently the following query will err:
   
   ```sql
   select * from records
   where json_val->'id' = 123
   ```
   
   ### Describe the solution you'd like
   
   - Write a `union_coercion` function that handles union-to-scalar and union-to-union type coercion, following the pattern established by other composite types like `struct_coercion` and `map_coercion`
   - Extend `comparison_coercion` to chain to `union_coercion` as part of its coercion attempts
   
   On the arrow-side, comparison kernel support for unions are being developed:
   - https://github.com/apache/arrow-rs/issues/8837
   - https://github.com/apache/arrow-rs/issues/8881
   
   
   
   ### Describe alternatives you've considered
   
   _No response_
   
   ### Additional context
   
   _No response_


-- 
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: github-unsubscribe@datafusion.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Support `Union` data type coercion [datafusion]

Posted by "adriangb (via GitHub)" <gi...@apache.org>.
adriangb closed issue #18825: Support `Union` data type coercion
URL: https://github.com/apache/datafusion/issues/18825


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org