Skip to content
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

StructArray take doesn't make fields nullable #6727

Open
gatesn opened this issue Nov 13, 2024 · 5 comments
Open

StructArray take doesn't make fields nullable #6727

gatesn opened this issue Nov 13, 2024 · 5 comments
Labels

Comments

@gatesn
Copy link

gatesn commented Nov 13, 2024

Describe the bug
When calling arrow::compute::take on a StructArray with non-nullable fields and passing take indices that contain null values, the resulting StructArray still has non-nullable fields. This is an invalid state.

Expected behavior
The take function should convert all fields to nullable iff the take indices contain any nulls.

https://docs.rs/arrow-select/53.2.0/src/arrow_select/take.rs.html#238-239

@gatesn gatesn added the bug label Nov 13, 2024
@tustvold
Copy link
Contributor

Generally I wouldn't expect a selection kernel to alter the schema, so I think in this case it should raise an error

@gatesn
Copy link
Author

gatesn commented Nov 13, 2024

Yes that's also reasonable.


It's a bit annoying that Arrow DataTypes don't themselves have a nullable flat, since the selection kernels over non-nested arrays can also introduce nulls to previously non-null arrays.

@irenjj
Copy link

irenjj commented Nov 13, 2024

take

@tustvold
Copy link
Contributor

It's a bit annoying that Arrow DataTypes don't themselves have a nullable flat

One way to get this is to use StructArray in place of RecordBatch, this is actually what a lot of the IO logic in arrow-rs does, converting to RecordBatch at the edges.

IMO RecordBatch is confusing and arrow would be better off without it, but it's too late for that now 😅

@malikrohail
Copy link

can i fix

@irenjj irenjj removed their assignment Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants