[ 
https://issues.apache.org/jira/browse/ARROW-10194?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Krisztian Szucs updated ARROW-10194:
------------------------------------
    Description: 
Reproducer:

{code:python}
data = [None, [9007199254740993]]
arr = pa.array(data, type=pa.list_(pa.uint64(), 1))
ndarray = arr.to_numpy(zero_copy_only=False)
restored = pa.array(ndarray, type=arr.type)
assert restored.equals(arr)
{code}

Error:

{code}
E       assert False
E        +  where False = <built-in method equals of 
pyarrow.lib.FixedSizeListArray object at 
0x7fbdb0239e20>(<pyarrow.lib.FixedSizeListArray object at 0x7fbdb0262220>\n[\n  
null,\n  [\n    9007199254740993\n  ]\n])
E        +    where <built-in method equals of pyarrow.lib.FixedSizeListArray 
object at 0x7fbdb0239e20> = <pyarrow.lib.FixedSizeListArray object at 
0x7fbdb0239e20>\n[\n  null,\n  [\n    9007199254740992\n  ]\n].equals
{code}

The inner numpy array ({{ndarray[1]}}) has float64 dtype where the integer gets 
truncated because of the precision.

  was:
Reproducer:

{code:python}
data = [None, [9007199254740993]]
arr = pa.array(data, type=pa.list_(pa.uint64(), 1))
ndarray = arr.to_numpy(zero_copy_only=False)
restored = pa.array(ndarray, type=arr.type)
assert restored.equals(arr)
{code}

Error:

{code}
E       assert False
E        +  where False = <built-in method equals of 
pyarrow.lib.FixedSizeListArray object at 
0x7fc0c86badc0>(<pyarrow.lib.FixedSizeListArray object at 0x7fc068496760>\n[\n  
null,\n  [\n    90071992547409944\n  ]\n])
E        +    where <built-in method equals of pyarrow.lib.FixedSizeListArray 
object at 0x7fc0c86badc0> = <pyarrow.lib.FixedSizeListArray object at 
0x7fc0c86badc0>\n[\n  null,\n  [\n    90071992547409952\n  ]\n].equals
{code}

The inner numpy array ({{ndarray[1]}}) has float64 dtype where the integer gets 
truncated because of the precision.


> [Python] Array.to_numpy() with type fixed_size_list(int64(), 1) doesn't 
> roundtrip for large integer values
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: ARROW-10194
>                 URL: https://issues.apache.org/jira/browse/ARROW-10194
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: Python
>            Reporter: Krisztian Szucs
>            Priority: Major
>
> Reproducer:
> {code:python}
> data = [None, [9007199254740993]]
> arr = pa.array(data, type=pa.list_(pa.uint64(), 1))
> ndarray = arr.to_numpy(zero_copy_only=False)
> restored = pa.array(ndarray, type=arr.type)
> assert restored.equals(arr)
> {code}
> Error:
> {code}
> E       assert False
> E        +  where False = <built-in method equals of 
> pyarrow.lib.FixedSizeListArray object at 
> 0x7fbdb0239e20>(<pyarrow.lib.FixedSizeListArray object at 
> 0x7fbdb0262220>\n[\n  null,\n  [\n    9007199254740993\n  ]\n])
> E        +    where <built-in method equals of pyarrow.lib.FixedSizeListArray 
> object at 0x7fbdb0239e20> = <pyarrow.lib.FixedSizeListArray object at 
> 0x7fbdb0239e20>\n[\n  null,\n  [\n    9007199254740992\n  ]\n].equals
> {code}
> The inner numpy array ({{ndarray[1]}}) has float64 dtype where the integer 
> gets truncated because of the precision.



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

Reply via email to