-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Python] Can't create a non empty StructArray with no field using StructArray.from_array
#15109
Comments
We currently have a special case for this in arrow/python/pyarrow/array.pxi Lines 2785 to 2788 in 359f28b
|
StructArray.from_array
StructArray.from_array
@jorisvandenbossche should I try to handle the mask argument in that branch of the code? |
It might be worth first checking if the C++ code can handle this nowadays, otherwise handling it there sounds good (maybe a |
Nope, the C++ method handle this yet: arrow/cpp/src/arrow/array/array_nested.cc Lines 530 to 540 in 359f28b
|
Should we change it to:
And probably change the code below to infer the size from the |
That sounds as an option as well |
Hmm, actually in C++ the null_bitmap is in the shape of a buffer: |
Ah, no, a Buffer has a size, but this is the size in bytes, which in case of a null bitmap doesn't give you the length of the array. |
Describe the bug, including details regarding any error messages, version, and platform.
I want to create a StructArray with several rows but no fields/columns:
As commented in the code
len(array)
is wrong and should be 2 (according to the provided mask).I found a work around but it's not ideal:
Component(s)
Python
The text was updated successfully, but these errors were encountered: