[
https://issues.apache.org/jira/browse/ARROW-8773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17129039#comment-17129039
]
Joris Van den Bossche commented on ARROW-8773:
----------------------------------------------
[~Al Taylor] Thanks for the report.
That's indeed something that should be preserved in the {{empty_table()}}
method.
A PR to fix this is always welcome!
> [Python] pyarrow schema.empty_table() does not preserve nullability of fields
> -----------------------------------------------------------------------------
>
> Key: ARROW-8773
> URL: https://issues.apache.org/jira/browse/ARROW-8773
> Project: Apache Arrow
> Issue Type: Bug
> Components: Python
> Affects Versions: 0.17.0
> Environment: linux, pyarrow 0.17.0 installed via pipenv
> Reporter: Al Taylor
> Priority: Major
>
> Introduced by PR: [https://github.com/apache/arrow/pull/2589]
>
> When a field in a schema is marked as not-nullable, calling empty_table() on
> the schema returns a table with nullable fields.
>
> reproduction
> {code:java}
> >>> import pyarrow as pa
> >>> s = pa.schema([pa.field('a', pa.int64(), nullable=False), pa.field('b',
> >>> pa.int64())])
> >>> s
> a: int64 not null
> b: int64
> >>> e = s.empty_table()
> >>> e
> pyarrow.Table
> a: int64
> b: int64
> >>> e.schema
> a: int64
> b: int64
> >>> assert s == e.schema
> Traceback (most recent call last):
> File "<input>", line 1, in <module>
> AssertionError
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)