Skip to content

Commit 390e1f4

Browse files
committed
Verify direct-map fallback under forced hash collisions
Remove the unused physical-plan num-traits dependency. Probe real fallback rows instead of asserting the number of hash buckets. Full df55-r4 gate passes: fmt, all-feature Clippy, 10572 extended Rust tests and 508 SLT files, 10381 forced-collision tests, three unchanged SMJ RSS guards, cargo machete and unmodified rust_lint.sh.
1 parent 9ceab37 commit 390e1f4

3 files changed

Lines changed: 25 additions & 4 deletions

File tree

‎Cargo.lock‎

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎datafusion/physical-plan/Cargo.toml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ hashbrown = { workspace = true }
8383
indexmap = { workspace = true }
8484
itertools = { workspace = true, features = ["use_std"] }
8585
log = { workspace = true }
86-
num-traits = { workspace = true }
8786
parking_lot = { workspace = true }
8887
pin-project-lite = { workspace = true }
8988
serde_json = { workspace = true, features = ["preserve_order"] }

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

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3048,8 +3048,31 @@ mod tests {
30483048
let (data, pool, expected, used_map) =
30493049
build_with_tight_map_budget(vec![0, 10_000], false)?;
30503050
assert!(!used_map);
3051-
assert!(matches!(data.map.as_ref(), Map::HashMap(_)));
3052-
assert_eq!(data.map.num_of_distinct_key(), 2);
3051+
let Map::HashMap(map) = data.map.as_ref() else {
3052+
panic!("expected the general hash map after direct-map budget rejection");
3053+
};
3054+
// Bucket count is not a row count, especially with force_hash_collisions.
3055+
// Probe both keys, a miss, and a duplicate to verify the fallback retains
3056+
// the rows and still applies key equality when their hashes collide.
3057+
let probe_values: ArrayRef =
3058+
Arc::new(Int32Array::from(vec![10_000, 7, 0, 10_000]));
3059+
let mut hashes = vec![0; probe_values.len()];
3060+
create_hashes([&probe_values], HASH_JOIN_SEED.random_state(), &mut hashes)?;
3061+
let (build_ids, probe_ids, next_offset) = lookup_join_hashmap(
3062+
map.as_ref(),
3063+
&data.values,
3064+
&[probe_values],
3065+
NullEquality::NullEqualsNothing,
3066+
&hashes,
3067+
None,
3068+
8192,
3069+
(0, None),
3070+
&mut Vec::new(),
3071+
&mut Vec::new(),
3072+
)?;
3073+
assert_eq!(build_ids, UInt64Array::from(vec![1, 0, 1]));
3074+
assert_eq!(probe_ids, UInt32Array::from(vec![0, 2, 3]));
3075+
assert!(next_offset.is_none());
30533076
assert_eq!(pool.reserved(), expected);
30543077
drop(data);
30553078
assert_eq!(pool.reserved(), 0);

0 commit comments

Comments
 (0)