[ 
https://issues.apache.org/jira/browse/ARROW-6349?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16915354#comment-16915354
 ] 

Wes McKinney commented on ARROW-6349:
-------------------------------------

Arrow 0.11.1 is almost a year old, I recommend using a newer version. This is 
still the case in master, though

{code}
import pyarrow
import numpy as np
a=np.zeros([500,600,3])
b=a[:,:,::-1]
pyarrow.serialize(b)

## -- End pasted text --
---------------------------------------------------------------------------
ArrowInvalid                              Traceback (most recent call last)
<ipython-input-1-daa40bd626c9> in <module>
      3 a=np.zeros([500,600,3])
      4 b=a[:,:,::-1]
----> 5 pyarrow.serialize(b)

~/code/arrow/python/pyarrow/serialization.pxi in pyarrow.lib.serialize()
    356 
    357     with nogil:
--> 358         check_status(SerializeObject(context, wrapped_value, 
&serialized.data))
    359     return serialized
    360 

~/code/arrow/python/pyarrow/error.pxi in pyarrow.lib.check_status()
     76         message = frombytes(status.message())
     77         if status.IsInvalid():
---> 78             raise ArrowInvalid(message)
     79         elif status.IsIOError():
     80             raise ArrowIOError(message)

ArrowInvalid: Negative ndarray strides not supported
In ../src/arrow/python/serialize.cc, line 510, code: 
NdarrayToTensor(default_memory_pool(), reinterpret_cast<PyObject*>(array), {}, 
&tensor)
In ../src/arrow/python/serialize.cc, line 464, code: AppendArray(context, 
reinterpret_cast<PyArrayObject*>(elem), builder, recursion_depth, blobs_out)
In ../src/arrow/python/iterators.h, line 70, code: func(value, 
static_cast<int64_t>(i), &keep_going)
In ../src/arrow/python/serialize.cc, line 538, code: internal::VisitIterable( 
sequence, [&](PyObject* obj, bool* keep_going ) { return Append(context, obj, 
&builder, 0, out); })
{code}

> [Python/numpy] ArrowInvalid: Negative ndarray strides not supported
> -------------------------------------------------------------------
>
>                 Key: ARROW-6349
>                 URL: https://issues.apache.org/jira/browse/ARROW-6349
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: Python
>         Environment: Ubuntu 16.04, python 3.6.6, numpy 1.14.6, pyarrow 0.11.1
>            Reporter: YUTING ZHANG
>            Priority: Major
>
> When indexing a np.ndarray with negative stride, arrow cannot serialize it. 
> However, this could be a common use case for reversing along an axis. 
>  
> Code:
> {code:java}
> import pyarrow
> import numpy as np
> a=np.zeros([500,600,3])
> b=a[:,:,::-1]
> pyarrow.serialize(b)
> {code}
>  
> Error:
> {code:java}
> ArrowInvalid Traceback (most recent call last)
> <ipython-input-7-bf252de95dc1> in <module>()
> ----> 1 pyarrow.serialize(b)
> ~/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/pyarrow/serialization.pxi
>  in pyarrow.lib.serialize()
> ~/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/pyarrow/error.pxi in 
> pyarrow.lib.check_status()
> ArrowInvalid: Negative ndarray strides not supported
> {code}
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

Reply via email to