Skip to content

Commit 30f2a3e

Browse files
committed
Add regression test for empty build side in hash join
Implement test_hash_join_skips_probe_on_empty_build_after_partition_bounds_report in exec.rs. Ensure that dynamic filtering is enabled by keeping a consumer reference alive. Verify that an Inner join with an empty build side correctly skips probe consumption, even when passing through the WaitPartitionBoundsReport path.
1 parent 072cbea commit 30f2a3e

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

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

datafusion/physical-plan/src/joins/hash_join/exec.rs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5594,6 +5594,43 @@ mod tests {
55945594
Ok(())
55955595
}
55965596

5597+
#[tokio::test]
5598+
async fn test_hash_join_skips_probe_on_empty_build_after_partition_bounds_report(
5599+
) -> Result<()> {
5600+
let task_ctx = Arc::new(TaskContext::default());
5601+
let (left, right, on) = empty_build_with_probe_error_inputs();
5602+
5603+
// Keep an extra consumer reference so execute() enables dynamic filter pushdown
5604+
// and enters the WaitPartitionBoundsReport path before deciding whether to poll
5605+
// the probe side.
5606+
let dynamic_filter = HashJoinExec::create_dynamic_filter(&on);
5607+
let dynamic_filter_clone = Arc::clone(&dynamic_filter);
5608+
5609+
let mut join = HashJoinExec::try_new(
5610+
left,
5611+
right,
5612+
on,
5613+
None,
5614+
&JoinType::Inner,
5615+
None,
5616+
PartitionMode::CollectLeft,
5617+
NullEquality::NullEqualsNothing,
5618+
false,
5619+
)?;
5620+
join.dynamic_filter = Some(HashJoinExecDynamicFilter {
5621+
filter: dynamic_filter,
5622+
build_accumulator: OnceLock::new(),
5623+
});
5624+
5625+
let stream = join.execute(0, task_ctx)?;
5626+
let batches = common::collect(stream).await?;
5627+
assert!(batches.is_empty());
5628+
5629+
dynamic_filter_clone.wait_complete().await;
5630+
5631+
Ok(())
5632+
}
5633+
55975634
#[tokio::test]
55985635
async fn test_perfect_hash_join_with_negative_numbers() -> Result<()> {
55995636
let task_ctx = prepare_task_ctx(8192, true);

0 commit comments

Comments
 (0)