-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
ARROW-11349: [Rust] Add from_iter_values to create arrays from (non null) values #9293
Closed
Closed
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
37c70fb
Add from_iter_values to create arrays from (non null) values
Dandandan 8cd118d
Remove borrow (they are primitive types anyway)
Dandandan 3a63974
Fix comment
Dandandan 79c92aa
Merge branch 'master' of github.com:apache/arrow into array_iter_non_…
Dandandan 941ee5d
Use extend
Dandandan a37941c
Use .collect() api
Dandandan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we wait for #9235? It introduces a method to extend a
MutableBuffer
out of an iterator of Native types. It will also allow to drop the.expect("Iterator must be sized")
, since it will be possible to extend it out of unsized iterators.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, sure 👍 sounds like a good idea
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#9235 is merged
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jorgecarleitao is the new usage with
extend
what you meant?We also have to know the final count for creating the array, are you thinking of calculating that with
val_buf.len() / mem::size_of::<<T as ArrowPrimitiveType>::Native>()
or is there an other way?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that is what I meant: it should now be possible to do
wrt to the
len
: that is a good point that I have had not thought about. 👍One option is to do what you wrote. Another could be (I haven't tried to compile this, as
Fn
could becomeFnMut
):I would probably have taken your idea, though :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah with just
Buffer
andcollect
this is even more clean. I adapted the code with the new API.