1#include "benchmark_runner.hpp"
2#include "compare_result.hpp"
3#include "dbgen.hpp"
4#include "duckdb_benchmark_macro.hpp"
5
6using namespace duckdb;
7using 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
31DUCKDB_BENCHMARK(Q01, "[tpch-sf1]")
32TPCH_QUERY_BODY(1);
33FINISH_BENCHMARK(Q01)
34
35DUCKDB_BENCHMARK(Q02, "[tpch-sf1]")
36TPCH_QUERY_BODY(2);
37FINISH_BENCHMARK(Q02)
38
39DUCKDB_BENCHMARK(Q03, "[tpch-sf1]")
40TPCH_QUERY_BODY(3);
41FINISH_BENCHMARK(Q03)
42
43DUCKDB_BENCHMARK(Q04, "[tpch-sf1]")
44TPCH_QUERY_BODY(4);
45FINISH_BENCHMARK(Q04)
46
47DUCKDB_BENCHMARK(Q05, "[tpch-sf1]")
48TPCH_QUERY_BODY(5);
49FINISH_BENCHMARK(Q05)
50
51DUCKDB_BENCHMARK(Q06, "[tpch-sf1]")
52TPCH_QUERY_BODY(6);
53FINISH_BENCHMARK(Q06)
54
55DUCKDB_BENCHMARK(Q07, "[tpch-sf1]")
56TPCH_QUERY_BODY(7);
57FINISH_BENCHMARK(Q07)
58
59DUCKDB_BENCHMARK(Q08, "[tpch-sf1]")
60TPCH_QUERY_BODY(8);
61FINISH_BENCHMARK(Q08)
62
63DUCKDB_BENCHMARK(Q09, "[tpch-sf1]")
64TPCH_QUERY_BODY(9);
65FINISH_BENCHMARK(Q09)
66
67DUCKDB_BENCHMARK(Q10, "[tpch-sf1]")
68TPCH_QUERY_BODY(10);
69FINISH_BENCHMARK(Q10)
70
71DUCKDB_BENCHMARK(Q11, "[tpch-sf1]")
72TPCH_QUERY_BODY(11);
73FINISH_BENCHMARK(Q11)
74
75DUCKDB_BENCHMARK(Q12, "[tpch-sf1]")
76TPCH_QUERY_BODY(12);
77FINISH_BENCHMARK(Q12)
78
79DUCKDB_BENCHMARK(Q13, "[tpch-sf1]")
80TPCH_QUERY_BODY(13);
81FINISH_BENCHMARK(Q13)
82
83DUCKDB_BENCHMARK(Q14, "[tpch-sf1]")
84TPCH_QUERY_BODY(14);
85FINISH_BENCHMARK(Q14)
86
87DUCKDB_BENCHMARK(Q15, "[tpch-sf1]")
88TPCH_QUERY_BODY(15);
89FINISH_BENCHMARK(Q15)
90
91DUCKDB_BENCHMARK(Q16, "[tpch-sf1]")
92TPCH_QUERY_BODY(16);
93FINISH_BENCHMARK(Q16)
94
95DUCKDB_BENCHMARK(Q17, "[tpch-sf1]")
96TPCH_QUERY_BODY(17);
97FINISH_BENCHMARK(Q17)
98
99DUCKDB_BENCHMARK(Q18, "[tpch-sf1]")
100TPCH_QUERY_BODY(18);
101FINISH_BENCHMARK(Q18)
102
103DUCKDB_BENCHMARK(Q19, "[tpch-sf1]")
104TPCH_QUERY_BODY(19);
105FINISH_BENCHMARK(Q19)
106
107DUCKDB_BENCHMARK(Q20, "[tpch-sf1]")
108TPCH_QUERY_BODY(20);
109FINISH_BENCHMARK(Q20)
110
111DUCKDB_BENCHMARK(Q21, "[tpch-sf1]")
112TPCH_QUERY_BODY(21);
113FINISH_BENCHMARK(Q21)
114DUCKDB_BENCHMARK(Q22, "[tpch-sf1]")
115TPCH_QUERY_BODY(22);
116FINISH_BENCHMARK(Q22)
117