MCPcopy Create free account
hub / github.com/apache/datafusion / lazy_temp_dir_creation

Function lazy_temp_dir_creation

datafusion/execution/src/disk_manager.rs:481–498  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

479
480 #[test]
481 fn lazy_temp_dir_creation() -> Result<()> {
482 // A default configuration should not create temp files until requested
483 let dm = Arc::new(DiskManagerBuilder::default().build()?);
484
485 assert_eq!(0, local_dir_snapshot(&dm).len());
486
487 // can still create a tempfile however:
488 let actual = dm.create_tmp_file("Testing")?;
489
490 // Now the tempdir has been created on demand
491 assert_eq!(1, local_dir_snapshot(&dm).len());
492
493 // the returned tempfile file should be in the temp directory
494 let local_dirs = local_dir_snapshot(&dm);
495 assert_path_in_dirs(actual.path(), local_dirs.iter().map(|p| p.as_path()));
496
497 Ok(())
498 }
499
500 fn local_dir_snapshot(dm: &DiskManager) -> Vec<PathBuf> {
501 dm.local_dirs

Callers

nothing calls this directly

Calls 8

newFunction · 0.85
local_dir_snapshotFunction · 0.85
assert_path_in_dirsFunction · 0.85
create_tmp_fileMethod · 0.80
buildMethod · 0.45
pathMethod · 0.45
mapMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…