viirya commented on code in PR #7538:
URL: https://github.com/apache/arrow-datafusion/pull/7538#discussion_r1324744669
##########
datafusion/execution/src/disk_manager.rs:
##########
@@ -131,18 +134,41 @@ impl DiskManager {
request_description,
);
- local_dirs.push(tempdir);
+ local_dirs.push(Arc::new(tempdir));
}
let dir_index = thread_rng().gen_range(0..local_dirs.len());
- Builder::new()
- .tempfile_in(&local_dirs[dir_index])
- .map_err(DataFusionError::IoError)
+ Ok(RefCountedTempFile {
+ parent_temp_dir: local_dirs[dir_index].clone(),
+ tempfile: Builder::new()
+ .tempfile_in(local_dirs[dir_index].as_ref())
+ .map_err(DataFusionError::IoError)?,
+ })
+ }
+}
+
+/// A wrapper around a [`NamedTempFile`] that also contains a reference
+#[derive(Debug)]
+pub struct RefCountedTempFile {
+ /// directory in which temporary files are created (Arc is held to ensure
+ /// it is not cleaned up prior to the NamedTempFile)
Review Comment:
```suggestion
/// The reference to the directory in which temporary files are created
to ensure
/// it is not cleaned up prior to the NamedTempFile
```
--
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]