CTTY commented on code in PR #1448:
URL: https://github.com/apache/iceberg-rust/pull/1448#discussion_r2153519378


##########
crates/iceberg/src/transaction/append.rs:
##########
@@ -16,43 +16,132 @@
 // under the License.
 
 use std::collections::{HashMap, HashSet};
+use std::sync::Arc;
 
+use async_trait::async_trait;
 use uuid::Uuid;
 
 use crate::error::Result;
-use crate::spec::{DataFile, ManifestEntry, ManifestFile, Operation};
-use crate::transaction::Transaction;
+use crate::spec::{DataFile, ManifestEntry, ManifestFile, Operation, Struct, 
StructType};
+use crate::table::Table;
 use crate::transaction::snapshot::{
-    DefaultManifestProcess, SnapshotProduceAction, SnapshotProduceOperation,
+    DefaultManifestProcess, SnapshotProduceOperation, SnapshotProducer,
 };
+use crate::transaction::{ActionCommit, TransactionAction};
 use crate::writer::file_writer::ParquetWriter;
 use crate::{Error, ErrorKind};
 
 /// FastAppendAction is a transaction action for fast append data files to the 
table.
 pub struct FastAppendAction {
-    snapshot_produce_action: SnapshotProduceAction,
     check_duplicate: bool,
+    // below are properties used to create SnapshotProducer when commit
+    snapshot_id: i64,
+    commit_uuid: Uuid,
+    key_metadata: Vec<u8>,
+    snapshot_properties: HashMap<String, String>,
+    added_data_files: Vec<DataFile>,
 }
 
 impl FastAppendAction {
-    #[allow(clippy::too_many_arguments)]
-    pub(crate) fn new(
-        tx: Transaction,
-        snapshot_id: i64,
-        commit_uuid: Uuid,
-        key_metadata: Vec<u8>,
-        snapshot_properties: HashMap<String, String>,
-    ) -> Result<Self> {
-        Ok(Self {
-            snapshot_produce_action: SnapshotProduceAction::new(
-                tx,
-                snapshot_id,
-                key_metadata,
-                commit_uuid,
-                snapshot_properties,
-            )?,
+    pub(crate) fn new(snapshot_id: i64, commit_uuid: Uuid, key_metadata: 
Vec<u8>) -> Self {

Review Comment:
   I agree, something like this makes more sense:
   ```
       pub fn fast_append(&self) -> FastAppendAction {
           FastAppendAction::new(self.generate_unique_snapshot_id())
       }
   ---
   tx.fast_append().set_commit_uuid(...).set_key_metadata(...)
   ```
   
   I also believe `key_metadata` should be an `Option`? In the existing code it 
seems that it's required, even though you can provide an empty vector



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