Skip to content

Commit 23f3d5b

Browse files
committed
add bigbench workload
1 parent 7c85c13 commit 23f3d5b

File tree

8 files changed

+1212
-148
lines changed

8 files changed

+1212
-148
lines changed

HYRISE_data_file

+8-19
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,9 @@
1-
19 42 1
1+
8 14 1
22
2 0
3-
1 0 4 1 6 1 7 1 12 1
4-
4 1 7 1 12 1
5-
2 1 3 1 6 1 7 2 12 2
6-
6 1 7 1 11 1 12 2 13 1 14 1
7-
2 1 4 1 5 1 7 2 9 1 12 2 13 1 17 1
8-
2 1 3 1 4 2 5 1 6 2 12 3
9-
16 1
10-
6 1 13 1 17 1
11-
14 1
12-
5 1 12 1 13 1 14 1
13-
2 1 3 1 4 2 5 2 6 2 7 3 11 1 13 1 14 1
14-
5 1 6 1 9 1 11 1 12 1 14 1 17 1
15-
5 1 10 1 11 1 12 1 13 1
16-
16 1 19 1
17-
8 1 15 1 17 1 18 1 19 2
18-
6 1 9 1 13 1 16 1 18 1 19 1
19-
16 1 17 1 19 1
20-
15 1 16 2 17 1 18 1
3+
1 0 4 2 6 2
4+
4 3 5 1 6 3 7 1
5+
2 2 3 3 5 1 6 7 7 1 8 2
6+
3 1 4 1 6 2
7+
2 2 3 3 4 7 5 2 7 1 8 2
8+
3 1 4 1 6 1
9+
4 2 6 2

HYRISE_data_file.part.3

+1-12
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,8 @@
1-
2
2-
0
3-
0
4-
0
5-
0
6-
2
71
0
82
1
93
2
4+
1
105
2
116
2
12-
0
13-
2
147
2
158
1
16-
1
17-
1
18-
1
19-
1

query10

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
select avgDuration, visitDate, pageRank from bigbench where avgDuration = 29;
2+
select languageCode,duration from bigbench where avgDuration=57;
3+
select languageCode,pageRank from bigbench where pageURL='ydckzaxqailzhlveucekjveazutrpoqxybxgacatcqccclukptmunytmostmhjyyhppyccghxwtyeipsl';
4+
select languageCode,pageRank from bigbench where pageURL='jhyxeotcfiibhtcbuqugkrnzshokkjxjifftxkjwzylscsqxhadncjeqptkydsuwhoegkdhgqbaxhzwqfvfedultcumw';
5+
select pageRank,duration from bigbench where pageRank=1920;
6+
select languageCode,pageRank from bigbench where userAgent='Djjtkfjakd/3.1';
7+
select pageRank,languageCode from bigbench where avgDuration=7;
8+
select languageCode,pageRank from bigbench where visitDate='1990-08-08';
9+
select pageRank,languageCode from bigbench where avgDuration=21;
10+
select pageRank,languageCode from bigbench where userAgent='Gblukxvtjaq/2.5';

query1000

+1,001
Large diffs are not rendered by default.

src/db/schema/BenchmarkTables.java

+89-62
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import db.schema.entity.Attribute;
55
import db.schema.entity.Query;
66
import db.schema.entity.Table;
7+
import db.schema.entity.Workload;
78
import db.schema.types.AttributeType;
89
import db.schema.types.TableType;
910
import db.schema.utils.AttributeUtils;
@@ -15,13 +16,10 @@
1516
import java.io.FileWriter;
1617
import java.io.IOException;
1718
import java.sql.Types;
18-
import java.util.ArrayList;
19-
import java.util.Arrays;
20-
import java.util.List;
21-
import java.util.Random;
19+
import java.util.*;
2220

2321
public class BenchmarkTables {
24-
public static enum Type {TPC_H_CUSTOMER, TPC_H_LINEITEM, TPC_H_ORDERS, TPC_H_PART, TPC_H_PARTSUPP, TPC_H_SUPPLIER, TPC_H_NATION, TPC_H_REGION}
22+
public static enum Type {TPC_H_CUSTOMER, TPC_H_LINEITEM, TPC_H_ORDERS, TPC_H_PART, TPC_H_PARTSUPP, TPC_H_SUPPLIER, TPC_H_NATION, TPC_H_REGION, TPC_H_ALL}
2523

2624
public static class BenchmarkConfig {
2725
private String dataFileDir;
@@ -53,7 +51,65 @@ public void setTableType(TableType tableType) {
5351
}
5452
}
5553

56-
/*Begin Debugging Begin*/
54+
public static Table tpchCustomer(BenchmarkConfig conf){
55+
Attribute custKey = new Attribute("c_CustKey", AttributeType.Integer());
56+
custKey.primaryKey = true;
57+
58+
Attribute name = new Attribute("c_Name", AttributeType.CharacterVarying(25));
59+
Attribute address = new Attribute("c_Address", AttributeType.CharacterVarying(40));
60+
Attribute nationKey = new Attribute("c_NationKey", AttributeType.Integer());
61+
Attribute phone = new Attribute("c_Phone", AttributeType.Character(15));
62+
Attribute acctBal = new Attribute("c_AcctBal", AttributeType.Real());
63+
Attribute mktSegment = new Attribute("c_MktSegment", AttributeType.Character(10));
64+
Attribute comment = new Attribute("c_Comment", AttributeType.CharacterVarying(117));
65+
66+
List<Attribute> attributes = new ArrayList<Attribute>();
67+
attributes.add(custKey);
68+
attributes.add(name);
69+
attributes.add(address);
70+
attributes.add(nationKey);
71+
attributes.add(phone);
72+
attributes.add(acctBal);
73+
attributes.add(mktSegment);
74+
attributes.add(comment);
75+
76+
Table t = new Table("customer", conf.getTableType(), attributes);
77+
t.pk = "c_CustKey";
78+
t.workload = BenchmarkWorkloads.tpchCustomer(attributes, conf.getScaleFactor());
79+
t.workload.dataFileName = conf.getDataFileDir() + "customer.tbl";
80+
return t;
81+
}
82+
83+
public static Table tpchLineitem(BenchmarkConfig conf){
84+
85+
List<Attribute> attributes = new ArrayList<Attribute>();
86+
87+
attributes.add(new Attribute("l_OrderKey", AttributeType.Integer()));
88+
attributes.add(new Attribute("l_PartKey", AttributeType.Integer()));
89+
attributes.add(new Attribute("l_SuppKey", AttributeType.Integer()));
90+
attributes.add(new Attribute("l_Linenumber", AttributeType.Integer()));
91+
attributes.add(new Attribute("l_Quantity", AttributeType.Real()));
92+
attributes.add(new Attribute("l_ExtendedPrice", AttributeType.Real()));
93+
attributes.add(new Attribute("l_Discount", AttributeType.Real()));
94+
attributes.add(new Attribute("l_Tax", AttributeType.Real()));
95+
attributes.add(new Attribute("l_ReturnFlag", AttributeType.Character(1)));
96+
attributes.add(new Attribute("l_LineStatus", AttributeType.Character(1)));
97+
attributes.add(new Attribute("l_ShipDate", AttributeType.Date("yyyy-MM-dd")));
98+
attributes.add(new Attribute("l_CommitDate", AttributeType.Date("yyyy-MM-dd")));
99+
attributes.add(new Attribute("l_ReceiptDate", AttributeType.Date("yyyy-MM-dd")));
100+
attributes.add(new Attribute("l_ShipInstruct", AttributeType.Character(25)));
101+
attributes.add(new Attribute("l_ShipMode", AttributeType.Character(10)));
102+
attributes.add(new Attribute("l_Comment", AttributeType.CharacterVarying(44)));
103+
104+
105+
106+
Table t = new Table("lineitem", conf.getTableType(), attributes);
107+
t.pk = "l_OrderKey,l_Linenumber";
108+
t.workload = BenchmarkWorkloads.tpchLineitem(attributes, conf.getScaleFactor());
109+
t.workload.dataFileName = conf.getDataFileDir() + "lineitem.tbl";
110+
111+
return t;
112+
}
57113

58114
public static Table tpchAll(BenchmarkConfig conf){
59115

@@ -163,64 +219,35 @@ public static Table tpchAll(BenchmarkConfig conf){
163219
System.out.println(t.workload.dataFileName);
164220
return t;
165221
}
166-
/*End Debugging End*/
167222

168-
public static Table tpchCustomer(BenchmarkConfig conf){
169-
Attribute custKey = new Attribute("c_CustKey", AttributeType.Integer());
170-
custKey.primaryKey = true;
171-
172-
Attribute name = new Attribute("c_Name", AttributeType.CharacterVarying(25));
173-
Attribute address = new Attribute("c_Address", AttributeType.CharacterVarying(40));
174-
Attribute nationKey = new Attribute("c_NationKey", AttributeType.Integer());
175-
Attribute phone = new Attribute("c_Phone", AttributeType.Character(15));
176-
Attribute acctBal = new Attribute("c_AcctBal", AttributeType.Real());
177-
Attribute mktSegment = new Attribute("c_MktSegment", AttributeType.Character(10));
178-
Attribute comment = new Attribute("c_Comment", AttributeType.CharacterVarying(117));
179-
180-
List<Attribute> attributes = new ArrayList<Attribute>();
181-
attributes.add(custKey);
182-
attributes.add(name);
183-
attributes.add(address);
184-
attributes.add(nationKey);
185-
attributes.add(phone);
186-
attributes.add(acctBal);
187-
attributes.add(mktSegment);
188-
attributes.add(comment);
189-
190-
Table t = new Table("customer", conf.getTableType(), attributes);
191-
t.pk = "c_CustKey";
192-
t.workload = BenchmarkWorkloads.tpchCustomer(attributes, conf.getScaleFactor());
193-
t.workload.dataFileName = conf.getDataFileDir() + "customer.tbl";
194-
return t;
195-
}
223+
public static Table bigbench(BenchmarkConfig conf, Map<String, List<Integer>> queryAttrs){
196224

197-
public static Table tpchLineitem(BenchmarkConfig conf){
198-
199-
List<Attribute> attributes = new ArrayList<Attribute>();
200-
201-
attributes.add(new Attribute("l_OrderKey", AttributeType.Integer()));
202-
attributes.add(new Attribute("l_PartKey", AttributeType.Integer()));
203-
attributes.add(new Attribute("l_SuppKey", AttributeType.Integer()));
204-
attributes.add(new Attribute("l_Linenumber", AttributeType.Integer()));
205-
attributes.add(new Attribute("l_Quantity", AttributeType.Real()));
206-
attributes.add(new Attribute("l_ExtendedPrice", AttributeType.Real()));
207-
attributes.add(new Attribute("l_Discount", AttributeType.Real()));
208-
attributes.add(new Attribute("l_Tax", AttributeType.Real()));
209-
attributes.add(new Attribute("l_ReturnFlag", AttributeType.Character(1)));
210-
attributes.add(new Attribute("l_LineStatus", AttributeType.Character(1)));
211-
attributes.add(new Attribute("l_ShipDate", AttributeType.Date("yyyy-MM-dd")));
212-
attributes.add(new Attribute("l_CommitDate", AttributeType.Date("yyyy-MM-dd")));
213-
attributes.add(new Attribute("l_ReceiptDate", AttributeType.Date("yyyy-MM-dd")));
214-
attributes.add(new Attribute("l_ShipInstruct", AttributeType.Character(25)));
215-
attributes.add(new Attribute("l_ShipMode", AttributeType.Character(10)));
216-
attributes.add(new Attribute("l_Comment", AttributeType.CharacterVarying(44)));
217-
218-
Table t = new Table("lineitem", conf.getTableType(), attributes);
219-
t.pk = "l_OrderKey,l_Linenumber";
220-
t.workload = BenchmarkWorkloads.tpchLineitem(attributes, conf.getScaleFactor());
221-
t.workload.dataFileName = conf.getDataFileDir() + "lineitem.tbl";
222-
return t;
223-
}
225+
List<Attribute> attributes = new ArrayList<Attribute>();
226+
227+
attributes.add(new Attribute("pageURL", AttributeType.CharacterVarying(300)));
228+
attributes.add(new Attribute("pageRank", AttributeType.Integer()));
229+
attributes.add(new Attribute("avgDuration", AttributeType.Integer()));
230+
attributes.add(new Attribute("sourceIP", AttributeType.CharacterVarying(116)));
231+
attributes.add(new Attribute("visitDate", AttributeType.Date("yyyy-MM-dd")));
232+
attributes.add(new Attribute("adRevenue", AttributeType.Real()));
233+
attributes.add(new Attribute("userAgent", AttributeType.CharacterVarying(256)));
234+
attributes.add(new Attribute("countryCode", AttributeType.Character(3)));
235+
attributes.add(new Attribute("languageCode", AttributeType.Character(6)));
236+
attributes.add(new Attribute("searchWord", AttributeType.CharacterVarying(32)));
237+
attributes.add(new Attribute("duration", AttributeType.Integer()));
238+
239+
240+
Table t = new Table("bigbench", conf.getTableType(), attributes);
241+
t.pk = "pageURL,sourceIP,visitDate";
242+
243+
244+
245+
t.workload = BenchmarkWorkloads.bigbench(attributes, conf.getScaleFactor(), queryAttrs);
246+
t.workload.dataFileName = conf.getDataFileDir() + "bigbench.tbl";
247+
248+
System.out.println(t.workload.dataFileName);
249+
return t;
250+
}
224251

225252
public static Table tpchPart(BenchmarkConfig conf){
226253

src/db/schema/BenchmarkWorkloads.java

+39-17
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,31 @@
66
import db.schema.entity.Workload;
77
import db.schema.utils.zipf.ZipfDistributionFromGrayEtAl;
88

9+
import java.io.BufferedReader;
10+
import java.io.FileNotFoundException;
11+
import java.io.FileReader;
12+
import java.io.IOException;
913
import java.util.List;
14+
import java.util.Map;
1015

1116
public class BenchmarkWorkloads {
1217

13-
/*Begin Debugging Begin*/
18+
public static Workload tpchCustomer(List<Attribute> attributes, double scaleFactor){
19+
Workload w = new Workload(attributes, (long)(scaleFactor * 150000), "CUSTOMER");
20+
w.addProjectionQuery("Q3", 1, new int[]{6}, 2.00E-01, 0, 6);
21+
w.addProjectionQuery("Q5", 1, 0, 3);
22+
w.addProjectionQuery("Q7", 1, 0, 3);
23+
w.addProjectionQuery("Q8", 1, 0, 3);
24+
w.addProjectionQuery("Q10", 1, 0, 1, 2, 3, 4, 5, 7);
25+
w.addProjectionQuery("Q13", 1, 0);
26+
w.addProjectionQuery("Q18", 1, 0, 1);
27+
w.addProjectionQuery("Q22", 1, new int[]{4, 5}, 2.55E-01, 0, 4, 5);
28+
29+
return w;
30+
}
31+
32+
33+
1434
public static Workload tpchAll(List<Attribute> attributes, double scaleFactor){
1535
Workload w = new Workload(attributes, (long)(scaleFactor * 6000000), "ALL");
1636
w.addProjectionQuery("A1", 1, 19, 6, 16, 5, 4, 1, 9);
@@ -19,29 +39,31 @@ public static Workload tpchAll(List<Attribute> attributes, double scaleFactor){
1939
w.addProjectionQuery("A4", 1, 27, 14, 25, 24);
2040
w.addProjectionQuery("A5", 1, 3, 17, 8, 11, 9);
2141
w.addProjectionQuery("A6", 1, 23, 22, 20, 26);
22-
w.addProjectionQuery("A7", 1, 10, 7, 22, 21, 20, 11, 4);
42+
w.addProjectionQuery("A7", 1, 10, 7, 22, 21, 20, 5, 11, 4);
2343
w.addProjectionQuery("A8", 1, 14, 30, 29);
2444
w.addProjectionQuery("A9", 1, 3, 14, 8, 30, 18);
2545
w.addProjectionQuery("A10", 1, 2, 0);
2646

2747
return w;
2848
}
29-
/*End Debuging End*/
3049

31-
public static Workload tpchCustomer(List<Attribute> attributes, double scaleFactor){
32-
Workload w = new Workload(attributes, (long)(scaleFactor * 150000), "CUSTOMER");
33-
w.addProjectionQuery("Q3", 1, new int[]{6}, 2.00E-01, 0, 6);
34-
w.addProjectionQuery("Q5", 1, 0, 3);
35-
w.addProjectionQuery("Q7", 1, 0, 3);
36-
w.addProjectionQuery("Q8", 1, 0, 3);
37-
w.addProjectionQuery("Q10", 1, 0, 1, 2, 3, 4, 5, 7);
38-
w.addProjectionQuery("Q13", 1, 0);
39-
w.addProjectionQuery("Q18", 1, 0, 1);
40-
w.addProjectionQuery("Q22", 1, new int[]{4, 5}, 2.55E-01, 0, 4, 5);
41-
42-
return w;
43-
}
44-
50+
public static Workload bigbench(List<Attribute> attributes, double scaleFactor, Map<String, List<Integer>> queryAttrs){
51+
52+
Workload w = new Workload(attributes, (long)(scaleFactor * 1000000), "bigbench");
53+
54+
for (Map.Entry<String, List<Integer>> entry : queryAttrs.entrySet()) {
55+
String key = entry.getKey();
56+
List<Integer> value = entry.getValue();
57+
int[] newvalue = new int[value.size()];
58+
int i = 0;
59+
for (Integer e : value)
60+
newvalue[i++] = e.intValue();
61+
w.addProjectionQuery(key, 1, newvalue);
62+
// ...
63+
}
64+
return w;
65+
}
66+
4567
public static Workload tpchLineitem(List<Attribute> attributes, double scaleFactor){
4668
Workload w = new Workload(attributes, (long)(scaleFactor * 6000000), "LINEITEM");
4769
w.addProjectionQuery("Q1", 1, new int[]{10}, 9.90E-01, 4,5,6,7,8,9,10);

0 commit comments

Comments
 (0)