Properly support sliced unions#91
Merged
ncpenke merged 2 commits intoJan 15, 2023
Merged
Conversation
This was referenced Jan 15, 2023
Codecov Report
@@ Coverage Diff @@
## main #91 +/- ##
==========================================
- Coverage 98.25% 94.36% -3.89%
==========================================
Files 8 8
Lines 1490 1544 +54
==========================================
- Hits 1464 1457 -7
- Misses 26 87 +61
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Collaborator
|
Thank you for the contribution and simplification @jleibs! I was considering a similar approach, but wasn't sure what the performance implication of going through the full array deserialization would be for each union element. However, we don't have benchmarks around that yet, and this seems to be a reasonable trade-off for enabling more functionality, so will go ahead and merge this PR. There's some minor code cleanup but I'll take care of that in another pass. |
This was referenced Feb 10, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I believe this resolves: #53
Rather than creating and maintaining parallel iterators, this uses the
UnionArray::index()method to find the correct offset value to deserialize from and then deserializes from a newly created slice at that location in the correct child-array. One nice aspect to this approach is it generalizes to Sparse unions sinceindex()does the correct book-keeping for us.