Skip to content

Commit f8495a7

Browse files
authored
Split physical_plan_tpch into separate benchmarks (#9043)
* Split physical_plan_tpch into separate benchmarks * comment on q15 * all tpch in one
1 parent f2ac2c6 commit f8495a7

File tree

1 file changed

+27
-45
lines changed

1 file changed

+27
-45
lines changed

datafusion/core/benches/sql_planner.rs

Lines changed: 27 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -224,52 +224,34 @@ fn criterion_benchmark(c: &mut Criterion) {
224224
})
225225
});
226226

227-
let q1_sql = std::fs::read_to_string("../../benchmarks/queries/q1.sql").unwrap();
228-
let q2_sql = std::fs::read_to_string("../../benchmarks/queries/q2.sql").unwrap();
229-
let q3_sql = std::fs::read_to_string("../../benchmarks/queries/q3.sql").unwrap();
230-
let q4_sql = std::fs::read_to_string("../../benchmarks/queries/q4.sql").unwrap();
231-
let q5_sql = std::fs::read_to_string("../../benchmarks/queries/q5.sql").unwrap();
232-
let q6_sql = std::fs::read_to_string("../../benchmarks/queries/q6.sql").unwrap();
233-
let q7_sql = std::fs::read_to_string("../../benchmarks/queries/q7.sql").unwrap();
234-
let q8_sql = std::fs::read_to_string("../../benchmarks/queries/q8.sql").unwrap();
235-
let q9_sql = std::fs::read_to_string("../../benchmarks/queries/q9.sql").unwrap();
236-
let q10_sql = std::fs::read_to_string("../../benchmarks/queries/q10.sql").unwrap();
237-
let q11_sql = std::fs::read_to_string("../../benchmarks/queries/q11.sql").unwrap();
238-
let q12_sql = std::fs::read_to_string("../../benchmarks/queries/q12.sql").unwrap();
239-
let q13_sql = std::fs::read_to_string("../../benchmarks/queries/q13.sql").unwrap();
240-
let q14_sql = std::fs::read_to_string("../../benchmarks/queries/q14.sql").unwrap();
241-
// let q15_sql = std::fs::read_to_string("../../benchmarks/queries/q15.sql").unwrap();
242-
let q16_sql = std::fs::read_to_string("../../benchmarks/queries/q16.sql").unwrap();
243-
let q17_sql = std::fs::read_to_string("../../benchmarks/queries/q17.sql").unwrap();
244-
let q18_sql = std::fs::read_to_string("../../benchmarks/queries/q18.sql").unwrap();
245-
let q19_sql = std::fs::read_to_string("../../benchmarks/queries/q19.sql").unwrap();
246-
let q20_sql = std::fs::read_to_string("../../benchmarks/queries/q20.sql").unwrap();
247-
let q21_sql = std::fs::read_to_string("../../benchmarks/queries/q21.sql").unwrap();
248-
let q22_sql = std::fs::read_to_string("../../benchmarks/queries/q22.sql").unwrap();
227+
let tpch_queries = [
228+
"q1", "q2", "q3", "q4", "q5", "q6", "q7", "q8", "q9", "q10", "q11", "q12", "q13",
229+
"q14", // "q15", q15 has multiple SQL statements which is not supported
230+
"q16", "q17", "q18", "q19", "q20", "q21", "q22",
231+
];
249232

250-
c.bench_function("physical_plan_tpch", |b| {
251-
b.iter(|| physical_plan(&ctx, &q1_sql));
252-
b.iter(|| physical_plan(&ctx, &q2_sql));
253-
b.iter(|| physical_plan(&ctx, &q3_sql));
254-
b.iter(|| physical_plan(&ctx, &q4_sql));
255-
b.iter(|| physical_plan(&ctx, &q5_sql));
256-
b.iter(|| physical_plan(&ctx, &q6_sql));
257-
b.iter(|| physical_plan(&ctx, &q7_sql));
258-
b.iter(|| physical_plan(&ctx, &q8_sql));
259-
b.iter(|| physical_plan(&ctx, &q9_sql));
260-
b.iter(|| physical_plan(&ctx, &q10_sql));
261-
b.iter(|| physical_plan(&ctx, &q11_sql));
262-
b.iter(|| physical_plan(&ctx, &q12_sql));
263-
b.iter(|| physical_plan(&ctx, &q13_sql));
264-
b.iter(|| physical_plan(&ctx, &q14_sql));
265-
// b.iter(|| physical_plan(&ctx, &q15_sql));
266-
b.iter(|| physical_plan(&ctx, &q16_sql));
267-
b.iter(|| physical_plan(&ctx, &q17_sql));
268-
b.iter(|| physical_plan(&ctx, &q18_sql));
269-
b.iter(|| physical_plan(&ctx, &q19_sql));
270-
b.iter(|| physical_plan(&ctx, &q20_sql));
271-
b.iter(|| physical_plan(&ctx, &q21_sql));
272-
b.iter(|| physical_plan(&ctx, &q22_sql));
233+
for q in tpch_queries {
234+
let sql = std::fs::read_to_string(format!("../../benchmarks/queries/{}.sql", q))
235+
.unwrap();
236+
c.bench_function(&format!("physical_plan_tpch_{}", q), |b| {
237+
b.iter(|| logical_plan(&ctx, &sql))
238+
});
239+
}
240+
241+
let all_tpch_sql_queries = tpch_queries
242+
.iter()
243+
.map(|q| {
244+
std::fs::read_to_string(format!("../../benchmarks/queries/{}.sql", q))
245+
.unwrap()
246+
})
247+
.collect::<Vec<_>>();
248+
249+
c.bench_function("physical_plan_tpch_all", |b| {
250+
b.iter(|| {
251+
for sql in &all_tpch_sql_queries {
252+
logical_plan(&ctx, sql)
253+
}
254+
})
273255
});
274256
}
275257

0 commit comments

Comments
 (0)