JingsongLi commented on code in PR #739:
URL: https://github.com/apache/paimon-rust/pull/739#discussion_r3838252406


##########
crates/paimon/src/table/source.rs:
##########
@@ -1295,6 +1295,19 @@ impl Plan {
         &self.splits
     }
 
+    /// Sum of data-file bytes referenced by this plan.
+    ///
+    /// Negative file sizes are treated as unknown and do not contribute. The
+    /// result is therefore a lower bound when a connector cannot provide every
+    /// file size.
+    pub fn planned_data_file_bytes(&self) -> u64 {
+        self.splits
+            .iter()
+            .flat_map(DataSplit::data_files)
+            .filter_map(|file| u64::try_from(file.file_size).ok())
+            .sum()

Review Comment:
   Fixed in 1f868f61. The accumulation now uses saturating_add, preserving 
negative-size filtering while saturating oversized plans at u64::MAX. Added a 
regression test whose known sizes total exactly 2^64; it passes in both debug 
and release, while the old implementation would panic in debug and wrap to zero 
in release.



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

Reply via email to