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


##########
crates/iceberg/src/transaction/snapshot.rs:
##########
@@ -251,12 +251,7 @@ impl<'a> SnapshotProducer<'a> {
     // Write manifest file for added data files and return the ManifestFile 
for ManifestList.
     async fn write_added_manifest(&mut self) -> Result<ManifestFile> {
         let added_data_files = std::mem::take(&mut self.added_data_files);
-        if added_data_files.is_empty() {
-            return Err(Error::new(
-                ErrorKind::PreconditionFailed,
-                "No added data files found when write a manifest file",
-            ));
-        }
+        assert!(!added_data_files.is_empty());

Review Comment:
   I'm not a big fan of using assert here, I would prefer to return `Err` here. 
If you insist on using assersation, I would suggest to use `debug_assert`.



##########
crates/iceberg/src/transaction/snapshot.rs:
##########
@@ -284,13 +279,26 @@ impl<'a> SnapshotProducer<'a> {
         snapshot_produce_operation: &OP,
         manifest_process: &MP,
     ) -> Result<Vec<ManifestFile>> {
-        let added_manifest = self.write_added_manifest().await?;
+        // Assert current snapshot producer contains new content to add to new 
snapshot.
+        if self.added_data_files.is_empty() && 
self.snapshot_properties.is_empty() {

Review Comment:
   Please create an issue to track that we need to remove this workaround when 
we introduced all necessary tx apis.



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