You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Paul Balanca (Jira)" <ji...@apache.org> on 2021/07/28 11:23:01 UTC

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

Paul Balanca created ARROW-13474:
------------------------------------

             Summary: [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: 4.0.1, 4.0.0, 3.0.0
         Environment: Python 3.7, Ubuntu 20.04
            Reporter: Paul Balanca
            Assignee: Paul Balanca


PyArrow is crashing when apply `filter` or `take` on some already empty extension array.

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)