You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Joris Van den Bossche (Jira)" <ji...@apache.org> on 2021/09/24 12:41:00 UTC

[jira] [Commented] (ARROW-13474) [C++][Python] PyArrow crash when filter/take empty Extension array

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

Joris Van den Bossche commented on ARROW-13474:
-----------------------------------------------

I opened a PR to fix this (so we can get it into the next release).

> [C++][Python] PyArrow crash when filter/take empty Extension array
> ------------------------------------------------------------------
>
>                 Key: ARROW-13474
>                 URL: https://issues.apache.org/jira/browse/ARROW-13474
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: C++, Python
>    Affects Versions: 3.0.0, 4.0.0, 4.0.1
>         Environment: Python 3.7, Ubuntu 20.04
>            Reporter: Paul Balanca
>            Assignee: Joris Van den Bossche
>            Priority: Major
>             Fix For: 6.0.0
>
>
> PyArrow is crashing when applying `filter` or `take` on already empty extension arrays.
> The bug can be reproduced with the documentation example:
> {code:java}
> import pyarrow as pa
> class Point3DArray(pa.ExtensionArray):
>     def to_numpy_array(self):
>         return self.storage.flatten().to_numpy().reshape((-1, 3))
> class Point3DType(pa.PyExtensionType):
>     def __init__(self):
>         pa.PyExtensionType.__init__(self, pa.list_(pa.float32(), 3))
>     def __reduce__(self):
>         return Point3DType, ()
>     def __arrow_ext_class__(self):
>         return Point3DArray
> storage = pa.array([[1, 2, 3], [4, 5, 6]], pa.list_(pa.float32(), 3))
> arr = pa.ExtensionArray.from_storage(Point3DType(), storage)
> arr = arr.filter(pa.array([False, False]))
> # Crashing here...
> arr.filter(pa.array([], pa.bool_()))
> # Crashing as well...
> arr.take(pa.array([], pa.int32())){code}
> The underlying issue seems to be that the function `nulls` is not implemented for extension types in the C++ codebase: [https://github.com/apache/arrow/blob/6db88a9e946c98c59f179210a70bc05ef6a0a296/cpp/src/arrow/array/util.cc#L472]



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