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

Remove Sync from SendableRecordBatchStream #1614

Closed
tustvold opened this issue Jan 19, 2022 · 2 comments · Fixed by #1884
Closed

Remove Sync from SendableRecordBatchStream #1614

tustvold opened this issue Jan 19, 2022 · 2 comments · Fixed by #1884
Labels
api change Changes the API exposed to users of the crate datafusion Changes in the datafusion crate enhancement New feature or request good first issue Good for newcomers

Comments

@tustvold
Copy link
Contributor

tustvold commented Jan 19, 2022

Is your feature request related to a problem or challenge? Please describe what you are trying to do.

Currently SendableRecordBatchStream imposes Sync constraints.

pub type SendableRecordBatchStream = Pin<Box<dyn RecordBatchStream + Send + Sync>>;

This is unfortunate as not all streams have Sync bounds, furthermore it is unclear why Sync is particularly useful for a stream.

A type is Sync if a reference to it can be shared across multiple threads, as opposed to Send which just requires that it can be sent to another thread. However, you can only poll a stream with a mutable, and therefore exclusive reference. The only thing you can therefore do with a &SendableRecordBatchStream is get the schema which I doubt is being exploited anywhere.

Describe the solution you'd like

Remove the Sync constraint

Describe alternatives you've considered

Keep the sync constraint

Additional context

This constraint currently forces a Mutex in FlightDataStream even though it should be unnecessary - see here

@tustvold tustvold added the enhancement New feature or request label Jan 19, 2022
@alamb
Copy link
Contributor

alamb commented Jan 21, 2022

This would be an API breaking change, but seems reasonable to me.

@alamb alamb added datafusion Changes in the datafusion crate api change Changes the API exposed to users of the crate good first issue Good for newcomers labels Jan 21, 2022
@alamb
Copy link
Contributor

alamb commented Jan 21, 2022

This is basically a code refactoring task -- it would require getting friendly with the rust compiler but not need knowledge of DataFusion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api change Changes the API exposed to users of the crate datafusion Changes in the datafusion crate enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants