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


##########
crates/iceberg/src/writer/file_writer/rolling_writer.rs:
##########
@@ -17,65 +17,75 @@
 
 use arrow_array::RecordBatch;
 
-use crate::spec::DataFileBuilder;
-use crate::writer::CurrentFileStatus;
-use crate::writer::file_writer::{FileWriter, FileWriterBuilder};
+use crate::io::FileIO;
+use crate::spec::{DataFile, PartitionKey};
+use crate::writer::file_writer::location_generator::{FileNameGenerator, 
LocationGenerator};
+use crate::writer::{CurrentFileStatus, IcebergWriter, IcebergWriterBuilder};
 use crate::{Error, ErrorKind, Result};
 
-/// Builder for creating a `RollingFileWriter` that rolls over to a new file
-/// when the data size exceeds a target threshold.
-#[derive(Clone)]
-pub struct RollingFileWriterBuilder<B: FileWriterBuilder> {
+/// A writer that automatically rolls over to a new file when the data size
+/// exceeds a target threshold.
+///
+/// This writer wraps another writer that tracks the amount of data written.
+/// When the data size exceeds the target size, it closes the current file and
+/// starts writing to a new one.
+pub struct RollingWriter<B, L, F>
+where
+    B: IcebergWriterBuilder,
+    L: LocationGenerator,
+    F: FileNameGenerator,
+{
+    inner: Option<B::R>,
     inner_builder: B,
     target_file_size: usize,
+    location_generator: L,
+    file_name_generator: F,
+    file_io: FileIO,
+    partition_key: Option<PartitionKey>,
+    data_files: Vec<DataFile>, // todo this should be B::R::O? DefaultOutput?
 }
 
-impl<B: FileWriterBuilder> RollingFileWriterBuilder<B> {
-    /// Creates a new `RollingFileWriterBuilder` with the specified inner 
builder and target size.
+impl<B, L, F> RollingWriter<B, L, F>
+where
+    B: IcebergWriterBuilder,

Review Comment:
   > I think custom writers can either implement FileWriter (lightweighted, 
file-level customization) or PartitioningWriter (heavier, customization across 
multiple partitions).
   
   E.g. user want to access PositionDeleteInput directly. 
   
   ```
   pub struct RollingWriter<B, L, F, I, O>
   where
       B: IcebergWriterBuilder<I, O>,
       L: LocationGenerator,
       F: FileNameGenerator,
   ```
   
   I think this way can be easier to extend in the future and give more 
feasible to let user custom. But both way looks good to me if it introduce too 
much unnecessary complication.
   
   



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to