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

ARROW-11356: [Rust] Add method to PrimitiveArray::from_value to efficiently create an Array from a value #9300

Closed
wants to merge 1 commit into from

Conversation

Dandandan
Copy link
Contributor

In DataFusion (and probably this would pop up in more use cases) we want to efficiently create an array with n items with the same value (instead of creating it from a Vec of values or iterator).

As discussed in here:
#9293

@github-actions
Copy link

@Dandandan Dandandan changed the title ARROW-11356: [Rust] Add method to PrimitiveArra::from_value to efficiently create an Array from a value ARROW-11356: [Rust] Add method to PrimitiveArray::from_value to efficiently create an Array from a value Jan 23, 2021
@jorgecarleitao
Copy link
Member

Do you see any difference between this one and using the iterator? I would expect them to perform equally well, since both are using push.

@Dandandan
Copy link
Contributor Author

Dandandan commented Jan 24, 2021

@jorgecarleitao I agree, it makes more sense to wait until this is faster and for now use the iterator for this case (even if it is slightly more verbose).
I think at some point this version could be specialized to use (the soon stable) slice.fill though, which I expect would be faster than using an iterator.

@Dandandan Dandandan closed this Jan 24, 2021
@Dandandan
Copy link
Contributor Author

Creating an null array with known size might be another that might come up in the future, but I am witholding that until it is supported by some use case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants