[
https://issues.apache.org/jira/browse/ARROW-8122?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Wenjun Si updated ARROW-8122:
-----------------------------
Description:
In PyArrow 0.16.0, when we try to deserialize a serialized empty Numpy Array
with shape, for instance, np.array([[], []]), an ArrowInvalid is raised.
Code reproducing this error:
{code:python}
import numpy as np
import pyarrow.plasma
arr = np.array([[], []])
pyarrow.deserialize(pyarrow.serialize(arr).to_buffer()) # this line cannot work
{code}
and the error stack is
{code:python}
Traceback (most recent call last):
File
"/Users/wenjun/miniconda3/lib/python3.7/site-packages/IPython/core/interactiveshell.py",
line 3326, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-15-f88b0515b603>", line 1, in <module>
pyarrow.deserialize(pyarrow.serialize(arr))
File "pyarrow/serialization.pxi", line 475, in pyarrow.lib.deserialize
File "pyarrow/io.pxi", line 1178, in pyarrow.lib.BufferReader.__cinit__
File "pyarrow/io.pxi", line 1372, in pyarrow.lib.as_buffer
File "pyarrow/io.pxi", line 1346, in pyarrow.lib.py_buffer
File "pyarrow/error.pxi", line 122, in
pyarrow.lib.pyarrow_internal_check_status
TypeError: a bytes-like object is required, not 'pyarrow.lib.SerializedPyObject'
{code}
The same code works in PyArrow 0.15.x
was:
In PyArrow 0.16.0, when we try to store an empty Numpy Array with shape into
Plasma Store, for instance, np.array([[], []]), the put call works, but when we
try to get it from Plasma Store, an ArrowInvalid is raised.
Code reproducing this error:
{code:python}
import numpy as np
import pyarrow.plasma
store_ctx = pyarrow.plasma.start_plasma_store(16 * 1024 * 1024)
store_vars = store_ctx.__enter__()
cli = pyarrow.plasma.connect(store_vars[0])
arr = np.array([[], []])
obj_id = cli.put(arr)
st_obj = cli.get(obj_id) # this line cannot work
{code}
and the error stack is
{code:python}
Traceback (most recent call last):
File
"/Users/wenjun/miniconda3/lib/python3.7/site-packages/IPython/core/interactiveshell.py",
line 3326, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-9-463596c9dc4f>", line 1, in <module>
st_obj = cli.get(obj_id)
File "pyarrow/_plasma.pyx", line 580, in pyarrow._plasma.PlasmaClient.get
File "pyarrow/_plasma.pyx", line 573, in pyarrow._plasma.PlasmaClient.get
File "pyarrow/serialization.pxi", line 476, in pyarrow.lib.deserialize
File "pyarrow/serialization.pxi", line 438, in pyarrow.lib.deserialize_from
File "pyarrow/serialization.pxi", line 414, in pyarrow.lib.read_serialized
File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: strides must not involve buffer over run
{code}
The same code works in PyArrow 0.15.x
Summary: [Python] Empty numpy arrays with shape cannot be deserialized
(was: [Python] Empty numpy arrays with shape cannot be obtained in Plasma)
> [Python] Empty numpy arrays with shape cannot be deserialized
> -------------------------------------------------------------
>
> Key: ARROW-8122
> URL: https://issues.apache.org/jira/browse/ARROW-8122
> Project: Apache Arrow
> Issue Type: Bug
> Components: Python
> Affects Versions: 0.16.0
> Reporter: Wenjun Si
> Priority: Major
>
> In PyArrow 0.16.0, when we try to deserialize a serialized empty Numpy Array
> with shape, for instance, np.array([[], []]), an ArrowInvalid is raised.
> Code reproducing this error:
> {code:python}
> import numpy as np
> import pyarrow.plasma
> arr = np.array([[], []])
> pyarrow.deserialize(pyarrow.serialize(arr).to_buffer()) # this line cannot
> work
> {code}
> and the error stack is
> {code:python}
> Traceback (most recent call last):
> File
> "/Users/wenjun/miniconda3/lib/python3.7/site-packages/IPython/core/interactiveshell.py",
> line 3326, in run_code
> exec(code_obj, self.user_global_ns, self.user_ns)
> File "<ipython-input-15-f88b0515b603>", line 1, in <module>
> pyarrow.deserialize(pyarrow.serialize(arr))
> File "pyarrow/serialization.pxi", line 475, in pyarrow.lib.deserialize
> File "pyarrow/io.pxi", line 1178, in pyarrow.lib.BufferReader.__cinit__
> File "pyarrow/io.pxi", line 1372, in pyarrow.lib.as_buffer
> File "pyarrow/io.pxi", line 1346, in pyarrow.lib.py_buffer
> File "pyarrow/error.pxi", line 122, in
> pyarrow.lib.pyarrow_internal_check_status
> TypeError: a bytes-like object is required, not
> 'pyarrow.lib.SerializedPyObject'
> {code}
> The same code works in PyArrow 0.15.x
--
This message was sent by Atlassian Jira
(v8.3.4#803005)