ZENOTME commented on code in PR #760:
URL: https://github.com/apache/iceberg-rust/pull/760#discussion_r1877278013


##########
crates/iceberg/src/writer/mod.rs:
##########
@@ -57,30 +59,130 @@ type DefaultInput = RecordBatch;
 type DefaultOutput = Vec<DataFile>;
 
 /// The builder for iceberg writer.
-#[async_trait::async_trait]
 pub trait IcebergWriterBuilder<I = DefaultInput, O = DefaultOutput>:
     Send + Clone + 'static
 {
     /// The associated writer type.
     type R: IcebergWriter<I, O>;
     /// The associated writer config type used to build the writer.
-    type C;
+    type C: Send + 'static;
     /// Build the iceberg writer.
-    async fn build(self, config: Self::C) -> Result<Self::R>;
+    fn build(self, config: Self::C) -> impl Future<Output = Result<Self::R>> + 
Send;
 }
 
 /// The iceberg writer used to write data to iceberg table.
-#[async_trait::async_trait]
 pub trait IcebergWriter<I = DefaultInput, O = DefaultOutput>: Send + 'static {
     /// Write data to iceberg table.
-    async fn write(&mut self, input: I) -> Result<()>;
+    fn write(&mut self, input: I) -> impl Future<Output = Result<()>> + Send + 
'_;
     /// Close the writer and return the written data files.
     /// If close failed, the data written before maybe be lost. User may need 
to recreate the writer and rewrite the data again.
     /// # NOTE
     /// After close, regardless of success or failure, the writer should never 
be used again, otherwise the writer will panic.
-    async fn close(&mut self) -> Result<O>;
+    fn close(&mut self) -> impl Future<Output = Result<O>> + Send + '_;

Review Comment:
   I think we can change `fn close(&mut self)` after `fn close(self)` in this 
PR. Because for now we don't need to concern the that it will make the trait be 
not object-safe. It can solve the problem in 
https://github.com/apache/iceberg-rust/pull/703#discussion_r1850434941. cc 
@liurenjie1024 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to