Skip to content

Apache DataFusion SQL Query Engine

refactor: Set expected runtime config in error message when the used disk space during the spilling process has exceeded the allocation limit (#20375)

Eren Avsarogullari476c200f00cd
diff --git a/datafusion/core/tests/memory_limit/mod.rs b/datafusion/core/tests/memory_limit/mod.rs
index c28d23ba06..ff8c512cbd 100644
--- a/datafusion/core/tests/memory_limit/mod.rs
+++ b/datafusion/core/tests/memory_limit/mod.rs
@@ -602,11 +602,16 @@ async fn test_disk_spill_limit_reached() -> Result<()> {
.await
.unwrap();
- let err = df.collect().await.unwrap_err();
- assert_contains!(
- err.to_string(),
- "The used disk space during the spilling process has exceeded the allowable limit"
- );
+ let error_message = df.collect().await.unwrap_err().to_string();
+ for expected in [
+ "The used disk space during the spilling process has exceeded the allowable limit",
+ "datafusion.runtime.max_temp_directory_size",
+ ] {
+ assert!(
+ error_message.contains(expected),
+ "'{expected}' is not contained by '{error_message}'"
+ );
+ }
Ok(())
}
diff --git a/datafusion/execution/src/disk_manager.rs b/datafusion/execution/src/disk_manager.rs
index d878fdcf66..1a14bd239a 100644
--- a/datafusion/execution/src/disk_manager.rs
+++ b/datafusion/execution/src/disk_manager.rs
@@ -420,7 +420,8 @@ impl RefCountedTempFile {
let global_disk_usage = self.disk_manager.used_disk_space.load(Ordering::Relaxed);
if global_disk_usage > self.disk_manager.max_temp_directory_size {
return resources_err!(
- "The used disk space during the spilling process has exceeded the allowable limit of {}. Try increasing the `max_temp_directory_size` in the disk manager configuration.",
+ "The used disk space during the spilling process has exceeded the allowable limit of {}. \
+ Please try increasing the config: `datafusion.runtime.max_temp_directory_size`.",
human_readable_size(self.disk_manager.max_temp_directory_size as usize)
);
}