Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
review: config fuzz testing
  • Loading branch information
2010YOUY01 committed Oct 25, 2026
commit 4b20989d13ef494a573a16efe4751472327853c4
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 {
/// if `debug` flag is set the test will save randomly generated inputs and outputs to user folders,
/// so it is easy to debug a test on top of the failed data
async fn run_test(&self, join_tests: &[JoinTestType], debug: bool) {
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 @@ -1073,7 +1080,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 @@ -1136,7 +1145,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 @@ -1145,7 +1154,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 @@ -1165,12 +1174,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
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# specific language governing permissions and limitations
# under the License.

# configMatrix: datafusion.execution.enable_migration_hash_join=true,false

##########
## Join Tests
##########
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# specific language governing permissions and limitations
# under the License.

# configMatrix: datafusion.execution.enable_migration_hash_join=true,false

# Test IS NOT DISTINCT FROM join functionality
# This tests the optimizer's ability to convert IS NOT DISTINCT FROM joins
# to equijoins with proper null equality handling
Expand Down
2 changes: 2 additions & 0 deletions datafusion/sqllogictest/test_files/join_limit_pushdown.slt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# specific language governing permissions and limitations
# under the License.

# configMatrix: datafusion.execution.enable_migration_hash_join=true,false

# Tests for limit pushdown into joins

# need to use a single partition for deterministic results
Expand Down
2 changes: 2 additions & 0 deletions datafusion/sqllogictest/test_files/join_only.slt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# specific language governing permissions and limitations
# under the License.

# configMatrix: datafusion.execution.enable_migration_hash_join=true,false

include ./join.slt.part

# Config reset
Expand Down
2 changes: 2 additions & 0 deletions datafusion/sqllogictest/test_files/joins.slt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# specific language governing permissions and limitations
# under the License.

# configMatrix: datafusion.execution.enable_migration_hash_join=true,false

####
# Configuration
####
Expand Down
2 changes: 2 additions & 0 deletions datafusion/sqllogictest/test_files/sort_merge_join_matrix.slt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# Sort-merge-join correctness across a config matrix. Every equijoin runs on
# SortMergeJoin (prefer_hash_join=false) and HashJoin (true), so sweeping
# {true,false} x batch_size {1,2,100,8192} requires them to agree row-for-row.
# Run both hash join implementations with enable_migration_hash_join=true,false.
# batch_size=1 forces equal-key runs to span single-row batches (historically
# bug-prone). SMJ needs target_partitions>1 and repartition_joins, set below (not
# swept). Null-aware NOT IN always uses HashJoin, so it is out of scope (see
Expand All @@ -26,6 +27,7 @@

# configMatrix: datafusion.optimizer.prefer_hash_join=true,false
# configMatrix: datafusion.execution.batch_size=1,2,100,8192
# configMatrix: datafusion.execution.enable_migration_hash_join=true,false

statement ok
set datafusion.execution.target_partitions = 4;
Expand Down