Skip to content

Apache DataFusion SQL Query Engine

Return error if spill file does not exist in ExternalSorter (#7479)

Liang-Chi Hsieha2caad0cb40e
diff --git a/datafusion/core/src/physical_plan/sorts/sort.rs b/datafusion/core/src/physical_plan/sorts/sort.rs
index 5d23e72fe7..07bb4cd357 100644
--- a/datafusion/core/src/physical_plan/sorts/sort.rs
+++ b/datafusion/core/src/physical_plan/sorts/sort.rs
@@ -328,6 +328,12 @@ impl ExternalSorter {
}
for spill in self.spills.drain(..) {
+ if !spill.path().exists() {
+ return Err(DataFusionError::Internal(format!(
+ "Spill file {:?} does not exist",
+ spill.path()
+ )));
+ }
let stream = read_spill_as_stream(spill, self.schema.clone())?;
streams.push(stream);
}