This is an automated email from the ASF dual-hosted git repository.
alamb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git
The following commit(s) were added to refs/heads/master by this push:
new fbbb1b469 Create disk manager spill folder if doesn't exist (#5185)
fbbb1b469 is described below
commit fbbb1b4692fda532cd59ac2e4c3152219f864215
Author: comphead <[email protected]>
AuthorDate: Mon Feb 6 04:23:57 2023 -0800
Create disk manager spill folder if doesn't exist (#5185)
---
datafusion/core/src/execution/disk_manager.rs | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/datafusion/core/src/execution/disk_manager.rs
b/datafusion/core/src/execution/disk_manager.rs
index 2749d8cbc..9ff6f1e55 100644
--- a/datafusion/core/src/execution/disk_manager.rs
+++ b/datafusion/core/src/execution/disk_manager.rs
@@ -139,6 +139,9 @@ fn create_local_dirs(local_dirs: Vec<PathBuf>) ->
Result<Vec<TempDir>> {
local_dirs
.iter()
.map(|root| {
+ if !std::path::Path::new(root).exists() {
+ std::fs::create_dir(root)?;
+ }
Builder::new()
.prefix("datafusion-")
.tempdir_in(root)
@@ -214,6 +217,16 @@ mod tests {
)
}
+ #[test]
+ fn test_disk_manager_create_spill_folder() {
+ let config =
DiskManagerConfig::new_specified(vec!["DOESNT_EXIST".into()]);
+
+ DiskManager::try_new(config)
+ .unwrap()
+ .create_tmp_file("Testing")
+ .unwrap();
+ }
+
/// Asserts that `file_path` is found anywhere in any of `dir` directories
fn assert_path_in_dirs<'a>(
file_path: &'a Path,