Copilot commented on code in PR #15520:
URL: https://github.com/apache/datafusion/pull/15520#discussion_r2022259546
##########
datafusion/execution/src/disk_manager.rs:
##########
@@ -164,6 +216,50 @@ impl RefCountedTempFile {
pub fn inner(&self) -> &NamedTempFile {
&self.tempfile
}
+
+ /// Updates the global disk usage counter after modifications to the
underlying file.
+ ///
+ /// # Errors
+ /// - Returns an error if the global disk usage exceeds the configured
limit.
+ pub fn update_disk_usage(&mut self) -> Result<()> {
+ // Get new file size from OS
+ let metadata = self.tempfile.as_file().metadata().unwrap();
Review Comment:
Using unwrap on file metadata could cause a panic if metadata retrieval
fails; consider propagating the error instead of unwrapping.
```suggestion
let metadata = self.tempfile.as_file().metadata()?;
```
--
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]