You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First step might be able to create table with union type
query error DataFusion error: Error during planning: Inconsistent data type across values list at row 1 column 0\. Was Int64 but found Utf8
create table t1 (u union(num interger, str varchar)) as values
(1),
('two');
Activity
[-]Support `Union`[/-][+]Support `Union` Type[/+][-]Support `Union` Type[/-][+]Support `Union` as a function[/+]vaibhawvipul commentedon Apr 24, 2024
I would like to work on this.
samuelcolvin commentedon Apr 24, 2024
As I mentioned here #7845 (comment), the most useful thing for me would be less ugly errors when you do try to compare a union with something else.
Also it would be good to be able to force people to cast unions in my case, so it would be nice if we could switch off
comparison_coercionsomehow.@vaibhawvipul if you're working on this, you might be interested in my logic in
datafusion-contrib/datafusion-functions-json/src/common_union.rsvaibhawvipul commentedon Apr 25, 2024
This was helpful @samuelcolvin. Thank you.
My approach is similar -
union_extract.vaibhawvipul commentedon May 16, 2024
take
gstvg commentedon Jun 25, 2024
I opened a PR that adds support for Union datatype on sqlparser which I hope can help here. If so, some review would be very appreciated, since sqlparser-rs dev-bandwith is a bit limited. Thanks 🙏
alamb commentedon Jan 13, 2026
I think we now have reasonable
UnionArraysupport -- see https://github.com/apache/datafusion/blob/main/datafusion/sqllogictest/test_files/union.sltalamb commentedon Jan 13, 2026
Let's open follow on tickets with any specific features we want to support