1 | #include "benchmark_runner.hpp" |
2 | #include "compare_result.hpp" |
3 | #include "dbgen.hpp" |
4 | #include "duckdb_benchmark_macro.hpp" |
5 | |
6 | using namespace duckdb; |
7 | using namespace std; |
8 | |
9 | #define SF 1 |
10 | |
11 | #define TPCH_QUERY_BODY(QNR) \ |
12 | virtual void Load(DuckDBBenchmarkState *state) { \ |
13 | if (!BenchmarkRunner::TryLoadDatabase(state->db, "tpch")) { \ |
14 | tpch::dbgen(SF, state->db); \ |
15 | BenchmarkRunner::SaveDatabase(state->db, "tpch"); \ |
16 | } \ |
17 | } \ |
18 | virtual string GetQuery() { \ |
19 | return tpch::get_query(QNR); \ |
20 | } \ |
21 | virtual string VerifyResult(QueryResult *result) { \ |
22 | if (!result->success) { \ |
23 | return result->error; \ |
24 | } \ |
25 | return compare_csv(*result, tpch::get_answer(SF, QNR), true); \ |
26 | } \ |
27 | virtual string BenchmarkInfo() { \ |
28 | return StringUtil::Format("TPC-H Q%d SF%d: %s", QNR, SF, tpch::get_query(QNR).c_str()); \ |
29 | } |
30 | |
31 | DUCKDB_BENCHMARK(Q01, "[tpch-sf1]" ) |
32 | TPCH_QUERY_BODY(1); |
33 | FINISH_BENCHMARK(Q01) |
34 | |
35 | DUCKDB_BENCHMARK(Q02, "[tpch-sf1]" ) |
36 | TPCH_QUERY_BODY(2); |
37 | FINISH_BENCHMARK(Q02) |
38 | |
39 | DUCKDB_BENCHMARK(Q03, "[tpch-sf1]" ) |
40 | TPCH_QUERY_BODY(3); |
41 | FINISH_BENCHMARK(Q03) |
42 | |
43 | DUCKDB_BENCHMARK(Q04, "[tpch-sf1]" ) |
44 | TPCH_QUERY_BODY(4); |
45 | FINISH_BENCHMARK(Q04) |
46 | |
47 | DUCKDB_BENCHMARK(Q05, "[tpch-sf1]" ) |
48 | TPCH_QUERY_BODY(5); |
49 | FINISH_BENCHMARK(Q05) |
50 | |
51 | DUCKDB_BENCHMARK(Q06, "[tpch-sf1]" ) |
52 | TPCH_QUERY_BODY(6); |
53 | FINISH_BENCHMARK(Q06) |
54 | |
55 | DUCKDB_BENCHMARK(Q07, "[tpch-sf1]" ) |
56 | TPCH_QUERY_BODY(7); |
57 | FINISH_BENCHMARK(Q07) |
58 | |
59 | DUCKDB_BENCHMARK(Q08, "[tpch-sf1]" ) |
60 | TPCH_QUERY_BODY(8); |
61 | FINISH_BENCHMARK(Q08) |
62 | |
63 | DUCKDB_BENCHMARK(Q09, "[tpch-sf1]" ) |
64 | TPCH_QUERY_BODY(9); |
65 | FINISH_BENCHMARK(Q09) |
66 | |
67 | DUCKDB_BENCHMARK(Q10, "[tpch-sf1]" ) |
68 | TPCH_QUERY_BODY(10); |
69 | FINISH_BENCHMARK(Q10) |
70 | |
71 | DUCKDB_BENCHMARK(Q11, "[tpch-sf1]" ) |
72 | TPCH_QUERY_BODY(11); |
73 | FINISH_BENCHMARK(Q11) |
74 | |
75 | DUCKDB_BENCHMARK(Q12, "[tpch-sf1]" ) |
76 | TPCH_QUERY_BODY(12); |
77 | FINISH_BENCHMARK(Q12) |
78 | |
79 | DUCKDB_BENCHMARK(Q13, "[tpch-sf1]" ) |
80 | TPCH_QUERY_BODY(13); |
81 | FINISH_BENCHMARK(Q13) |
82 | |
83 | DUCKDB_BENCHMARK(Q14, "[tpch-sf1]" ) |
84 | TPCH_QUERY_BODY(14); |
85 | FINISH_BENCHMARK(Q14) |
86 | |
87 | DUCKDB_BENCHMARK(Q15, "[tpch-sf1]" ) |
88 | TPCH_QUERY_BODY(15); |
89 | FINISH_BENCHMARK(Q15) |
90 | |
91 | DUCKDB_BENCHMARK(Q16, "[tpch-sf1]" ) |
92 | TPCH_QUERY_BODY(16); |
93 | FINISH_BENCHMARK(Q16) |
94 | |
95 | DUCKDB_BENCHMARK(Q17, "[tpch-sf1]" ) |
96 | TPCH_QUERY_BODY(17); |
97 | FINISH_BENCHMARK(Q17) |
98 | |
99 | DUCKDB_BENCHMARK(Q18, "[tpch-sf1]" ) |
100 | TPCH_QUERY_BODY(18); |
101 | FINISH_BENCHMARK(Q18) |
102 | |
103 | DUCKDB_BENCHMARK(Q19, "[tpch-sf1]" ) |
104 | TPCH_QUERY_BODY(19); |
105 | FINISH_BENCHMARK(Q19) |
106 | |
107 | DUCKDB_BENCHMARK(Q20, "[tpch-sf1]" ) |
108 | TPCH_QUERY_BODY(20); |
109 | FINISH_BENCHMARK(Q20) |
110 | |
111 | DUCKDB_BENCHMARK(Q21, "[tpch-sf1]" ) |
112 | TPCH_QUERY_BODY(21); |
113 | FINISH_BENCHMARK(Q21) |
114 | DUCKDB_BENCHMARK(Q22, "[tpch-sf1]" ) |
115 | TPCH_QUERY_BODY(22); |
116 | FINISH_BENCHMARK(Q22) |
117 | |