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

Add Send to ArrayBuilder #290

Closed
Max-Meldrum opened this issue May 15, 2021 · 3 comments · Fixed by #291
Closed

Add Send to ArrayBuilder #290

Max-Meldrum opened this issue May 15, 2021 · 3 comments · Fixed by #291
Labels
arrow Changes to the arrow crate enhancement Any new improvement worthy of a entry in the changelog

Comments

@Max-Meldrum
Copy link
Contributor

Problem: I'm using a StructBuilder in Arcon to build up Arrow tables. The threading model ensures exclusive access to the builder but may move it across threads. The main problem is that ArrayBuilder does not implement Send so it fails to compile..

Solution:

// Old
pub trait ArrayBuilder: Any { .... }
// New
pub trait ArrayBuilder: Any + Send { .... }
@Max-Meldrum Max-Meldrum added the enhancement Any new improvement worthy of a entry in the changelog label May 15, 2021
@jorgecarleitao
Copy link
Member

Thanks for this.

Honest curiosity: what is the use-case where the ArrayBuilder is passed around?

Also, isn't it possible to use &dyn ArrayBuilder + Send on the code to enforce this?

@Max-Meldrum
Copy link
Contributor Author

Thanks for this.

Honest curiosity: what is the use-case where the ArrayBuilder is passed around?

Also, isn't it possible to use &dyn ArrayBuilder + Send on the code to enforce this?

Well it is not so much the ArrayBuilder being sent around, but it is a StructBuilder that is passed around which itself contains a bunch of field builders of Box<ArrayBuilder>. The use case is that a StructBuilder is used to build up columnar data in a streaming window. During the length of this window, the "worker" may move across threads as the underlying thread model uses a workstealing scheduler.

@jorgecarleitao
Copy link
Member

makes sense, thanks!

@alamb alamb added the arrow Changes to the arrow crate label May 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrow Changes to the arrow crate enhancement Any new improvement worthy of a entry in the changelog
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants