Skip to content

Apache DataFusion SQL Query Engine

main branch test fix: adjust dynamic filter assertion for hash collisions handling (#24729)

Jay Zhanee59f628b44e
diff --git a/datafusion/physical-plan/src/joins/hash_join/exec.rs b/datafusion/physical-plan/src/joins/hash_join/exec.rs
index 440606fb82..1b36dabebc 100644
--- a/datafusion/physical-plan/src/joins/hash_join/exec.rs
+++ b/datafusion/physical-plan/src/joins/hash_join/exec.rs
@@ -7736,10 +7736,17 @@ mod tests {
let filter = dynamic_filter.current()?.to_string();
// The aggregated build-side NULL must widen the routed filter once, at the
// top: `c2 IS NULL OR CASE hash(c2) % 4 WHEN ... END`.
- assert!(
- filter.contains("CASE"),
- "expected a routed partitioned filter, got: {filter}"
- );
+ //
+ // Under `force_hash_collisions` every key hashes to the same value, so the
+ // repartition routes all build rows to a single partition and
+ // `build_partitioned_filter` collapses to that partition's filter with no
+ // routing `CASE`. The NULL widening this test guards is asserted either way.
+ if cfg!(not(feature = "force_hash_collisions")) {
+ assert!(
+ filter.contains("CASE"),
+ "expected a routed partitioned filter, got: {filter}"
+ );
+ }
assert!(
filter.starts_with("c2@0 IS NULL OR"),
"expected the IS NULL disjunct to wrap the whole routed filter, got: {filter}"