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
I'm not sure if this is actually a bug or a feature, but I noticed that when UNIONing two tables with same columns that may have different data types, duckdb successfully completes the union and re-casts the incompatible columns to a compatible data type if there is one.
To be fair I'm not complaining, I actually find this quite convenient for what I'm doing, but I thought it was right to report.
To Reproduce
data= [
[None, 1, 'a', None],
['foo', 2, 'b', None],
['bar', 3.0, 42, {'foo': 'bar'}]
]
cols= ['col1', 'col2', 'col3', 'col4']
df=pd.DataFrame(data, columns=cols)
head=df.head(0)
duckdb.sql('SELECT * FROM head UNION SELECT * FROM df')
OS:
Windows 11 Home x64
DuckDB Version:
0.7.1
DuckDB Client:
Python 3.10
Full Name:
Federico Zambelli
Affiliation:
Vinhood
Have you tried this on the latest master branch?
I agree
Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?
I agree
The text was updated successfully, but these errors were encountered:
Thanks for the report! This is indeed not a bug but intended behavior - if the types of a union do not match casts are added to compatible types if possible according to the implicit cast rules in the system, see here for more information.
What happens?
I'm not sure if this is actually a bug or a feature, but I noticed that when
UNION
ing two tables with same columns that may have different data types, duckdb successfully completes the union and re-casts the incompatible columns to a compatible data type if there is one.To be fair I'm not complaining, I actually find this quite convenient for what I'm doing, but I thought it was right to report.
To Reproduce
OS:
Windows 11 Home x64
DuckDB Version:
0.7.1
DuckDB Client:
Python 3.10
Full Name:
Federico Zambelli
Affiliation:
Vinhood
Have you tried this on the latest
master
branch?Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?
The text was updated successfully, but these errors were encountered: