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
{{ message }}
Repository navigation
Union of DuckDB DuckDBPyRelations based on Polars DataFrames fails on internal error #189
This issue occurs for relations created from data frames.
While duckdb.sql("... UNION ALL ...") works, the equivalent t1.union(t2) fails when queried/show()n.
If the relations are first stored as tables (.to_table), the issue disappears.
To Reproduce
importduckdb, polarsprint(duckdb.version())
df1, df2=polars.DataFrame(dict(a=(1, 2, 3))), polars.DataFrame(dict(a=(3, 4, 5)))
t1, t2=duckdb.sql('FROM df1'), duckdb.sql('FROM df2')
duckdb.sql('FROM t1 UNION ALL FROM t2').show() # works as expectedt1.union(t2).show() # equivalent fails on _duckdb.InternalException: INTERNAL Error: Failed to cast bound query node to type - query node type mismatch
gives as output
1.4.2 (with duckdb 1.4.2)
┌───────┐
│ a │
│ int64 │
├───────┤
│ 1 │
│ 2 │
│ 3 │
│ 3 │
│ 4 │
│ 5 │
└───────┘
Traceback (most recent call last):
File "C:\...\duckdb-minimal\main.py", line 8, in <module>
t1.union(t2).show() # fails on _duckdb.InternalException: INTERNAL Error: Failed to cast bound query node to type - query node type mismatch
~~~~~~~~~~~~~~~~~^^
_duckdb.InternalException: INTERNAL Error: Failed to cast bound query node to type - query node type mismatch
This error signals an assertion failure within DuckDB. This usually occurs due to unexpected conditions or errors in the program's logic.
For more information, see https://duckdb.org/docs/stable/dev/internal_errors
OS:
Windows 11
DuckDB Package Version:
1.4.2
Python Version:
1.4.2
Full Name:
Olaf G
Affiliation:
private
What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.
I have not tested with any build
Did you include all relevant data sets for reproducing the issue?
Not applicable - the reproduction does not require a data set
Did you include all code required to reproduce the issue?
Yes, I have
Did you include all relevant configuration to reproduce the issue?
Activity
evertlammerts commentedon Feb 19, 2026
This will be fixed in the next release:
Output: