Skip to content

Commit d83614d

Browse files
committed
test(cubestore): Fix decimal_partition_pruning test in release mode
Makes the test wait for or induce compaction first. In release mode the test had been failing. Cherry-picked from the DF upgrade branch.
1 parent bf09dae commit d83614d

File tree

1 file changed

+25
-14
lines changed
  • rust/cubestore/cubestore/src/sql

1 file changed

+25
-14
lines changed

rust/cubestore/cubestore/src/sql/mod.rs

+25-14
Original file line numberDiff line numberDiff line change
@@ -2812,21 +2812,32 @@ mod tests {
28122812

28132813
println!("All partitions: {:#?}", partitions);
28142814

2815-
let plans = service
2816-
.plan_query("SELECT sum(num) from foo.numbers where num = 50")
2817-
.await
2818-
.unwrap();
2815+
// Semi-busy-wait for, or, seemingly, induce, compaction for 2000 ms.
2816+
let num_attempts = 100;
2817+
for i in 0..num_attempts {
2818+
tokio::time::sleep(Duration::from_millis(20)).await;
28192819

2820-
let worker_plan = pp_phys_plan(plans.worker.as_ref());
2821-
println!("Worker Plan: {}", worker_plan);
2822-
let parquet_regex = Regex::new(r"\d+-[a-z0-9]+.parquet").unwrap();
2823-
let matches = parquet_regex.captures_iter(&worker_plan).count();
2824-
assert!(
2825-
// TODO 2 because partition pruning doesn't respect half open intervals yet
2826-
matches < 3 && matches > 0,
2827-
"{}\nshould have 2 and less partition scan nodes",
2828-
worker_plan
2829-
);
2820+
let plans = service
2821+
.plan_query("SELECT sum(num) from foo.numbers where num = 50")
2822+
.await
2823+
.unwrap();
2824+
2825+
let worker_plan = pp_phys_plan(plans.worker.as_ref());
2826+
let parquet_regex = Regex::new(r"\d+-[a-z0-9]+\.parquet").unwrap();
2827+
let matches = parquet_regex.captures_iter(&worker_plan).count();
2828+
let chunk_parquet_regex = Regex::new(r"\d+-[a-z0-9]+\.chunk\.parquet").unwrap();
2829+
let chunk_matches = chunk_parquet_regex.captures_iter(&worker_plan).count();
2830+
if matches < 3 && matches > 0 && chunk_matches == 0 {
2831+
break;
2832+
} else if i == num_attempts - 1 {
2833+
panic!(
2834+
"{}\nshould have 2 and less partition scan nodes, matches = {}, chunk_matches = {}",
2835+
worker_plan,
2836+
matches,
2837+
chunk_matches,
2838+
);
2839+
}
2840+
}
28302841
})
28312842
.await;
28322843
}

0 commit comments

Comments
 (0)