liurenjie1024 commented on code in PR #1657:
URL: https://github.com/apache/iceberg-rust/pull/1657#discussion_r2351756821


##########
crates/iceberg/src/writer/mod.rs:
##########
@@ -229,20 +229,30 @@ pub mod file_writer;
 use arrow_array::RecordBatch;
 
 use crate::Result;
-use crate::spec::DataFile;
+use crate::io::OutputFile;
+use crate::spec::{DataFile, PartitionKey};
 
 type DefaultInput = RecordBatch;
 type DefaultOutput = Vec<DataFile>;
 
+/// The partitioning writer used to write data to multiple partitions.
+pub trait PartitioningWriter {

Review Comment:
   Add `#[async_trait]` annotation?



##########
crates/iceberg/src/writer/mod.rs:
##########
@@ -229,20 +229,30 @@ pub mod file_writer;
 use arrow_array::RecordBatch;
 
 use crate::Result;
-use crate::spec::DataFile;
+use crate::io::OutputFile;
+use crate::spec::{DataFile, PartitionKey};
 
 type DefaultInput = RecordBatch;
 type DefaultOutput = Vec<DataFile>;
 
+/// The partitioning writer used to write data to multiple partitions.
+pub trait PartitioningWriter {
+    /// Write a record batch, all rows from this record batch should come from 
one partition
+    fn write(&mut self, partition_key: PartitionKey, batch: RecordBatch) -> 
Result<()>;
+
+    /// Close all writers and return the data files.
+    fn close(&mut self) -> Result<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>;
-    /// Build the iceberg writer.
-    async fn build(self) -> Result<Self::R>;
+    /// Build the iceberg writer with the provided output file.
+    async fn build(self, output_file: OutputFile) -> Result<Self::R>;

Review Comment:
   We don't need this change per our discussion?



-- 
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