blackmwk commented on code in PR #3564:
URL: https://github.com/apache/iceberg-rust/pull/3564#discussion_r4441164939


##########
crates/iceberg/src/transaction/snapshot/manifest_filter.rs:
##########
@@ -0,0 +1,227 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! Rewrites existing manifests to mark files as deleted.
+
+use std::collections::{HashMap, HashSet};
+
+use uuid::Uuid;
+
+use super::{manifest_path, new_manifest_writer};
+use crate::error::{Result, invalid_data};
+use crate::io::object_cache::ManifestKey;
+use crate::spec::{DataFile, FormatVersion, ManifestContentType, ManifestFile};
+use crate::table::Table;
+
+/// Removes a fixed set of files from the manifests of one content type.
+///
+/// One manager lives for one logical execution of an action and is driven
+/// once per attempt via [`ManifestFilterManager::filter`]. A manifest that
+/// references none of the files passes through untouched. One that does is
+/// rewritten with those entries marked `Deleted` and the rest `Existing`.
+///
+/// A rewrite is reused across attempts while its inputs are unchanged. Its
+/// entries carry the sequence numbers and row ids the source's entries
+/// inherited from the manifest list when they were read, so the reuse key is
+/// the source's [`ManifestKey`], not its path alone: a transaction-local
+/// source manifest keeps its path across attempts but inherits new values
+/// after a rebase.
+pub(crate) struct ManifestFilterManager {
+    content: ManifestContentType,
+    /// Paths of the files to remove. Fixed for the execution.
+    files_to_remove: HashSet<String>,

Review Comment:
   Iceberg v3 will support relative path, better doc that this must be a full 
path.



##########
crates/iceberg/src/transaction/snapshot/merging.rs:
##########
@@ -0,0 +1,923 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! Persistent producer for snapshot actions that add and remove data and
+//! delete files.
+
+use std::collections::{HashMap, HashSet};
+
+use uuid::Uuid;
+
+use super::manifest_filter::ManifestFilterManager;
+use super::{
+    AddedManifests, SnapshotCommitInput, current_manifests, 
generate_snapshot_id,
+    manifest_list_path, manifest_path, validate_partition_value, 
write_added_manifest,
+    write_snapshot_commit,
+};
+use crate::error::{Result, invalid_data};
+use crate::spec::{DataFile, FormatVersion, ManifestContentType, ManifestFile, 
Operation};
+use crate::table::Table;
+use crate::transaction::ActionCommit;
+
+/// What a merging action asks the producer to do.
+///
+/// Fixed for one logical execution; the producer derives everything else from
+/// it and the table of the current attempt. The action validates the
+/// table-independent parts (content types, disjoint add/remove sets) before
+/// each attempt.
+pub(crate) struct MergingIntent {

Review Comment:
   nit: I still perfer typed builder + getter/setter pattern, even for internal 
data structures. There are two benefits:
   1. When you add a new option field, you don't need to change a lot of 
places. Though coding agents helps coding, it's stilla burden for reviewer.
   2. This aligns with pub structs, and keep code style consistent.



##########
crates/iceberg/src/transaction/snapshot/merging.rs:
##########
@@ -0,0 +1,923 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! Persistent producer for snapshot actions that add and remove data and
+//! delete files.
+
+use std::collections::{HashMap, HashSet};
+
+use uuid::Uuid;
+
+use super::manifest_filter::ManifestFilterManager;
+use super::{
+    AddedManifests, SnapshotCommitInput, current_manifests, 
generate_snapshot_id,
+    manifest_list_path, manifest_path, validate_partition_value, 
write_added_manifest,
+    write_snapshot_commit,
+};
+use crate::error::{Result, invalid_data};
+use crate::spec::{DataFile, FormatVersion, ManifestContentType, ManifestFile, 
Operation};
+use crate::table::Table;
+use crate::transaction::ActionCommit;
+
+/// What a merging action asks the producer to do.
+///
+/// Fixed for one logical execution; the producer derives everything else from
+/// it and the table of the current attempt. The action validates the
+/// table-independent parts (content types, disjoint add/remove sets) before
+/// each attempt.
+pub(crate) struct MergingIntent {

Review Comment:
   Please apply this to all data structures, and you could create another pr 
for it.



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