Skip to content
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

Schema error: Invalid data type for Delta Lake: Null #1946

Closed
resulyrt93 opened this issue Dec 5, 2023 · 2 comments
Closed

Schema error: Invalid data type for Delta Lake: Null #1946

resulyrt93 opened this issue Dec 5, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@resulyrt93
Copy link

Environment

Delta-rs version: 0.14.0

Binding: Python

Environment:

  • Cloud provider: AWS and Local
  • OS: Linux and MacOS
  • Other:

Bug

What happened: When i try to write my dataframe that has full null column, it raises error. If all rows are None in a column, it seems as null type in pyarrow schema and it causes error because i guess delta-rs doesn't recognize that type.

What you expected to happen: I would expect that create/write delta table.

How to reproduce it:

data = [['kevin', 10, None], ['angela', 12, None], ['oscar', 9, None]]
df = pd.DataFrame(data, columns=['Name', 'Age', 'Gender'])

write_deltalake('/my_table_path', df)
@resulyrt93 resulyrt93 added the bug Something isn't working label Dec 5, 2023
@ion-elgreco
Copy link
Collaborator

Null is not a valid primitive type https://github.com/delta-io/delta/blob/master/PROTOCOL.md#primitive-types, you can create the table first with DeltaTable.create("path", pa.schema)

@ion-elgreco
Copy link
Collaborator

Closing this since it's not a bug.

I suggest you create the table first with the specified schema where you make the gender column string or cast your data to the correct schema first.

@ion-elgreco ion-elgreco closed this as not planned Won't fix, can't repro, duplicate, stale Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants