Xuanwo commented on code in PR #1301:
URL: https://github.com/apache/iceberg-rust/pull/1301#discussion_r2082752305


##########
crates/iceberg/src/transaction/snapshot.rs:
##########
@@ -129,6 +129,13 @@ impl<'a> SnapshotProduceAction<'a> {
         data_files: impl IntoIterator<Item = DataFile>,
     ) -> Result<&mut Self> {
         let data_files: Vec<DataFile> = data_files.into_iter().collect();
+        if data_files.is_empty() {

Review Comment:
   > If the given iterator is empty, we will end up with a manifest file with 
no manifest entries, with no warning / error happening (it's exactly the same 
behavior you described), this is something I would like to avoid.
   
   This is valid and I do agree that we should not generate an empty manifest 
file. 
   
   However, the `add_data_files` function itself should be able to handle empty 
input safely, as users might use it in loops or pipelines with filters, where 
encountering an empty iterator is possible.
   
   Therefore, I prefer to perform this check when committing the manifest file, 
rather than within `add_data_files`.



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