Skip to content

Commit 77d4418

Browse files
committed
Trigger loading before joining
1 parent 5af5bdb commit 77d4418

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

  • datafusion/physical-plan/src/joins/grace_hash_join

datafusion/physical-plan/src/joins/grace_hash_join/stream.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,6 +1025,24 @@ impl GraceHashJoinStream {
10251025
continue;
10261026
}
10271027

1028+
// If we decided not to repartition but skipped loading earlier,
1029+
// load now and poll again to avoid joining empty batches.
1030+
if left_fut.is_none() {
1031+
*left_fut = Some(load_partition_async(
1032+
Arc::clone(&self.spill_left),
1033+
work.left.clone(),
1034+
Arc::clone(&self.reservation),
1035+
Arc::clone(left_bytes),
1036+
));
1037+
*right_fut = Some(load_partition_async(
1038+
Arc::clone(&self.spill_right),
1039+
work.right.clone(),
1040+
Arc::clone(&self.reservation),
1041+
Arc::clone(right_bytes),
1042+
));
1043+
continue;
1044+
}
1045+
10281046
let stream = build_in_memory_join_stream(
10291047
Arc::clone(&self.schema),
10301048
Arc::clone(&self.left_input_schema),

0 commit comments

Comments
 (0)