From 6a62648cde97d40de96acd0054b8736b448e4ba0 Mon Sep 17 00:00:00 2001 From: Andy Grove Date: Tue, 24 Nov 2020 10:16:55 -0700 Subject: [PATCH 1/2] TPC-H tests --- rust/benchmarks/src/bin/tpch.rs | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/rust/benchmarks/src/bin/tpch.rs b/rust/benchmarks/src/bin/tpch.rs index 337eb9b1594..958c27a6c89 100644 --- a/rust/benchmarks/src/bin/tpch.rs +++ b/rust/benchmarks/src/bin/tpch.rs @@ -353,3 +353,36 @@ fn get_schema(table: &str) -> Schema { _ => unimplemented!(), } } + +#[cfg(test)] +mod tests { + use super::*; + use std::env; + + #[tokio::test] + async fn q1() -> Result<()> { + verify_query(1).await + } + + #[tokio::test] + async fn q12() -> Result<()> { + verify_query(12).await + } + + async fn verify_query(n: usize) -> Result<()> { + if let Ok(path) = env::var("TPCH_DATA") { + let opt = BenchmarkOpt { + query: n, + debug: false, + iterations: 1, + concurrency: 2, + batch_size: 4096, + path: PathBuf::from(path), + file_format: "tbl".to_string(), + mem_table: false, + }; + benchmark(opt).await? + } + Ok(()) + } +} From 0438e80710c2355641ed9646c8abf114fd53a096 Mon Sep 17 00:00:00 2001 From: Andy Grove Date: Sat, 5 Dec 2020 08:55:13 -0700 Subject: [PATCH 2/2] Update rust/benchmarks/src/bin/tpch.rs Co-authored-by: Andrew Lamb --- rust/benchmarks/src/bin/tpch.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rust/benchmarks/src/bin/tpch.rs b/rust/benchmarks/src/bin/tpch.rs index 958c27a6c89..57b276864a6 100644 --- a/rust/benchmarks/src/bin/tpch.rs +++ b/rust/benchmarks/src/bin/tpch.rs @@ -383,6 +383,9 @@ mod tests { }; benchmark(opt).await? } + } else { + println!("TPCH_DATA environment variable not set, skipping test") + } Ok(()) } }