CTTY commented on code in PR #1657:
URL: https://github.com/apache/iceberg-rust/pull/1657#discussion_r2389958571
##########
crates/iceberg/src/writer/file_writer/rolling_writer.rs:
##########
@@ -15,67 +15,121 @@
// specific language governing permissions and limitations
// under the License.
+use std::fmt::{Debug, Formatter};
+
use arrow_array::RecordBatch;
-use crate::spec::DataFileBuilder;
+use crate::io::{FileIO, OutputFile};
+use crate::spec::{DataFileBuilder,
PROPERTY_WRITE_TARGET_FILE_SIZE_BYTES_DEFAULT, PartitionKey};
use crate::writer::CurrentFileStatus;
+use crate::writer::file_writer::location_generator::{FileNameGenerator,
LocationGenerator};
use crate::writer::file_writer::{FileWriter, FileWriterBuilder};
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 file 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 RollingFileWriter<B: FileWriterBuilder, L: LocationGenerator, F:
FileNameGenerator> {
+ inner: Option<B::R>,
inner_builder: B,
target_file_size: usize,
+ data_file_builders: Vec<DataFileBuilder>,
+ file_io: FileIO,
+ location_generator: L,
+ file_name_generator: F,
+}
+
+impl<B: FileWriterBuilder, L: LocationGenerator, F: FileNameGenerator> Clone
Review Comment:
Yes I agree, I think bringing the RollingFileWriterBuilder back and removing
this Clone implementation is the correct way to go. I can make the change
tomorrow and we can review that
--
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]