Skip to content
Merged
11 changes: 11 additions & 0 deletions datafusion/common/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -977,6 +977,17 @@ config_namespace! {
/// See <https://github.com/apache/datafusion/issues/22710> for details.
pub enable_migration_aggregate: bool, default = true

/// Whether inner, left outer, right outer, and full outer hash joins use
/// the refactored probe implementation. When set to `false`, these joins
/// use the previous probe implementation.
///
/// The fallback exists only as a workaround for bugs in the new
/// implementation and will be removed, together with this option, once
/// the migration is complete.
///
/// See <https://github.com/apache/datafusion/issues/26361> for details.
pub enable_migration_hash_join: bool, default = true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This adds a user-facing config option, datafusion.execution.enable_migration_hash_join, which shows up in information_schema.df_settings, SHOW ALL, and configs.md. The PR description answers "Are there any user-facing changes?" with "No". Could you list the option there, with its default and the plan to remove it? The description becomes the squash commit message, so that's where users will look for it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏼 Updated the PR description.


/// Sets the compression codec used when spilling data to disk.
///
/// Since datafusion writes spill files using the Arrow IPC Stream format,
Expand Down
23 changes: 16 additions & 7 deletions datafusion/core/tests/fuzz_cases/join_fuzz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1028,8 +1028,15 @@ impl JoinFuzzTestCase {
let mut nlj_formatted_sorted: Vec<&str> = nlj_formatted.trim().lines().collect();
nlj_formatted_sorted.sort_unstable();

for batch_size in self.batch_sizes {
let session_config = SessionConfig::new().with_batch_size(*batch_size);
// Exercise both hash join implementations with the same inputs and batch sizes.
for (batch_size, enable_migration_hash_join) in
self.batch_sizes.iter().cartesian_product([true, false])
{
let mut session_config = SessionConfig::new().with_batch_size(*batch_size);
session_config
.options_mut()
.execution
.enable_migration_hash_join = enable_migration_hash_join;
let ctx = SessionContext::new_with_config(session_config);
let task_ctx = ctx.task_ctx();

Expand Down Expand Up @@ -1063,7 +1070,9 @@ impl JoinFuzzTestCase {
let fuzz_debug = "fuzz_test_debug";
std::fs::remove_dir_all(fuzz_debug).unwrap_or(());
std::fs::create_dir_all(fuzz_debug).unwrap();
let out_dir_name = &format!("{fuzz_debug}/batch_size_{batch_size}");
let out_dir_name = &format!(
"{fuzz_debug}/batch_size_{batch_size}_enable_migration_hash_join_{enable_migration_hash_join}"
);
println!(
"Test result data mismatch found. HJ rows {hj_rows}, SMJ rows {smj_rows}, NLJ rows {nlj_rows}"
);
Expand Down Expand Up @@ -1126,7 +1135,7 @@ impl JoinFuzzTestCase {

if join_tests.contains(&NljHj) {
let err_msg_rowcnt = format!(
"NestedLoopJoinExec and HashJoinExec produced different row counts, batch_size: {batch_size}"
"NestedLoopJoinExec and HashJoinExec produced different row counts, batch_size: {batch_size}, enable_migration_hash_join: {enable_migration_hash_join}"
);
assert_eq!(nlj_rows, hj_rows, "{}", err_msg_rowcnt.as_str());
if nlj_rows == 0 && hj_rows == 0 {
Expand All @@ -1135,7 +1144,7 @@ impl JoinFuzzTestCase {
}

let err_msg_contents = format!(
"NestedLoopJoinExec and HashJoinExec produced different results, batch_size: {batch_size}"
"NestedLoopJoinExec and HashJoinExec produced different results, batch_size: {batch_size}, enable_migration_hash_join: {enable_migration_hash_join}"
);
// row level compare if any of joins returns the result
// the reason is different formatting when there is no rows
Expand All @@ -1155,12 +1164,12 @@ impl JoinFuzzTestCase {

if join_tests.contains(&HjSmj) {
let err_msg_row_cnt = format!(
"HashJoinExec and SortMergeJoinExec produced different row counts, batch_size: {batch_size}"
"HashJoinExec and SortMergeJoinExec produced different row counts, batch_size: {batch_size}, enable_migration_hash_join: {enable_migration_hash_join}"
);
assert_eq!(hj_rows, smj_rows, "{}", err_msg_row_cnt.as_str());

let err_msg_contents = format!(
"SortMergeJoinExec and HashJoinExec produced different results, batch_size: {batch_size}"
"SortMergeJoinExec and HashJoinExec produced different results, batch_size: {batch_size}, enable_migration_hash_join: {enable_migration_hash_join}"
);
// row level compare if any of joins returns the result
// the reason is different formatting when there is no rows
Expand Down
Loading
Loading