Skip to content

[Python] pyarrow.array segfaults when passed masked array with shrunken mask #17085

Closed

Description

@asfimport
>>> import numpy as np, pyarrow as pa                               
>>> pa.array(np.ma.array([0]))

I think the issue might be here because when the masked array has a shrunken mask, it's values is False rather than the boolean mask array.

        if isinstance(values, np.ma.MaskedArray):
            if mask is not None:
                raise ValueError("Cannot pass a numpy masked array and "
                                 "specify a mask at the same time")
            else:
                mask = values.mask
                values = values.data

Reporter: Daniel Nugent / @nugend
Assignee: Daniel Nugent / @nugend

PRs and other links:

Note: This issue was originally created as ARROW-8105. Please see the migration documentation for further details.

Activity

  1. asfimport commented on Mar 13, 2020

    @asfimport
    Author

    Wes McKinney / @wesm:
    I don't think the numpy.ma path has seen a lot of use (because numpy.ma is not widely used) so it doesn't surprise me that there are some issues like this

  2. asfimport commented on Mar 13, 2020

    @asfimport
    Author

    Daniel Nugent / @nugend:
    Put up a PR. Independent of the big: if masked arrays are not widely used, does that mean they should be avoided?

  3. asfimport commented on Mar 13, 2020

    @asfimport
    Author

    Wes McKinney / @wesm:
    I think it's fine for us to "unbox" them into Arrow format. I wouldn't recommend building applications based on them nowadays since the level of support / compatibility in other projects is low.

  4. asfimport commented on Mar 17, 2020

    @asfimport
    Author

    Joris Van den Bossche / @jorisvandenbossche:
    Issue resolved by pull request 6612
    #6612

  5. added this to the 0.17.0 milestone on Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions