CTTY commented on code in PR #2367:
URL: https://github.com/apache/iceberg-rust/pull/2367#discussion_r3307540985
##########
crates/iceberg/src/transaction/snapshot.rs:
##########
@@ -107,41 +107,39 @@ pub(crate) trait ManifestProcess: Send + Sync {
) -> Vec<ManifestFile>;
}
+#[derive(TypedBuilder)]
+#[builder(field_defaults(setter(prefix = "with_")))]
pub(crate) struct SnapshotProducer<'a> {
pub(crate) table: &'a Table,
+ #[builder(
+ setter(skip),
+ default_code = "SnapshotProducer::generate_unique_snapshot_id(table)"
+ )]
snapshot_id: i64,
commit_uuid: Uuid,
+ #[builder(default)]
key_metadata: Option<Vec<u8>>,
+ #[builder(default)]
snapshot_properties: HashMap<String, String>,
+ #[builder(default)]
added_data_files: Vec<DataFile>,
+ #[builder(default)]
+ added_delete_files: Vec<DataFile>,
+ #[builder(default)]
+ removed_data_files: Vec<DataFile>,
+ #[builder(default)]
+ removed_delete_files: Vec<DataFile>,
// A counter used to generate unique manifest file names.
// It starts from 0 and increments for each new manifest file.
// Note: This counter is limited to the range of (0..u64::MAX).
+ #[builder(setter(skip), default_code = "(0..)")]
manifest_counter: RangeFrom<u64>,
}
impl<'a> SnapshotProducer<'a> {
- pub(crate) fn new(
- table: &'a Table,
- commit_uuid: Uuid,
- key_metadata: Option<Vec<u8>>,
- snapshot_properties: HashMap<String, String>,
- added_data_files: Vec<DataFile>,
- ) -> Self {
- Self {
- table,
- snapshot_id: Self::generate_unique_snapshot_id(table),
- commit_uuid,
- key_metadata,
- snapshot_properties,
- added_data_files,
- manifest_counter: (0..),
- }
- }
-
pub(crate) fn validate_added_data_files(&self) -> Result<()> {
Review Comment:
This can be tackled in a separate PR.
Created a tracking issue: https://github.com/apache/iceberg-rust/issues/2517
I think we should also think about adding a flag to allow users skip the
validation
--
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]