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

Change UnionArray constructors #5623

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

mbrobbel
Copy link
Contributor

Which issue does this PR close?

Closes #5613.

Rationale for this change

It came up in #5585 that the UnionArray constructors are a bit odd when compared to the other array constructors.

What changes are included in this PR?

UnionArray::try_new and UnionArray::new_unchecked

Changed arguments:
From: field_type_ids: &[i8], type_ids: Buffer, value_offsets: Option<Buffer>, child_arrays: Vec<(Field, ArrayRef)>
To: fields: UnionFields, type_ids: ScalarBuffer<i8>, offsets: Option<ScalarBuffer<i32>>, children: Vec<ArrayRef>.

The order of children arrays must match the order of fields in the UnionFields.

The validation in try_new is a bit more strict.

UnionBuilder

It now uses a BTreeMap instead of a HashMap internally to get sorted iteration.

Are there any user-facing changes?

This is a breaking change that changes the UnionArray constructors.

@github-actions github-actions bot added arrow Changes to the arrow crate arrow-flight Changes to the arrow-flight crate labels Apr 10, 2024
@tustvold tustvold added the api-change Changes to the arrow API label Apr 11, 2024
@tustvold
Copy link
Contributor

In light of #5368 I think I would like to sit on this for a bit, and we can look to get this bundled in when we next make a breaking release

@tustvold
Copy link
Contributor

tustvold commented May 8, 2024

I took the liberty of merging up main, making some minor tweaks to avoid hashmaps, and adding some additional tests. I think if you're happy this is then ready to go in (the next release is going to be breaking)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-change Changes to the arrow API arrow Changes to the arrow crate arrow-flight Changes to the arrow-flight crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cleanup UnionArray Constructors
2 participants