dannycjones commented on code in PR #2589:
URL: https://github.com/apache/iceberg-rust/pull/2589#discussion_r3380817381
##########
crates/iceberg/src/spec/snapshot_summary.rs:
##########
@@ -142,8 +141,52 @@ impl SnapshotSummaryCollector {
}
/// Builds final map of summaries
- pub fn build(&self) -> HashMap<String, String> {
+ pub fn build(&self, prev_summary: Option<&Summary>) -> HashMap<String,
String> {
let mut properties = self.metrics.to_map();
+
+ update_total(
+ prev_summary,
+ &mut properties,
+ self.metrics.added_data_files as u64,
+ self.metrics.removed_data_files as u64,
+ TOTAL_DATA_FILES,
+ );
+ update_total(
+ prev_summary,
+ &mut properties,
+ self.metrics.added_delete_files as u64,
+ self.metrics.removed_delete_files as u64,
+ TOTAL_DELETE_FILES,
+ );
+ update_total(
+ prev_summary,
+ &mut properties,
+ self.metrics.added_records,
+ self.metrics.deleted_records,
+ TOTAL_RECORDS,
+ );
+ update_total(
+ prev_summary,
+ &mut properties,
+ self.metrics.added_file_size,
+ self.metrics.removed_file_size,
+ TOTAL_FILE_SIZE,
+ );
+ update_total(
+ prev_summary,
+ &mut properties,
+ self.metrics.added_pos_deletes,
+ self.metrics.removed_pos_deletes,
+ TOTAL_POSITION_DELETES,
+ );
+ update_total(
+ prev_summary,
+ &mut properties,
+ self.metrics.added_eq_deletes,
+ self.metrics.removed_eq_deletes,
+ TOTAL_EQUALITY_DELETES,
+ );
Review Comment:
Yeah, I had considered the same. Since there's some discussion of
refactoring of the snapshot producer already, I didn't want to be too invasive.
I do think we should eventually encapsulate each of these counts as enums,
such that we are forced to handle each one when more are added.
--
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]