Support casting StringArray/BinaryArray --> StringView / BinaryView#5686
Merged
alamb merged 4 commits intoapache:masterfrom Apr 26, 2024
Merged
Support casting StringArray/BinaryArray --> StringView / BinaryView#5686alamb merged 4 commits intoapache:masterfrom
StringArray/BinaryArray --> StringView / BinaryView#5686alamb merged 4 commits intoapache:masterfrom
Conversation
50f7b36 to
4c5105b
Compare
7 tasks
GenericByteArray to ByteArrayView
GenericByteArray to ByteArrayViewStringArray/BinaryArray --> StringView / BinaryView
2 tasks
alamb
approved these changes
Apr 26, 2024
Contributor
alamb
left a comment
There was a problem hiding this comment.
Thank you for this contribution @RinChanNOWWW -- other than using GenericByteViewArray::new_unchecked I think this PR looks wonderful.
I also think we could also merge the PR as is and then switch to new-unchecked in a follow on PR
| let value_buf = &str_values_buf[offset as usize..end as usize]; | ||
| let length = end - offset; | ||
|
|
||
| if length <= 12 { |
Contributor
There was a problem hiding this comment.
As an aside (not for this PR) it would be great to somehow encapsulate this logic into a struct to avoid having to copy the same pattern it so many times. I took a shot at this here #5619
Contributor
Author
There was a problem hiding this comment.
The new enum View looks good to me.
alamb
reviewed
Apr 26, 2024
Contributor
|
Thanks @RinChanNOWWW -- I took the liberty of adding a comment to the code in this PR justifying why the unsafe was ok and plan to merge the PR when complete |
Contributor
|
🚀 |
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.
Which issue does this PR close?
Part of #5508.
Casting byte view array to byte array and casting between dictionary array and byte view array will be done in other PRs.
Rationale for this change
What changes are included in this PR?
Support casting from byte array (
BinaryArray,StringArray) to byte view array (BinaryViewArray,StringVIewArray).Are there any user-facing changes?
No.