Skip to content

Commit

Permalink
Minor: Add routine to debug join fuzz tests
Browse files Browse the repository at this point in the history
  • Loading branch information
comphead committed Jun 21, 2024
1 parent fa911c1 commit 16407f0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion datafusion/core/tests/fuzz_cases/join_fuzz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ impl JoinFuzzTestCase {
let nlj_rows = nlj_collected.iter().fold(0, |acc, b| acc + b.num_rows());

if debug {
println!("The debug is ON. Input data will be saved");
let out_dir_name = &format!("fuzz_test_debug_batch_size_{batch_size}");
Self::save_as_parquet(&self.input1, out_dir_name, "input1");
Self::save_as_parquet(&self.input2, out_dir_name, "input2");
Expand Down Expand Up @@ -557,7 +558,7 @@ impl JoinFuzzTestCase {
fn save_as_parquet(input: &[RecordBatch], output_dir: &str, out_name: &str) {
let out_path = &format!("{output_dir}/{out_name}");
std::fs::remove_dir_all(out_path).unwrap_or(());
std::fs::create_dir(out_path).unwrap();
std::fs::create_dir_all(out_path).unwrap();

input.iter().enumerate().for_each(|(idx, batch)| {
let mut file =
Expand All @@ -572,6 +573,8 @@ impl JoinFuzzTestCase {
writer.write(batch).unwrap();
writer.close().unwrap();
});

println!("The data {out_name} saved as parquet into {out_path}");
}
}

Expand Down

0 comments on commit 16407f0

Please sign in to comment.