You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "Laurent Kadian (Jira)" <ji...@apache.org> on 2021/06/01 00:06:00 UTC

[jira] [Created] (ARROW-12913) Non-nullable schema fields not checked in Table.from_pydict

Laurent Kadian created ARROW-12913:
--------------------------------------

             Summary: Non-nullable schema fields not checked in Table.from_pydict
                 Key: ARROW-12913
                 URL: https://issues.apache.org/jira/browse/ARROW-12913
             Project: Apache Arrow
          Issue Type: Bug
          Components: Python
    Affects Versions: 4.0.1
            Reporter: Laurent Kadian


This issue is similar to ARROW-2136.

If you provide a schema with nullable=False to Table.from_pydict and the data you provide has nulls, no exception is raised and the table is constructed successfully.
{noformat}
>>> import pyarrow as pa
>>> pydict = dict(a=[1.2, 2.1, None])
>>> schema = pa.schema([pa.field("a", pa.float64(), nullable=False)])
>>> table = pa.Table.from_pydict(pydict, schema=schema)
>>> 
>>> table[0]
<pyarrow.lib.ChunkedArray object at 0x7f367f499ea0>
[
  [
    1.2,
    2.1,
    null
  ]
]
>>> table.schema
a: double not null
>>> 
{noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)