Skip to content

Commit b85a0ee

Browse files
ctskWeijun-H
authored and
Nirnay Roy
committed
Set HashJoin seed (apache#15783)
* Set HashJoin seed * fmt * whitespace grr * Document hash seed Co-authored-by: Alex Huang <[email protected]> --------- Co-authored-by: Alex Huang <[email protected]>
1 parent 4eefebe commit b85a0ee

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ use datafusion_physical_expr_common::physical_expr::fmt_sql;
8686
use futures::{ready, Stream, StreamExt, TryStreamExt};
8787
use parking_lot::Mutex;
8888

89+
/// Hard-coded seed to ensure hash values from the hash join differ from `RepartitionExec`, avoiding collisions.
90+
const HASH_JOIN_SEED: RandomState =
91+
RandomState::with_seeds('J' as u64, 'O' as u64, 'I' as u64, 'N' as u64);
92+
8993
/// HashTable and input data for the left (build side) of a join
9094
struct JoinLeftData {
9195
/// The hash table with indices into `batch`
@@ -385,7 +389,7 @@ impl HashJoinExec {
385389
let (join_schema, column_indices) =
386390
build_join_schema(&left_schema, &right_schema, join_type);
387391

388-
let random_state = RandomState::with_seeds(0, 0, 0, 0);
392+
let random_state = HASH_JOIN_SEED;
389393

390394
let join_schema = Arc::new(join_schema);
391395

0 commit comments

Comments
 (0)