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

[Python] Casting Table to new schema ignores nullability of fields #32000

Closed
asfimport opened this issue May 25, 2022 · 1 comment
Closed

[Python] Casting Table to new schema ignores nullability of fields #32000

asfimport opened this issue May 25, 2022 · 1 comment

Comments

@asfimport
Copy link
Collaborator

asfimport commented May 25, 2022

Similar to ARROW-15478, but not for nested fields but just for casting a full Table (in theory that could be the same code, but currently the Table.cast logic is implemented in cython).

So currently when casting a Table to a new schema, the nullability of the fields in the schema is ignored (and as a result you get an "invalid" schema indicating a field is non-nullable that actually can have nulls):

>>> table = pa.table({'a': [None, 1]})
>>> table
pyarrow.Table
a: int64
----
a: [[null,1]]

>>> new_schema = pa.schema([pa.field("a", "int64", nullable=False)])
>>> table.cast(new_schema)
pyarrow.Table
a: int64 not null
----
a: [[null,1]]

Reporter: Joris Van den Bossche / @jorisvandenbossche
Assignee: Kshiteej K / @kshitij12345

Related issues:

PRs and other links:

Note: This issue was originally created as ARROW-16651. Please see the migration documentation for further details.

@asfimport
Copy link
Collaborator Author

Joris Van den Bossche / @jorisvandenbossche:
Issue resolved by pull request 14048
#14048

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant