Skip to content

Commit a616831

Browse files
authored
test: reuse null-aware join fuzz reference results (apache#26838)
> [!IMPORTANT] > > **Fork CI setup:** For pull requests from a fork to `main`, enable workflows in your fork's **Actions** tab before you push. > See the [fork CI setup guide](https://datafusion.apache.org/contributor-guide/#pull-requests-from-forks). ## Which issue does this PR close? Part of apache#26759 and apache#13813. ## Rationale for this change The null-aware join fuzzer reruns each reference query for every batch-size and partition configuration. Each seed uses immutable tables, so those expected rows can be computed once and reused. ## What changes are included in this PR? Build the query cases once and cache their reference rows per seed in a single-partition reference context. Every actual query/configuration combination still runs, with the existing diagnostics and anti-join plan-shape assertions. ## What is the testing strategy for this PR? Original paired `ci`-profile runs with the same worker limit took 211s before the change and 118s after it. These are single runs on a shared Linux host. Reference-query executions fall by about 83% while actual-query coverage is unchanged. The existing differential test exercises the cached results and every actual query configuration: ```shell cargo test --profile ci -p datafusion --test extended_tests --features extended_tests null_aware_join_matches_reference ``` The full `./dev/rust_lint.sh` checks (including formatting and both Clippy configurations) and the extended workspace suite passed after rebasing onto current `main`. The RSS sampler fix from apache#26445 is now included in `main`. ## Are there any user-facing changes? None. This changes the test harness only. AI-assisted contribution.
1 parent 3284dc6 commit a616831

1 file changed

Lines changed: 23 additions & 4 deletions

File tree

‎datafusion/core/tests/fuzz_cases/null_aware_join_fuzz.rs‎

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ use rand::{Rng, SeedableRng};
3131
#[tokio::test(flavor = "multi_thread")]
3232
async fn null_aware_join_matches_reference() {
3333
let mut plans = NullAwarePlans::default();
34+
let cases = cases();
3435
for seed in 0..20 {
3536
let mut rng = StdRng::seed_from_u64(seed);
3637
let outer = random_table(&mut rng, &["id", "k", "a", "b", "c"], &["n", "m"], 6);
@@ -39,6 +40,25 @@ async fn null_aware_join_matches_reference() {
3940
let inner_rows = if seed % 2 == 0 { 6 } else { 2 };
4041
let inner =
4142
random_table(&mut rng, &["k", "x", "y", "z"], &["v", "w"], inner_rows);
43+
44+
// Reference results depend only on this seed's tables, so compute
45+
// them once with a stable configuration instead of repeating them
46+
// for every batch size and partition count below.
47+
let reference_ctx = SessionContext::new_with_config(
48+
SessionConfig::new().with_target_partitions(1),
49+
);
50+
reference_ctx
51+
.register_table("o", Arc::clone(&outer) as _)
52+
.unwrap();
53+
reference_ctx
54+
.register_table("i", Arc::clone(&inner) as _)
55+
.unwrap();
56+
let mut expected_rows = Vec::with_capacity(cases.len());
57+
for (_, reference) in &cases {
58+
let (expected, _) = run(&reference_ctx, reference).await;
59+
expected_rows.push(expected);
60+
}
61+
4262
for target_partitions in [1, 4] {
4363
for batch_size in [1, 3, 8192] {
4464
let config = SessionConfig::new()
@@ -57,12 +77,11 @@ async fn null_aware_join_matches_reference() {
5777
let ctx = SessionContext::new_with_config(config);
5878
ctx.register_table("o", Arc::clone(&outer) as _).unwrap();
5979
ctx.register_table("i", Arc::clone(&inner) as _).unwrap();
60-
for (query, reference) in cases() {
61-
let (actual, plan) = run(&ctx, &query).await;
80+
for ((query, reference), expected) in cases.iter().zip(&expected_rows) {
81+
let (actual, plan) = run(&ctx, query).await;
6282
plans.record(plan.as_ref());
63-
let (expected, _) = run(&ctx, &reference).await;
6483
assert_eq!(
65-
actual, expected,
84+
actual, *expected,
6685
"seed={seed} target_partitions={target_partitions} \
6786
batch_size={batch_size}\nquery: {query}\nreference: {reference}"
6887
);

0 commit comments

Comments
 (0)