[jira] [Commented] (ARROW-11780) [C++][Python] StructArray.from_arrays() crashes Python interpreter

2021-04-18 Thread Prakhar Pandey (Jira)


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

Prakhar Pandey commented on ARROW-11780:


Like Alessandro mentions, call to _pyarrow_unwrap_array_ returns a null pointer 
because passed array is ChunkedArray. However I see 
_pyarrow_unwrap_chunked_array_ method present in the same file, maybe that 
should have been called?

I would be happy to investigate more and raise a PR.

 

 

> [C++][Python] StructArray.from_arrays() crashes Python interpreter
> --
>
> Key: ARROW-11780
> URL: https://issues.apache.org/jira/browse/ARROW-11780
> Project: Apache Arrow
>  Issue Type: Bug
>  Components: C++, Python
>Affects Versions: 3.0.0
>Reporter: ARF
>Assignee: Weston Pace
>Priority: Major
>
> {{StructArray.from_arrays()}} crashes the Python interpreter without error 
> message:
> {code:none}
> (test_pyarrow) Z:\test_pyarrow>python
> Python 3.8.5 (default, Sep  3 2020, 21:29:08) [MSC v.1916 64 bit (AMD64)] :: 
> Anaconda, Inc. on win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import pyarrow as pa
> >>>
> >>> table = pa.Table.from_pydict({
> ... 'foo': pa.array([1, 2, 3]),
> ... 'bar': pa.array([4, 5, 6])
> ... })
> >>>
> >>> pa.StructArray.from_arrays([table['foo'], table['bar']], ['foo', 'bar'])
> (test_pyarrow) Z:\test_pyarrow>
> {code}



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


[jira] [Commented] (ARROW-11780) [C++][Python] StructArray.from_arrays() crashes Python interpreter

2021-04-16 Thread Alessandro Molina (Jira)


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

Alessandro Molina commented on ARROW-11780:
---

The issue seems to origin from {{pyarrow_unwrap_array}} not recognising the two 
values as arrays.

An empty shared_ptr is returned when unwrapping something that is not an array, 
see 
[https://github.com/apache/arrow/pull/827/files#diff-fd3f36df959d5f57664e7c4ca21a59515d5649679e188e77a220af490ab2b601R126-R132]
 

The two arrays are in fact {{ChunkedArray}}s, thus the {{pyarrow_unwrap_array}} 
doesn't deal with them.

{code:python}
 [[1, 2, 3]]
{code}
 
I'm not sure on the impact over the rest of the codebase, but it seems it would 
be more robust to have {{pyarrow_unwrap_array}} (and similar methods) throwing 
an exception when they face unsupported types instead of returning NULL values 
that might trigger an action at a distance that is then hard to debug.

 

 

 

> [C++][Python] StructArray.from_arrays() crashes Python interpreter
> --
>
> Key: ARROW-11780
> URL: https://issues.apache.org/jira/browse/ARROW-11780
> Project: Apache Arrow
>  Issue Type: Bug
>  Components: C++, Python
>Affects Versions: 3.0.0
>Reporter: ARF
>Assignee: Weston Pace
>Priority: Major
>
> {{StructArray.from_arrays()}} crashes the Python interpreter without error 
> message:
> {code:none}
> (test_pyarrow) Z:\test_pyarrow>python
> Python 3.8.5 (default, Sep  3 2020, 21:29:08) [MSC v.1916 64 bit (AMD64)] :: 
> Anaconda, Inc. on win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import pyarrow as pa
> >>>
> >>> table = pa.Table.from_pydict({
> ... 'foo': pa.array([1, 2, 3]),
> ... 'bar': pa.array([4, 5, 6])
> ... })
> >>>
> >>> pa.StructArray.from_arrays([table['foo'], table['bar']], ['foo', 'bar'])
> (test_pyarrow) Z:\test_pyarrow>
> {code}



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


[jira] [Commented] (ARROW-11780) [C++][Python] StructArray.from_arrays() crashes Python interpreter

2021-04-16 Thread Alessandro Molina (Jira)


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

Alessandro Molina commented on ARROW-11780:
---

Confirmed I was able to reproduce the issue and saw the same behaviour

 
{code:java}
  * frame #0: 0x00010534d03c 
libarrow.400.dylib`std::__1::shared_ptr::operator->(this=0x0008)
 const at memory:3930:56
    frame #1: 0x00010534fa27 
libarrow.400.dylib`arrow::Array::type(this=0x) const at 
array_base.h:86:51
    frame #2: 0x000105416bea 
libarrow.400.dylib`arrow::StructArray::Make(children=size=2, 
field_names=size=2, null_bitmap=nullptr, null_count=-1, offset=0) at 
array_nested.cc:501:61
    frame #3: 0x00010510ed09 
lib.cpython-39-darwin.so`__pyx_pf_7pyarrow_3lib_11StructArray_4from_arrays(_object*,
 _object*, _object*) + 6057
{code}
 

> [C++][Python] StructArray.from_arrays() crashes Python interpreter
> --
>
> Key: ARROW-11780
> URL: https://issues.apache.org/jira/browse/ARROW-11780
> Project: Apache Arrow
>  Issue Type: Bug
>  Components: C++, Python
>Affects Versions: 3.0.0
>Reporter: ARF
>Assignee: Weston Pace
>Priority: Major
>
> {{StructArray.from_arrays()}} crashes the Python interpreter without error 
> message:
> {code:none}
> (test_pyarrow) Z:\test_pyarrow>python
> Python 3.8.5 (default, Sep  3 2020, 21:29:08) [MSC v.1916 64 bit (AMD64)] :: 
> Anaconda, Inc. on win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import pyarrow as pa
> >>>
> >>> table = pa.Table.from_pydict({
> ... 'foo': pa.array([1, 2, 3]),
> ... 'bar': pa.array([4, 5, 6])
> ... })
> >>>
> >>> pa.StructArray.from_arrays([table['foo'], table['bar']], ['foo', 'bar'])
> (test_pyarrow) Z:\test_pyarrow>
> {code}



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