emkornfield commented on code in PR #1851:
URL: https://github.com/apache/iceberg-rust/pull/1851#discussion_r2530687902


##########
crates/iceberg/src/spec/manifest_list.rs:
##########
@@ -198,23 +202,52 @@ impl ManifestListWriter {
             sequence_number,
             snapshot_id,
             first_row_id,
+            CompressionSettings::default(),
         )
     }
 
+    /// Set compression settings for the manifest list file.
+    pub fn with_compression(mut self, compression: CompressionSettings) -> 
Self {
+        self.compression = compression.clone();
+
+        // Recreate the avro_writer with the new codec
+        let avro_schema = match self.format_version {
+            FormatVersion::V1 => &MANIFEST_LIST_AVRO_SCHEMA_V1,
+            FormatVersion::V2 => &MANIFEST_LIST_AVRO_SCHEMA_V2,
+            FormatVersion::V3 => &MANIFEST_LIST_AVRO_SCHEMA_V3,
+        };
+
+        // Use CompressionSettings to get codec
+        let codec = compression.to_codec();
+
+        let new_writer = Writer::with_codec(avro_schema, Vec::new(), codec);
+
+        // Copy over existing metadata from the old writer
+        // Unfortunately, we can't extract metadata from the old writer,
+        // so we'll need to handle this differently
+        self.avro_writer = new_writer;

Review Comment:
   this was a bug, waiting to happen.



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