-
Notifications
You must be signed in to change notification settings - Fork 129
Add Support for DuckDB UNION type #678
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Nirmit Shah <nirmitshah191@gmail.com>
@JelteF Is this the type of output we expect when selecting a union datatype column? |
Signed-off-by: Nirmit Shah <nirmitshah191@gmail.com>
Signed-off-by: Nirmit Shah <nirmitshah191@gmail.com>
Yes, that looks great. I think we should at least support the following: select union_extract(r['u'], 'str') from duckdb.query($$ select * from tbl1 $$) r;
select union_tag(r['u']) from duckdb.query($$ select * from tbl1 $$) r; This would also be nice, but since duckdb doesn't support indexing a union this way I think that will be impossible to do, without changes to DuckDB. select r['u']['str'] from duckdb.query($$ select * from tbl1 $$) r; I think you could in theory implement the following syntax without changes to duckdb. But I think a better way would be to add index support for unions to duckdb itself: select r['u']::duckdb.union['str'] from duckdb.query($$ select * from tbl1 $$) r; Finally since postgres doesn't support overloading the select r['u'].str from duckdb.query($$ select * from tbl1 $$) r; |
I think the first syntax is the most straigth forward , and have implemented that and updated output in PR description... |
Signed-off-by: Nirmit Shah <nirmitshah191@gmail.com>
Fixes #601