-
Notifications
You must be signed in to change notification settings - Fork 536
refactor(writer): Make writer builders non-consuming in build #1889
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
Changes from 4 commits
96f654a
029a384
db891df
6b3dac1
967c155
738fafe
b58c463
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -117,17 +117,17 @@ impl EqualityDeleteWriterConfig { | |
| #[async_trait::async_trait] | ||
| impl<B, L, F> IcebergWriterBuilder for EqualityDeleteFileWriterBuilder<B, L, F> | ||
| where | ||
| B: FileWriterBuilder, | ||
| L: LocationGenerator, | ||
| F: FileNameGenerator, | ||
| B: FileWriterBuilder + Sync, | ||
| L: LocationGenerator + Sync, | ||
| F: FileNameGenerator + Sync, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here |
||
| { | ||
| type R = EqualityDeleteFileWriter<B, L, F>; | ||
|
|
||
| async fn build(self, partition_key: Option<PartitionKey>) -> Result<Self::R> { | ||
| async fn build(&self, partition_key: Option<PartitionKey>) -> Result<Self::R> { | ||
| Ok(EqualityDeleteFileWriter { | ||
| inner: Some(self.inner.clone().build()), | ||
| projector: self.config.projector, | ||
| equality_ids: self.config.equality_ids, | ||
| projector: self.config.projector.clone(), | ||
| equality_ids: self.config.equality_ids.clone(), | ||
| partition_key, | ||
| }) | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -145,10 +145,10 @@ | |
| //! } | ||
| //! | ||
| //! #[async_trait::async_trait] | ||
| //! impl<B: IcebergWriterBuilder> IcebergWriterBuilder for LatencyRecordWriterBuilder<B> { | ||
| //! impl<B: IcebergWriterBuilder + Sync> IcebergWriterBuilder for LatencyRecordWriterBuilder<B> { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there any reason why we don't add Sync as supertrait here?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @CTTY This was the missing part. Thank you! |
||
| //! type R = LatencyRecordWriter<B::R>; | ||
| //! | ||
| //! async fn build(self, partition_key: Option<PartitionKey>) -> Result<Self::R> { | ||
| //! async fn build(&self, partition_key: Option<PartitionKey>) -> Result<Self::R> { | ||
| //! Ok(LatencyRecordWriter { | ||
| //! inner_writer: self.inner_writer_builder.build(partition_key).await?, | ||
| //! }) | ||
|
|
@@ -404,7 +404,7 @@ pub trait IcebergWriterBuilder<I = DefaultInput, O = DefaultOutput>: | |
| /// The associated writer type. | ||
| type R: IcebergWriter<I, O>; | ||
| /// Build the iceberg writer with an optional partition key. | ||
| async fn build(self, partition_key: Option<PartitionKey>) -> Result<Self::R>; | ||
| async fn build(&self, partition_key: Option<PartitionKey>) -> Result<Self::R>; | ||
| } | ||
|
|
||
| /// The iceberg writer used to write data to iceberg table. | ||
|
|
||
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.
I think we should just add supertrait
Syncto these traits to enforce it across different implementationsThere 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.
Also we should remove the
Clonein trait implementation in builders.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.
Thanks for the feedback, updated in 967c155.