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

Handle offset consistently for StructArray (#1750) #2085

Closed
wants to merge 3 commits into from

Conversation

tustvold
Copy link
Contributor

@tustvold tustvold commented Jul 15, 2022

Which issue does this PR close?

Closes #1750

Rationale for this change

The special casing of StructArray is inconsistent with how offsets are handled for all other types. This makes an already very confusing parameter, even more confusing.

What changes are included in this PR?

Removes the special-casing of StructArray in ArrayData::slice, instead handling it within the Array implementation as is done for all other array types. Longer term we may want to revisit the offset field, #1799, but until then we should be consistent.

Are there any user-facing changes?

Sort of, whilst extremely unlikely any code is actually doing this, it was possible to manually construct an ArrayData for a StructArray with a non-zero offset. This previously would not behave correctly (as it wasn't entirely clear what the correct semantics even where).

@github-actions github-actions bot added the arrow Changes to the arrow crate label Jul 15, 2022
@tustvold tustvold marked this pull request as draft July 15, 2022 18:44
@tustvold tustvold added the api-change Changes to the arrow API label Jul 15, 2022
@tustvold tustvold marked this pull request as ready for review July 15, 2022 19:20
@tustvold
Copy link
Contributor Author

Having thought a bit about this, rather than introduce two breaking changes - one to make the offsets consistent, and then one to remove them, I'd rather just remove them

@tustvold tustvold closed this Jul 15, 2022
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inconsistent Slicing of ArrayData for StructArray
1 participant