├── LICENSE
├── README.md
├── config
├── .DS_Store
├── htapb_config_postgres.xml
└── plugin.xml
├── copyFromCSVCOmmand.txt
├── htapb_auxiliar
├── license.txt
├── log4j.configuration
├── log4j.properties
├── manifest.mf
├── pom.xml
├── run-Exec-HTAPB.sh
├── run-Load-HTAPB.sh
└── src
├── .DS_Store
├── pt
├── .DS_Store
└── haslab
│ ├── .DS_Store
│ └── htapbench
│ ├── .DS_Store
│ ├── api
│ ├── .DS_Store
│ ├── BenchmarkModule.java
│ ├── CreateDialects.java
│ ├── Loader.java
│ ├── LoaderUtil.java
│ ├── Operation.java
│ ├── Procedure.java
│ ├── SQLStmt.java
│ ├── StatementDialects.java
│ ├── TransactionGenerator.java
│ ├── TransactionType.java
│ ├── TransactionTypes.java
│ ├── Worker.java
│ ├── dialects.xsd
│ └── dialects
│ │ ├── DialectType.java
│ │ ├── DialectsType.java
│ │ ├── ObjectFactory.java
│ │ ├── ProcedureType.java
│ │ └── StatementType.java
│ ├── benchmark
│ ├── .DS_Store
│ ├── .sql
│ ├── HTAPBCSVLoader.java
│ ├── HTAPBConstants.java
│ ├── HTAPBLoader.java
│ ├── HTAPBenchmark.java
│ ├── TPCCUtil.java
│ ├── TPCCWorker.java
│ ├── TPCHWorker.java
│ ├── htapb-db2-ddl.sql
│ ├── htapb-ddl.sql
│ ├── htapb-ddl_1.sql
│ ├── htapb-monetdb-ddl.sql
│ ├── htapb-mysql-ddl.sql
│ ├── htapb-nuodb-ddl.sql
│ ├── htapb-oracle-ddl.sql
│ ├── htapb-pg-ddl.sql
│ ├── htapb-postgres-ddl.sql
│ ├── htapb-sqlserver-ddl.sql
│ ├── jTPCCConfig.java
│ ├── nation_gen.tbl
│ ├── region_gen.tbl
│ └── tpcc-dialects.xml
│ ├── catalog
│ ├── AbstractCatalogObject.java
│ ├── Catalog.java
│ ├── Column.java
│ ├── Index.java
│ ├── IntegrityConstraint.java
│ ├── IntegrityConstraintsExistsException.java
│ └── Table.java
│ ├── core
│ ├── .DS_Store
│ ├── AuxiliarFileHandler.java
│ ├── BenchmarkState.java
│ ├── ClientBalancer.java
│ ├── DistributionStatistics.java
│ ├── HTAPBench.java
│ ├── LatencyRecord.java
│ ├── LoadLineReader.java
│ ├── OLAPWorkerThread.java
│ ├── OLTPWorkerThread.java
│ ├── Phase.java
│ ├── Results.java
│ ├── SubmittedProcedure.java
│ ├── ThreadBench.java
│ ├── TimeBucketIterable.java
│ ├── TimeBucketIterator.java
│ ├── TraceReader.java
│ ├── WorkloadConfiguration.java
│ ├── WorkloadSetup.java
│ ├── WorkloadState.java
│ └── manifest.mf
│ ├── densitity
│ ├── Clock.java
│ └── DensityConsultant.java
│ ├── distributions
│ ├── Distribution.java
│ ├── HotspotDistribution.java
│ ├── UniformDistribution.java
│ └── Utils.java
│ ├── exceptions
│ └── HTAPBException.java
│ ├── jdbc
│ ├── AutoIncrementPreparedStatement.java
│ ├── ExecJDBC.java
│ ├── HSQLDBjdbcIO.java
│ └── jdbcIO.java
│ ├── pojo
│ ├── Customer.java
│ ├── District.java
│ ├── History.java
│ ├── Item.java
│ ├── Nation.java
│ ├── NewOrder.java
│ ├── Oorder.java
│ ├── OrderLine.java
│ ├── Region.java
│ ├── Stock.java
│ ├── Supplier.java
│ └── Warehouse.java
│ ├── procedures
│ ├── tpcc
│ │ ├── Delivery.java
│ │ ├── NewOrder.java
│ │ ├── OrderStatus.java
│ │ ├── Payment.java
│ │ ├── StockLevel.java
│ │ ├── TPCCProcedure.java
│ │ ├── extract_queries.py
│ │ ├── gen_class.py
│ │ ├── gen_worker.py
│ │ ├── generate_classes.py
│ │ └── get_queries.py
│ └── tpch
│ │ ├── GenericQuery.java
│ │ ├── Q1.java
│ │ ├── Q10.java
│ │ ├── Q11.java
│ │ ├── Q12.java
│ │ ├── Q13.java
│ │ ├── Q14.java
│ │ ├── Q15.java
│ │ ├── Q16.java
│ │ ├── Q17.java
│ │ ├── Q18.java
│ │ ├── Q19.java
│ │ ├── Q2.java
│ │ ├── Q20.java
│ │ ├── Q21.java
│ │ ├── Q22.java
│ │ ├── Q3.java
│ │ ├── Q4.java
│ │ ├── Q5.java
│ │ ├── Q6.java
│ │ ├── Q7.java
│ │ ├── Q8.java
│ │ ├── Q9.java
│ │ ├── query1.sql
│ │ ├── query10.sql
│ │ ├── query11.sql
│ │ ├── query12.sql
│ │ ├── query13.sql
│ │ ├── query14.sql
│ │ ├── query15-create-view.sql
│ │ ├── query15-drop-view.sql
│ │ ├── query15.sql
│ │ ├── query16.sql
│ │ ├── query17.sql
│ │ ├── query18.sql
│ │ ├── query19.sql
│ │ ├── query2.sql
│ │ ├── query20.sql
│ │ ├── query21.sql
│ │ ├── query22.sql
│ │ ├── query3.sql
│ │ ├── query4.sql
│ │ ├── query5.sql
│ │ ├── query6.sql
│ │ ├── query7.sql
│ │ ├── query8.sql
│ │ └── query9.sql
│ ├── random
│ ├── RandomExecutor.java
│ └── RandomParameters.java
│ ├── types
│ ├── DatabaseType.java
│ ├── ResultSetResult.java
│ ├── SortDirectionType.java
│ ├── State.java
│ └── TransactionStatus.java
│ └── util
│ ├── ClassUtil.java
│ ├── CollectionUtil.java
│ ├── CompositeId.java
│ ├── EventObservable.java
│ ├── EventObservableExceptionHandler.java
│ ├── EventObserver.java
│ ├── FileUtil.java
│ ├── Histogram.java
│ ├── JSONSerializable.java
│ ├── JSONUtil.java
│ ├── MeasureTargetSystem.java
│ ├── MysqlGetStats.java
│ ├── Pair.java
│ ├── QueueLimitException.java
│ ├── RandomDist.java
│ ├── RandomDistribution.java
│ ├── RandomGenerator.java
│ ├── ResultUploader.java
│ ├── SQLUtil.java
│ ├── SSHGetStats.java
│ ├── ScriptRunner.java
│ ├── SimplePrinter.java
│ ├── SimpleSystemPrinter.java
│ ├── StatisticsCollector.java
│ ├── StatsHolder.java
│ ├── StringUtil.java
│ ├── TableDataIterable.java
│ ├── TextGenerator.java
│ ├── TimeUtil.java
│ ├── dbms_collectors
│ ├── DBCollector.java
│ ├── DBParameterCollector.java
│ ├── DBParameterCollectorGen.java
│ ├── MYSQLCollector.java
│ └── POSTGRESCollector.java
│ └── json
│ ├── JSONArray.java
│ ├── JSONException.java
│ ├── JSONObject.java
│ ├── JSONString.java
│ ├── JSONStringer.java
│ ├── JSONTokener.java
│ ├── JSONWriter.java
│ └── Test.java
└── test
└── .DS_Store
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright 2015 by OLTPBenchmark Project
2 |
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
--------------------------------------------------------------------------------
/config/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/faclc4/HTAPBench/0e64856a3906b65a077335fd10003b6af90e1ea6/config/.DS_Store
--------------------------------------------------------------------------------
/config/htapb_config_postgres.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | postgres
6 | HTAPB
7 | org.postgresql.Driver
8 | jdbc:postgresql://192.168.82.100:5432/htapb
9 | postgres_user
10 | postgres_pass
11 | TRANSACTION_READ_COMMITTED
12 |
13 |
14 | 5
15 | 0.2
16 |
17 |
18 |
19 | 35
20 |
21 |
22 |
23 | 0
24 |
25 |
26 | 10
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 | 45,44,4,4,3,3,2,3,2,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5
36 |
37 |
38 |
39 |
40 |
41 |
42 | NewOrder
43 |
44 |
45 | Payment
46 |
47 |
48 | OrderStatus
49 |
50 |
51 | Delivery
52 |
53 |
54 | StockLevel
55 |
56 |
57 | Q1
58 |
59 |
60 | Q2
61 |
62 |
63 | Q3
64 |
65 |
66 | Q4
67 |
68 |
69 | Q5
70 |
71 |
72 | Q6
73 |
74 |
75 | Q7
76 |
77 |
78 | Q8
79 |
80 |
81 | Q9
82 |
83 |
84 | Q10
85 |
86 |
87 | Q11
88 |
89 |
90 | Q12
91 |
92 |
93 | Q13
94 |
95 |
96 | Q14
97 |
98 |
99 | Q15
100 |
101 |
102 | Q16
103 |
104 |
105 | Q17
106 |
107 |
108 | Q18
109 |
110 |
111 | Q19
112 |
113 |
114 | Q20
115 |
116 |
117 | Q21
118 |
119 |
120 | Q22
121 |
122 |
123 |
124 |
--------------------------------------------------------------------------------
/config/plugin.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | pt.haslab.htapbench.core.HTAPBench
4 |
5 |
--------------------------------------------------------------------------------
/copyFromCSVCOmmand.txt:
--------------------------------------------------------------------------------
1 | COPY FILES FROM CSV TO DATABASE:
2 |
3 | MONETDB:
4 | COPY INTO WAREHOUSE FROM '/var/csv/warehouse.csv' USING DELIMITERS ',';
5 | COPY INTO HISTORY FROM '/var/csv/cust-hist.csv' USING DELIMITERS ',';
6 | COPY INTO DISTRICT FROM '/var/csv/district.csv' USING DELIMITERS ',';
7 | COPY INTO NATION FROM '/var/csv/nation.csv' USING DELIMITERS ',';
8 | COPY INTO OORDER FROM '/var/csv/order.csv' USING DELIMITERS ',';
9 | COPY INTO REGION FROM '/var/csv/region.csv' USING DELIMITERS ',';
10 | COPY INTO SUPPLIER FROM '/var/csv/supplier.csv' USING DELIMITERS ',';
11 | COPY INTO CUSTOMER FROM '/var/csv/customer.csv' USING DELIMITERS ',';
12 | COPY INTO ITEM FROM '/var/csv/item.csv' USING DELIMITERS ',';
13 | COPY INTO NEW_ORDER FROM '/var/csv/new-order.csv' USING DELIMITERS ',';
14 | COPY INTO ORDER_LINE FROM '/var/csv/order-line.csv' USING DELIMITERS ',';
15 | COPY INTO STOCK FROM '/var/csv/stock.csv' USING DELIMITERS ',';
16 |
17 | POSTGRESQL:
18 | COPY WAREHOUSE FROM '/var/csv/warehouse.csv' USING DELIMITERS ',';
19 | COPY HISTORY FROM '/var/csv/cust-hist.csv' USING DELIMITERS ',';
20 | COPY DISTRICT FROM '/var/csv/district.csv' USING DELIMITERS ',';
21 | COPY NATION FROM '/var/csv/nation.csv' USING DELIMITERS ',';
22 | COPY REGION FROM '/var/csv/region.csv' USING DELIMITERS ',';
23 | COPY OORDER FROM '/var/csv/order.csv' USING DELIMITERS ',' NULL AS 'null';
24 | COPY SUPPLIER FROM '/var/csv/supplier.csv' USING DELIMITERS ',';
25 | COPY CUSTOMER FROM '/var/csv/customer.csv' USING DELIMITERS ',';
26 | COPY ITEM FROM '/var/csv/item.csv' USING DELIMITERS ',';
27 | COPY NEW_ORDER FROM '/var/csv/new-order.csv' USING DELIMITERS ',';
28 | COPY ORDER_LINE FROM '/var/csv/order-line.csv' USING DELIMITERS ',';
29 | COPY STOCK FROM '/var/csv/stock.csv' USING DELIMITERS ',';
30 |
31 | LX:
32 | python csv_loader.py -p examples/htapb-cloudinhas.yaml -s htapb -t warehouse -f /var/csv/warehouse.csv -y , -u app -i app -x 8
33 | python csv_loader.py -p examples/htapb-cloudinhas.yaml -s htapb -t history -f /var/csv/cust-hist.csv -y , -u app -i app -x 8
34 | python csv_loader.py -p examples/htapb-cloudinhas.yaml -s htapb -t district -f /var/csv/district.csv -y , -u app -i app -x 8
35 | python csv_loader.py -p examples/htapb-cloudinhas.yaml -s htapb -t nation -f /var/csv/nation.csv -y , -u app -i app -x 1
36 | python csv_loader.py -p examples/htapb-cloudinhas.yaml -s htapb -t region -f /var/csv/region.csv -y , -u app -i app -x 1
37 | python csv_loader.py -p examples/htapb-cloudinhas.yaml -s htapb -t supplier -f /var/csv/supplier.csv -y , -u app -i app -x 8
38 | python csv_loader.py -p examples/htapb-cloudinhas.yaml -s htapb -t new_order -f /var/csv/new-order.csv -y , -u app -i app -x 8
39 | python csv_loader.py -p examples/htapb-cloudinhas.yaml -s htapb -t item -f /var/csv/item.csv -y , -u app -i app -x 8
40 | python csv_loader.py -p examples/htapb-cloudinhas.yaml -s htapb -t order_line -f /var/csv/order-line.csv -y , -u app -i app -x 8
41 | python csv_loader.py -p examples/htapb-cloudinhas.yaml -s htapb -t stock -f /var/csv/stock.csv -y , -u app -i app -x 8
42 | python csv_loader.py -p examples/htapb-cloudinhas.yaml -s htapb -t oorder -f /var/csv/order.csv -y , -u app -i app -x 8
43 |
44 |
45 |
46 | python csv_loader.py -p examples/htapb-cloudinhas.yaml -s htapb -t customer -f /var/csv/customer.csv -y , -u app -i app -x 8
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 | APPEND SUFFIX TO ALL FILES IN A FOLDER:
55 | rename 's/\.csv$/\.csv-1600wh/' *.csv
56 |
57 | cust-hist.csv district.csv nation.csv order.csv region.csv supplier.csv
58 | customer.csv item.csv new-order.csv order-line.csv stock.csv warehouse.csv
59 |
60 |
--------------------------------------------------------------------------------
/htapb_auxiliar:
--------------------------------------------------------------------------------
1 | #HTAPB auxiliar file
2 | #Tue Mar 27 11:45:53 WEST 2018
3 | startLoadTimestamp=1522147553981
4 | lastLoadTimestamp=1533742073981
5 |
--------------------------------------------------------------------------------
/license.txt:
--------------------------------------------------------------------------------
1 | Copyright 2017 by INESC TEC
2 | Developed by Fábio Coelho
3 | This work was based on the OLTPBenchmark Project
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 |
--------------------------------------------------------------------------------
/log4j.configuration:
--------------------------------------------------------------------------------
1 | # Set root logger level to INFO and its only appender to A1.
2 | log4j.rootLogger=INFO, A1
3 | log4j.rootLogger.layout=org.apache.log4j.PatternLayout
4 |
5 | # A1 is set to be a ConsoleAppender.
6 | log4j.appender.A1=org.apache.log4j.ConsoleAppender
7 | log4j.appender.A1.layout=org.apache.log4j.PatternLayout
8 | log4j.appender.A1.layout.ConversionPattern=%d{ABSOLUTE} (%F:%L) %-5p - %m%n
9 |
10 | # API
11 | log4j.logger.eu.leanbigdata.htapb=INFO
12 | log4j.logger.eu.leanbigdata.htapb.api=INFO
13 |
14 | # Benchmarks
15 | log4j.logger.eu.leanbigdata.htpab.benchmarks.tpcc=INFO
16 | log4j.logger.eu.leanbigdata.htpab.benchmarks.tpch=INFO
17 | log4j.logger.eu.leanbigdata.htpab.benchmark.htapb=INFO
18 |
19 |
20 | # Loaders
21 | log4j.logger.eu.leanbigdata.htpab.benchmark.HTAPBLoader=INFO
22 |
23 |
24 |
25 | !==============================================================================
26 | ! log4j.properties - An example configuration properties file for log4j.
27 | !
28 | ! Logging levels are:
29 | ! INFO < INFO < WARN < ERROR < FATAL
30 | !==============================================================================
31 |
32 | ! turn on the internal log4j INFOging flag so we can see what it is doing
33 | log4j.INFO=true
34 |
35 | !==============================================================================
36 | ! JDBC API layer call logging :
37 | ! INFO shows logging, INFO also shows where in code the jdbc calls were made,
38 | ! setting INFO to true might cause minor slow-down in some environments.
39 | ! If you experience too much slowness, use INFO instead.
40 |
41 | ! Log only the SQL that is executed.
42 | log4j.logger.jdbc.sqlonly=INFO,A1
43 | log4j.additivity.jdbc.sqlonly=true
44 |
--------------------------------------------------------------------------------
/log4j.properties:
--------------------------------------------------------------------------------
1 | log4j.rootLogger=ERROR,stdout
2 | log4j.logger.com.endeca=INFO
3 | # Logger for crawl metrics
4 | log4j.logger.com.endeca.itl.web.metrics=INFO
5 |
6 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender
7 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
8 | log4j.appender.stdout.layout.ConversionPattern=%p\t%d{ISO8601}\t%r\t%c\t[%t]\t%m%n
9 |
--------------------------------------------------------------------------------
/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/run-Exec-HTAPB.sh:
--------------------------------------------------------------------------------
1 | java -cp .:target/htapbench-0.95-jar-with-dependencies.jar pt.haslab.htapbench.core.HTAPBench -b htapb -c config/htapb_config_postgres.xml --create false --load false --execute true --s 120 --calibrate false
2 |
--------------------------------------------------------------------------------
/run-Load-HTAPB.sh:
--------------------------------------------------------------------------------
1 | java -cp .:target/htapbench-0.95-jar-with-dependencies.jar pt.haslab.htapbench.core.HTAPBench -b htapb -c config/htapb_config_postgres.xml --create true --load true --generateFiles true --filePath ~/Desktop/ --execute false --s 120 --calibrate false
2 |
--------------------------------------------------------------------------------
/src/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/faclc4/HTAPBench/0e64856a3906b65a077335fd10003b6af90e1ea6/src/.DS_Store
--------------------------------------------------------------------------------
/src/pt/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/faclc4/HTAPBench/0e64856a3906b65a077335fd10003b6af90e1ea6/src/pt/.DS_Store
--------------------------------------------------------------------------------
/src/pt/haslab/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/faclc4/HTAPBench/0e64856a3906b65a077335fd10003b6af90e1ea6/src/pt/haslab/.DS_Store
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/faclc4/HTAPBench/0e64856a3906b65a077335fd10003b6af90e1ea6/src/pt/haslab/htapbench/.DS_Store
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/api/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/faclc4/HTAPBench/0e64856a3906b65a077335fd10003b6af90e1ea6/src/pt/haslab/htapbench/api/.DS_Store
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/api/Operation.java:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************************
3 | * Copyright 2015 by OLTPBenchmark Project *
4 | * *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); *
6 | * you may not use this file except in compliance with the License. *
7 | * You may obtain a copy of the License at *
8 | * *
9 | * http://www.apache.org/licenses/LICENSE-2.0 *
10 | * *
11 | * Unless required by applicable law or agreed to in writing, software *
12 | * distributed under the License is distributed on an "AS IS" BASIS, *
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 | * See the License for the specific language governing permissions and *
15 | * limitations under the License. *
16 | ******************************************************************************
17 | /*
18 | * Copyright 2017 by INESC TEC
19 | * This work was based on the OLTPBenchmark Project
20 | *
21 | * Licensed under the Apache License, Version 2.0 (the "License");
22 | * you may not use this file except in compliance with the License.
23 | * You may obtain a copy of the License at
24 | *
25 | * http://www.apache.org/licenses/LICENSE-2.0
26 | *
27 | * Unless required by applicable law or agreed to in writing, software
28 | * distributed under the License is distributed on an "AS IS" BASIS,
29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 | * See the License for the specific language governing permissions and
31 | * limitations under the License.
32 | */
33 | package pt.haslab.htapbench.api;
34 |
35 | public abstract class Operation {
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/api/TransactionGenerator.java:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************************
3 | * Copyright 2015 by OLTPBenchmark Project *
4 | * *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); *
6 | * you may not use this file except in compliance with the License. *
7 | * You may obtain a copy of the License at *
8 | * *
9 | * http://www.apache.org/licenses/LICENSE-2.0 *
10 | * *
11 | * Unless required by applicable law or agreed to in writing, software *
12 | * distributed under the License is distributed on an "AS IS" BASIS, *
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 | * See the License for the specific language governing permissions and *
15 | * limitations under the License. *
16 | ******************************************************************************
17 | /*
18 | * Copyright 2017 by INESC TEC
19 | * This work was based on the OLTPBenchmark Project
20 | *
21 | * Licensed under the Apache License, Version 2.0 (the "License");
22 | * you may not use this file except in compliance with the License.
23 | * You may obtain a copy of the License at
24 | *
25 | * http://www.apache.org/licenses/LICENSE-2.0
26 | *
27 | * Unless required by applicable law or agreed to in writing, software
28 | * distributed under the License is distributed on an "AS IS" BASIS,
29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 | * See the License for the specific language governing permissions and
31 | * limitations under the License.
32 | */
33 | package pt.haslab.htapbench.api;
34 |
35 |
36 | public interface TransactionGenerator {
37 | /** Implementations *must* be thread-safe. */
38 | public T nextTransaction();
39 | }
40 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/api/TransactionType.java:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************************
3 | * Copyright 2015 by OLTPBenchmark Project *
4 | * *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); *
6 | * you may not use this file except in compliance with the License. *
7 | * You may obtain a copy of the License at *
8 | * *
9 | * http://www.apache.org/licenses/LICENSE-2.0 *
10 | * *
11 | * Unless required by applicable law or agreed to in writing, software *
12 | * distributed under the License is distributed on an "AS IS" BASIS, *
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 | * See the License for the specific language governing permissions and *
15 | * limitations under the License. *
16 | ******************************************************************************
17 | /*
18 | * Copyright 2017 by INESC TEC
19 | * This work was based on the OLTPBenchmark Project
20 | *
21 | * Licensed under the Apache License, Version 2.0 (the "License");
22 | * you may not use this file except in compliance with the License.
23 | * You may obtain a copy of the License at
24 | *
25 | * http://www.apache.org/licenses/LICENSE-2.0
26 | *
27 | * Unless required by applicable law or agreed to in writing, software
28 | * distributed under the License is distributed on an "AS IS" BASIS,
29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 | * See the License for the specific language governing permissions and
31 | * limitations under the License.
32 | */
33 | package pt.haslab.htapbench.api;
34 |
35 |
36 | public class TransactionType implements Comparable {
37 |
38 | public static class Invalid extends Procedure { }
39 | public static final int INVALID_ID = 0;
40 | public static final TransactionType INVALID = new TransactionType(Invalid.class, INVALID_ID);
41 |
42 | private final Class extends Procedure> procClass;
43 | private final int id;
44 | private final boolean supplemental;
45 |
46 | protected TransactionType(Class extends Procedure> procClass, int id, boolean supplemental) {
47 | this.procClass = procClass;
48 | this.id = id;
49 | this.supplemental = supplemental;
50 | }
51 |
52 | protected TransactionType(Class extends Procedure> procClass, int id) {
53 | this(procClass, id, false);
54 | }
55 |
56 | public Class extends Procedure> getProcedureClass() {
57 | return (this.procClass);
58 | }
59 | public String getName() {
60 | return this.procClass.getSimpleName();
61 | }
62 | public int getId() {
63 | return this.id;
64 | }
65 | public boolean isSupplemental() {
66 | return this.supplemental;
67 | }
68 |
69 | @Override
70 | public boolean equals(Object obj) {
71 | if (this == obj)
72 | return true;
73 |
74 | if (!(obj instanceof TransactionType) || obj == null)
75 | return false;
76 |
77 | TransactionType other = (TransactionType)obj;
78 | return (this.id == other.id && this.procClass.equals(other.procClass));
79 | }
80 |
81 |
82 | @Override
83 | public int hashCode() {
84 | return (this.id * 31) + this.procClass.hashCode();
85 | }
86 |
87 | @Override
88 | public int compareTo(TransactionType o) {
89 | return (this.id - o.id);
90 | }
91 |
92 | @Override
93 | public String toString() {
94 | return String.format("%s/%02d", this.procClass.getSimpleName(), this.id);
95 | }
96 |
97 | }
98 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/api/dialects.xsd:
--------------------------------------------------------------------------------
1 |
2 |
37 |
38 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/benchmark/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/faclc4/HTAPBench/0e64856a3906b65a077335fd10003b6af90e1ea6/src/pt/haslab/htapbench/benchmark/.DS_Store
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/benchmark/HTAPBConstants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 by INESC TEC
3 | * Developed by Fábio Coelho
4 | * This work was based on the OLTPBenchmark Project
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 | package pt.haslab.htapbench.benchmark;
19 |
20 | public abstract class HTAPBConstants {
21 | public static final String TABLENAME_DISTRICT = "DISTRICT";
22 | public static final String TABLENAME_WAREHOUSE = "WAREHOUSE";
23 | public static final String TABLENAME_ITEM = "ITEM";
24 | public static final String TABLENAME_STOCK = "STOCK";
25 | public static final String TABLENAME_CUSTOMER = "CUSTOMER";
26 | public static final String TABLENAME_HISTORY = "HISTORY";
27 | public static final String TABLENAME_ORDER = "OORDER";
28 | public static final String TABLENAME_ORDERLINE = "ORDER_LINE";
29 | public static final String TABLENAME_NEWORDER = "NEW_ORDER";
30 | public static final String TABLENAME_NATION = "NATION";
31 | public static final String TABLENAME_REGION = "REGION";
32 | public static final String TABLENAME_SUPPLIER = "SUPPLIER";
33 | }
34 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/benchmark/jTPCCConfig.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 by INESC TEC
3 | * Developed by Fábio Coelho
4 | * This work was based on the OLTPBenchmark Project
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 | package pt.haslab.htapbench.benchmark;
19 |
20 | /*
21 | * jTPCCConfig - Basic configuration parameters for jTPCC
22 | *
23 | * Copyright (C) 2003, Raul Barbosa
24 | * Copyright (C) 2004-2006, Denis Lussier
25 | *
26 | */
27 |
28 | import java.text.SimpleDateFormat;
29 |
30 | public final class jTPCCConfig {
31 |
32 | // TODO: This was final; Modified by TPCCRateLimited. Better system?
33 | public static boolean TERMINAL_MESSAGES = true;
34 |
35 | public static enum TransactionType {
36 | INVALID, // Exists so the order is the same as the constants below
37 | NEW_ORDER, PAYMENT, ORDER_STATUS, DELIVERY, STOCK_LEVEL
38 | }
39 |
40 | // TODO: Remove these constants
41 | public final static int NEW_ORDER = 1, PAYMENT = 2, ORDER_STATUS = 3,
42 | DELIVERY = 4, STOCK_LEVEL = 5;
43 |
44 | public final static String[] nameTokens = { "BAR", "OUGHT", "ABLE", "PRI",
45 | "PRES", "ESE", "ANTI", "CALLY", "ATION", "EING" };
46 |
47 | public final static String terminalPrefix = "Term-";
48 | public final static String reportFilePrefix = "reports/BenchmarkSQL_session_";
49 |
50 | public final static SimpleDateFormat dateFormat = new SimpleDateFormat(
51 | "yyyy-MM-dd HH:mm:ss");
52 |
53 | public final static int configCommitCount = 1000; // commit every n records
54 | public final static int configWhseCount = 1;
55 | public final static int configItemCount = 100000; // tpc-c std = 100,000
56 | public final static int configDistPerWhse = 10; // tpc-c std = 10
57 | public final static int configCustPerDist = 3000; // tpc-c std = 3,000
58 |
59 | /** An invalid item id used to rollback a new order transaction. */
60 | public static final int INVALID_ITEM_ID = -12345;
61 |
62 | public static final long thinkTime = 0;
63 |
64 | public static final long keyingTime_NewOrder = 18000;
65 | public static final long keyingTime_Payment = 3000;
66 | public static final long keyingTime_Delivery = 2000;
67 | public static final long keyingTime_OrderStatus = 2000;
68 | public static final long keyingTime_StockLevel = 2000;
69 |
70 | //the max tpmC considered accordinf to TPC-C specification [pag. 61 - clause 4.2].
71 | public static final double max_tmpC = 1.281;
72 |
73 | }
74 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/benchmark/region_gen.tbl:
--------------------------------------------------------------------------------
1 | 1|Africa |bIKaGP4VDy4kV8z5GsyCvoC2SFL8BBb9lI5hJx284oWL2fhPNqV3XeRTJM2U2IhodH4wID9cDCr5wQSZJ0RQ0qP3bx99bR4L7QC13dYq0kWwmfTa5NMA
2 | 2|America |NmdHQaMgd9G4OopGEQ5mQGp6o79hI8NL0BobmVWEu29MuJpQVLQrUhvLi0JQhyY0Lkt0KYDbx1S8FAKcMJLF0eDQPenevRCAj5Z
3 | 3|Asia |bIDtqrZXraFtliGTl7NIz2RtLBavLE2cEVgW9iPEZi3WL59LEBXNk4pScy96SYU7Ti0SYSi7oebrakOD5tuUUdLkbztPU8GpD8pYvZ889eGLWu0mYi3XD4iCw0M
4 | 4|Australia |6pRd6jAeKGj2vWYQqHtpPUupR5Sc1SkQGVDg2ZGueffAZaCufbx7YKUohHsPyz7pMfL4fEOS1wsOjGwDlamI8cZDvNOdQn4m9J2NKOHBMZ1tTuDplR0nKu8d1V2lB1Pw4elmyE3NJqtMWthf36R2pk
5 | 5|Europe |1oi2r0Es7qYdGyYVTaRJlxzbcghww6cbQ2eTXilhXo5P5cjWwAzZnsE4I5XTIExBXnHnMQLcIMaHJjdOS0uOOFW24djaeT4918wiulgjyv0wiKOO3ci0Who7CsOOASLeBG
6 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/catalog/AbstractCatalogObject.java:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************************
3 | * Copyright 2015 by OLTPBenchmark Project *
4 | * *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); *
6 | * you may not use this file except in compliance with the License. *
7 | * You may obtain a copy of the License at *
8 | * *
9 | * http://www.apache.org/licenses/LICENSE-2.0 *
10 | * *
11 | * Unless required by applicable law or agreed to in writing, software *
12 | * distributed under the License is distributed on an "AS IS" BASIS, *
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 | * See the License for the specific language governing permissions and *
15 | * limitations under the License. *
16 | ******************************************************************************
17 | /*
18 | * Copyright 2017 by INESC TEC
19 | * This work was based on the OLTPBenchmark Project
20 | *
21 | * Licensed under the Apache License, Version 2.0 (the "License");
22 | * you may not use this file except in compliance with the License.
23 | * You may obtain a copy of the License at
24 | *
25 | * http://www.apache.org/licenses/LICENSE-2.0
26 | *
27 | * Unless required by applicable law or agreed to in writing, software
28 | * distributed under the License is distributed on an "AS IS" BASIS,
29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 | * See the License for the specific language governing permissions and
31 | * limitations under the License.
32 | */
33 |
34 | /**
35 | * Base Catalog Object Class
36 | * @author pavlo
37 | */
38 | package pt.haslab.htapbench.catalog;
39 |
40 | import java.io.Serializable;
41 |
42 | /**
43 | * Base Catalog Object Class
44 | */
45 | public abstract class AbstractCatalogObject implements Serializable {
46 | static final long serialVersionUID = 0;
47 |
48 | protected final String name;
49 |
50 | public AbstractCatalogObject(String name) {
51 | this.name = name;
52 | }
53 |
54 | /**
55 | * Return the name of this catalog object in the database
56 | * @return
57 | */
58 | public final String getName() {
59 | return (this.name);
60 | }
61 |
62 | /**
63 | * Return the name of this catalog object escaped with the
64 | * by the CatalogUtil.separator
65 | * @return
66 | */
67 | public final String getEscapedName() {
68 | String s = Catalog.getSeparator();
69 | return s + this.name + s;
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/catalog/IntegrityConstraint.java:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************************
3 | * Copyright 2015 by OLTPBenchmark Project *
4 | * *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); *
6 | * you may not use this file except in compliance with the License. *
7 | * You may obtain a copy of the License at *
8 | * *
9 | * http://www.apache.org/licenses/LICENSE-2.0 *
10 | * *
11 | * Unless required by applicable law or agreed to in writing, software *
12 | * distributed under the License is distributed on an "AS IS" BASIS, *
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 | * See the License for the specific language governing permissions and *
15 | * limitations under the License. *
16 | ******************************************************************************
17 | /*
18 | * Copyright 2017 by INESC TEC
19 | * This work was based on the OLTPBenchmark Project
20 | *
21 | * Licensed under the Apache License, Version 2.0 (the "License");
22 | * you may not use this file except in compliance with the License.
23 | * You may obtain a copy of the License at
24 | *
25 | * http://www.apache.org/licenses/LICENSE-2.0
26 | *
27 | * Unless required by applicable law or agreed to in writing, software
28 | * distributed under the License is distributed on an "AS IS" BASIS,
29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 | * See the License for the specific language governing permissions and
31 | * limitations under the License.
32 | */
33 |
34 | /**
35 | *
36 | * @author Carlo A. Curino (carlo@curino.us)
37 | */
38 | package pt.haslab.htapbench.catalog;
39 |
40 | import java.io.Serializable;
41 |
42 | import org.apache.commons.lang.NotImplementedException;
43 |
44 | /**
45 | *
46 | */
47 | public abstract class IntegrityConstraint implements Serializable{
48 | private static final long serialVersionUID = 1L;
49 |
50 | private String id;
51 |
52 | public IntegrityConstraint(){
53 | // ????
54 | }
55 |
56 | @Override
57 | public IntegrityConstraint clone(){
58 |
59 | try {
60 | throw new NotImplementedException("The clone method should be implemented in the subtypes!");
61 | } catch (NotImplementedException e) {
62 | e.printStackTrace();
63 | }
64 | return null;
65 | }
66 |
67 | public String getId() {
68 | return id;
69 | }
70 |
71 | /**
72 | * @param id the id to set
73 | */
74 | public void setId(String id) {
75 | this.id = id;
76 | }
77 |
78 | public abstract boolean equals(IntegrityConstraint ic);
79 |
80 |
81 | }
82 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/catalog/IntegrityConstraintsExistsException.java:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************************
3 | * Copyright 2015 by OLTPBenchmark Project *
4 | * *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); *
6 | * you may not use this file except in compliance with the License. *
7 | * You may obtain a copy of the License at *
8 | * *
9 | * http://www.apache.org/licenses/LICENSE-2.0 *
10 | * *
11 | * Unless required by applicable law or agreed to in writing, software *
12 | * distributed under the License is distributed on an "AS IS" BASIS, *
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 | * See the License for the specific language governing permissions and *
15 | * limitations under the License. *
16 | ******************************************************************************
17 | /*
18 | * Copyright 2017 by INESC TEC
19 | * This work was based on the OLTPBenchmark Project
20 | *
21 | * Licensed under the Apache License, Version 2.0 (the "License");
22 | * you may not use this file except in compliance with the License.
23 | * You may obtain a copy of the License at
24 | *
25 | * http://www.apache.org/licenses/LICENSE-2.0
26 | *
27 | * Unless required by applicable law or agreed to in writing, software
28 | * distributed under the License is distributed on an "AS IS" BASIS,
29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 | * See the License for the specific language governing permissions and
31 | * limitations under the License.
32 | */
33 | package pt.haslab.htapbench.catalog;
34 |
35 | /**
36 | *
37 | * @author Carlo A. Curino (carlo@curino.us)
38 | */
39 | public class IntegrityConstraintsExistsException extends Exception {
40 |
41 | private static final long serialVersionUID = 1L;
42 |
43 | public IntegrityConstraintsExistsException() {
44 | // TODO Auto-generated constructor stub
45 | }
46 |
47 | public IntegrityConstraintsExistsException(String message) {
48 | super(message);
49 | // TODO Auto-generated constructor stub
50 | }
51 |
52 | public IntegrityConstraintsExistsException(Throwable cause) {
53 | super(cause);
54 | // TODO Auto-generated constructor stub
55 | }
56 |
57 | public IntegrityConstraintsExistsException(String message, Throwable cause) {
58 | super(message, cause);
59 | // TODO Auto-generated constructor stub
60 | }
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/core/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/faclc4/HTAPBench/0e64856a3906b65a077335fd10003b6af90e1ea6/src/pt/haslab/htapbench/core/.DS_Store
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/core/LoadLineReader.java:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************************
3 | * Copyright 2015 by OLTPBenchmark Project *
4 | * *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); *
6 | * you may not use this file except in compliance with the License. *
7 | * You may obtain a copy of the License at *
8 | * *
9 | * http://www.apache.org/licenses/LICENSE-2.0 *
10 | * *
11 | * Unless required by applicable law or agreed to in writing, software *
12 | * distributed under the License is distributed on an "AS IS" BASIS, *
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 | * See the License for the specific language governing permissions and *
15 | * limitations under the License. *
16 | ******************************************************************************
17 | /*
18 | * Copyright 2017 by INESC TEC
19 | * This work was based on the OLTPBenchmark Project
20 | *
21 | * Licensed under the Apache License, Version 2.0 (the "License");
22 | * you may not use this file except in compliance with the License.
23 | * You may obtain a copy of the License at
24 | *
25 | * http://www.apache.org/licenses/LICENSE-2.0
26 | *
27 | * Unless required by applicable law or agreed to in writing, software
28 | * distributed under the License is distributed on an "AS IS" BASIS,
29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 | * See the License for the specific language governing permissions and
31 | * limitations under the License.
32 | */
33 | package pt.haslab.htapbench.core;
34 |
35 | import java.util.StringTokenizer;
36 |
37 | public class LoadLineReader {
38 |
39 |
40 | public long timeInSec = -1;
41 | public long ratePerSec = -1;
42 | public double[] transactionRatios = null;
43 |
44 |
45 | public LoadLineReader(String fileLine) {
46 |
47 | assert(fileLine!=null);
48 | StringTokenizer st = new StringTokenizer(fileLine);
49 |
50 | transactionRatios = new double[st.countTokens()-2];
51 |
52 | timeInSec = Long.parseLong(st.nextToken());
53 | ratePerSec = Long.parseLong(st.nextToken());
54 | if (ratePerSec < 1) {
55 | ratePerSec = 1;
56 | }
57 |
58 | for(int i =0; i< transactionRatios.length;i++)
59 | transactionRatios[i]=Double.parseDouble(st.nextToken());
60 |
61 | }
62 |
63 | public LoadLineReader(LoadLineReader llr) {
64 |
65 | this.timeInSec = llr.timeInSec;
66 | this.ratePerSec = llr.ratePerSec;
67 | this.transactionRatios = llr.transactionRatios.clone();
68 |
69 | }
70 |
71 | public double requestsPerSecond() {
72 | return ratePerSec;
73 | }
74 |
75 | }
76 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/core/OLAPWorkerThread.java:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************************
3 | * Copyright 2015 by OLTPBenchmark Project *
4 | * *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); *
6 | * you may not use this file except in compliance with the License. *
7 | * You may obtain a copy of the License at *
8 | * *
9 | * http://www.apache.org/licenses/LICENSE-2.0 *
10 | * *
11 | * Unless required by applicable law or agreed to in writing, software *
12 | * distributed under the License is distributed on an "AS IS" BASIS, *
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 | * See the License for the specific language governing permissions and *
15 | * limitations under the License. *
16 | ******************************************************************************
17 | /*
18 | * Copyright 2017 by INESC TEC
19 | * This work was based on the OLTPBenchmark Project
20 | *
21 | * Licensed under the Apache License, Version 2.0 (the "License");
22 | * you may not use this file except in compliance with the License.
23 | * You may obtain a copy of the License at
24 | *
25 | * http://www.apache.org/licenses/LICENSE-2.0
26 | *
27 | * Unless required by applicable law or agreed to in writing, software
28 | * distributed under the License is distributed on an "AS IS" BASIS,
29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 | * See the License for the specific language governing permissions and
31 | * limitations under the License.
32 | */
33 | package pt.haslab.htapbench.core;
34 |
35 | import pt.haslab.htapbench.api.Worker;
36 | import pt.haslab.htapbench.util.QueueLimitException;
37 | import java.io.IOException;
38 | import java.util.List;
39 | import java.util.logging.Level;
40 | import java.util.logging.Logger;
41 |
42 | public class OLAPWorkerThread implements Runnable{
43 |
44 | List workers;
45 | List workConfs;
46 | int intervalMonitor;
47 | boolean calibrate;
48 | Results results;
49 |
50 | public OLAPWorkerThread(List workers, List workConfs, int intervalMonitoring, boolean calibrate){
51 | this.workers=workers;
52 | this.workConfs=workConfs;
53 | String connection = this.workConfs.get(0).getDBConnection();
54 | this.workConfs.get(0).setDBConnection(connection);
55 | this.intervalMonitor=intervalMonitoring;
56 | this.calibrate=calibrate;
57 | }
58 |
59 | @Override
60 | public void run() {
61 | try {
62 | Thread.sleep(2*60*1000);
63 | results = ThreadBench.runOLAP(workers, workConfs, intervalMonitor, calibrate);
64 | } catch (QueueLimitException ex) {
65 | Logger.getLogger(OLAPWorkerThread.class.getName()).log(Level.SEVERE, null, ex);
66 | } catch (IOException ex) {
67 | Logger.getLogger(OLAPWorkerThread.class.getName()).log(Level.SEVERE, null, ex);
68 | } catch (InterruptedException ex) {
69 | Logger.getLogger(OLAPWorkerThread.class.getName()).log(Level.SEVERE, null, ex);
70 | }
71 | }
72 |
73 | public Results getResults(){
74 | return results;
75 | }
76 |
77 | }
78 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/core/OLTPWorkerThread.java:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************************
3 | * Copyright 2015 by OLTPBenchmark Project *
4 | * *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); *
6 | * you may not use this file except in compliance with the License. *
7 | * You may obtain a copy of the License at *
8 | * *
9 | * http://www.apache.org/licenses/LICENSE-2.0 *
10 | * *
11 | * Unless required by applicable law or agreed to in writing, software *
12 | * distributed under the License is distributed on an "AS IS" BASIS, *
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 | * See the License for the specific language governing permissions and *
15 | * limitations under the License. *
16 | ******************************************************************************
17 | /*
18 | * Copyright 2017 by INESC TEC
19 | * This work was based on the OLTPBenchmark Project
20 | *
21 | * Licensed under the Apache License, Version 2.0 (the "License");
22 | * you may not use this file except in compliance with the License.
23 | * You may obtain a copy of the License at
24 | *
25 | * http://www.apache.org/licenses/LICENSE-2.0
26 | *
27 | * Unless required by applicable law or agreed to in writing, software
28 | * distributed under the License is distributed on an "AS IS" BASIS,
29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 | * See the License for the specific language governing permissions and
31 | * limitations under the License.
32 | */
33 | package pt.haslab.htapbench.core;
34 |
35 | import pt.haslab.htapbench.api.Worker;
36 | import pt.haslab.htapbench.densitity.Clock;
37 | import pt.haslab.htapbench.util.QueueLimitException;
38 | import java.io.IOException;
39 | import java.util.List;
40 | import java.util.logging.Level;
41 | import java.util.logging.Logger;
42 |
43 | public class OLTPWorkerThread implements Runnable{
44 |
45 | List workers;
46 | List workConfs;
47 | int intervalMonitor;
48 | boolean calibrate;
49 | Results results;
50 | private Clock clock;
51 |
52 | public OLTPWorkerThread(List workers, List workConfs, int intervalMonitoring, boolean calibrate){
53 | this.workers=workers;
54 | this.workConfs=workConfs;
55 | this.intervalMonitor=intervalMonitoring;
56 | this.calibrate=calibrate;
57 | }
58 |
59 | @Override
60 | public void run() {
61 | try {
62 | results = ThreadBench.runRateLimitedOLTP(workers, workConfs, intervalMonitor, calibrate);
63 | } catch (QueueLimitException ex) {
64 | Logger.getLogger(OLTPWorkerThread.class.getName()).log(Level.SEVERE, null, ex);
65 | } catch (IOException ex) {
66 | Logger.getLogger(OLTPWorkerThread.class.getName()).log(Level.SEVERE, null, ex);
67 | }
68 | }
69 |
70 | public Results getResults(){
71 | return results;
72 | }
73 |
74 | }
75 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/core/SubmittedProcedure.java:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************************
3 | * Copyright 2015 by OLTPBenchmark Project *
4 | * *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); *
6 | * you may not use this file except in compliance with the License. *
7 | * You may obtain a copy of the License at *
8 | * *
9 | * http://www.apache.org/licenses/LICENSE-2.0 *
10 | * *
11 | * Unless required by applicable law or agreed to in writing, software *
12 | * distributed under the License is distributed on an "AS IS" BASIS, *
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 | * See the License for the specific language governing permissions and *
15 | * limitations under the License. *
16 | ******************************************************************************
17 | /*
18 | * Copyright 2017 by INESC TEC
19 | * This work was based on the OLTPBenchmark Project
20 | *
21 | * Licensed under the Apache License, Version 2.0 (the "License");
22 | * you may not use this file except in compliance with the License.
23 | * You may obtain a copy of the License at
24 | *
25 | * http://www.apache.org/licenses/LICENSE-2.0
26 | *
27 | * Unless required by applicable law or agreed to in writing, software
28 | * distributed under the License is distributed on an "AS IS" BASIS,
29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 | * See the License for the specific language governing permissions and
31 | * limitations under the License.
32 | */
33 | /**
34 | * This class is used for keeping track of the procedures that have been
35 | * submitted to the system when running a rate-limited benchmark.
36 | * @author breilly
37 | */
38 | package pt.haslab.htapbench.core;
39 |
40 | public class SubmittedProcedure {
41 | private final int type;
42 | private final long startTime;
43 |
44 | SubmittedProcedure(int type) {
45 | this.type = type;
46 | this.startTime = System.nanoTime();
47 | }
48 |
49 | SubmittedProcedure(int type, long startTime) {
50 | this.type = type;
51 | this.startTime = startTime;
52 | }
53 |
54 | public int getType() { return type; }
55 | public long getStartTime() { return startTime; }
56 | }
57 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/core/TimeBucketIterable.java:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************************
3 | * Copyright 2015 by OLTPBenchmark Project *
4 | * *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); *
6 | * you may not use this file except in compliance with the License. *
7 | * You may obtain a copy of the License at *
8 | * *
9 | * http://www.apache.org/licenses/LICENSE-2.0 *
10 | * *
11 | * Unless required by applicable law or agreed to in writing, software *
12 | * distributed under the License is distributed on an "AS IS" BASIS, *
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 | * See the License for the specific language governing permissions and *
15 | * limitations under the License. *
16 | ******************************************************************************
17 | /*
18 | * Copyright 2017 by INESC TEC
19 | * This work was based on the OLTPBenchmark Project
20 | *
21 | * Licensed under the Apache License, Version 2.0 (the "License");
22 | * you may not use this file except in compliance with the License.
23 | * You may obtain a copy of the License at
24 | *
25 | * http://www.apache.org/licenses/LICENSE-2.0
26 | *
27 | * Unless required by applicable law or agreed to in writing, software
28 | * distributed under the License is distributed on an "AS IS" BASIS,
29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 | * See the License for the specific language governing permissions and
31 | * limitations under the License.
32 | */
33 | package pt.haslab.htapbench.core;
34 |
35 | import pt.haslab.htapbench.api.TransactionType;
36 | import java.util.Iterator;
37 |
38 | public final class TimeBucketIterable implements Iterable {
39 | private final Iterable samples;
40 | private final int windowSizeSeconds;
41 | private final TransactionType txType;
42 |
43 | /**
44 | * @param samples
45 | * @param windowSizeSeconds
46 | * @param txType
47 | * Allows to filter transactions by type
48 | */
49 | public TimeBucketIterable(Iterable samples, int windowSizeSeconds, TransactionType txType) {
50 | this.samples = samples;
51 | this.windowSizeSeconds = windowSizeSeconds;
52 | this.txType = txType;
53 | }
54 |
55 | @Override
56 | public Iterator iterator() {
57 | return new TimeBucketIterator(samples.iterator(), windowSizeSeconds, txType);
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/core/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/densitity/DensityConsultant.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 by INESC TEC
3 | * Developed by Fábio Coelho
4 | * This work was based on the OLTPBenchmark Project
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 | package pt.haslab.htapbench.densitity;
19 |
20 | /**
21 | * This class houses the density specification for a standard mix execution of TPC-C with think time.
22 | */
23 | public class DensityConsultant {
24 |
25 | private final double m = 1.26956;
26 | private final double b = 0.0103497;
27 | private double density;
28 | //deltaTs in ms.
29 | private long deltaTS;
30 | private final int targetTPS;
31 |
32 |
33 | public DensityConsultant(int targetTPS){
34 | this.targetTPS=targetTPS;
35 | this.computeDensity();
36 | this.computeDeltaTS();
37 | }
38 |
39 | /**
40 | * Computes the density found during the TPC-C execute stage. This value is pre-defines for the standard TPC-X Txn mix.
41 | */
42 | private void computeDensity(){
43 | this.density= m*targetTPS +b;
44 | }
45 |
46 | /**
47 | * Return how many seconds should the clock move forward at each new TS issue process.
48 | */
49 | private void computeDeltaTS(){
50 | this.deltaTS=(long)(1000/density);
51 | }
52 |
53 | /**
54 | * Returns the computed Density.
55 | * @return
56 | */
57 | public double getDensity(){
58 | return this.density;
59 | }
60 |
61 | /**
62 | * Computes the Timestamp Delta used at each clock tick.
63 | * @return
64 | */
65 | public long getDeltaTs(){
66 | return this.deltaTS;
67 | }
68 |
69 | /**
70 | * Return the TargetTPS considered for the delta computation.
71 | * @return
72 | */
73 | public int getTargetTPS(){
74 | return this.targetTPS;
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/distributions/Distribution.java:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************************
3 | * Copyright 2015 by OLTPBenchmark Project *
4 | * *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); *
6 | * you may not use this file except in compliance with the License. *
7 | * You may obtain a copy of the License at *
8 | * *
9 | * http://www.apache.org/licenses/LICENSE-2.0 *
10 | * *
11 | * Unless required by applicable law or agreed to in writing, software *
12 | * distributed under the License is distributed on an "AS IS" BASIS, *
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 | * See the License for the specific language governing permissions and *
15 | * limitations under the License. *
16 | ******************************************************************************
17 | /*
18 | * Copyright 2017 by INESC TEC
19 | * This work was based on the OLTPBenchmark Project
20 | *
21 | * Licensed under the Apache License, Version 2.0 (the "License");
22 | * you may not use this file except in compliance with the License.
23 | * You may obtain a copy of the License at
24 | *
25 | * http://www.apache.org/licenses/LICENSE-2.0
26 | *
27 | * Unless required by applicable law or agreed to in writing, software
28 | * distributed under the License is distributed on an "AS IS" BASIS,
29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 | * See the License for the specific language governing permissions and
31 | * limitations under the License.
32 | */
33 | package pt.haslab.htapbench.distributions;
34 |
35 | public abstract class Distribution {
36 |
37 | String name = null;
38 |
39 | public Distribution(String name){
40 | this.name=name;
41 | }
42 |
43 | public String getName(){
44 | return this.name;
45 | }
46 |
47 | public abstract int nextInt();
48 | }
49 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/distributions/UniformDistribution.java:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************************
3 | * Copyright 2015 by OLTPBenchmark Project *
4 | * *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); *
6 | * you may not use this file except in compliance with the License. *
7 | * You may obtain a copy of the License at *
8 | * *
9 | * http://www.apache.org/licenses/LICENSE-2.0 *
10 | * *
11 | * Unless required by applicable law or agreed to in writing, software *
12 | * distributed under the License is distributed on an "AS IS" BASIS, *
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 | * See the License for the specific language governing permissions and *
15 | * limitations under the License. *
16 | ******************************************************************************
17 | /*
18 | * Copyright 2017 by INESC TEC
19 | * This work was based on the OLTPBenchmark Project
20 | *
21 | * Licensed under the Apache License, Version 2.0 (the "License");
22 | * you may not use this file except in compliance with the License.
23 | * You may obtain a copy of the License at
24 | *
25 | * http://www.apache.org/licenses/LICENSE-2.0
26 | *
27 | * Unless required by applicable law or agreed to in writing, software
28 | * distributed under the License is distributed on an "AS IS" BASIS,
29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 | * See the License for the specific language governing permissions and
31 | * limitations under the License.
32 | */
33 | package pt.haslab.htapbench.distributions;
34 |
35 | public class UniformDistribution extends Distribution{
36 |
37 | private int max;
38 | private int min;
39 | private int interval;
40 |
41 | public UniformDistribution(int min, int max) {
42 | super("uniform");
43 | this.min = min;
44 | this.max = max;
45 | this.interval = max-min+1;
46 | }
47 |
48 | @Override
49 | public int nextInt(){
50 | int ret=Utils.random().nextInt(interval)+min;
51 | return ret;
52 | }
53 |
54 | public double mean() {
55 | return ((double)((long)(max + (long)max))) / 2.0;
56 | }
57 |
58 |
59 |
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/exceptions/HTAPBException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 by INESC TEC
3 | * Developed by Fábio Coelho
4 | * This work was based on the OLTPBenchmark Project
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 | package pt.haslab.htapbench.exceptions;
19 |
20 | /**
21 | * This class represents a standard HTAPB Exception.
22 | */
23 | public class HTAPBException extends Exception{
24 |
25 | public HTAPBException(String standardText) {
26 | super(standardText);
27 | }
28 |
29 |
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/jdbc/jdbcIO.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 by INESC TEC
3 | * Developed by Fábio Coelho
4 | * This work was based on the OLTPBenchmark Project
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 | package pt.haslab.htapbench.jdbc;
19 |
20 | /*
21 | * jdbcIO - execute JDBC statements
22 | *
23 | * Copyright (C) 2004-2006, Denis Lussier
24 | *
25 | */
26 |
27 | import java.sql.PreparedStatement;
28 | import java.sql.SQLException;
29 | import java.sql.Timestamp;
30 | import java.sql.Types;
31 |
32 | import pt.haslab.htapbench.pojo.NewOrder;
33 | import pt.haslab.htapbench.pojo.Oorder;
34 | import pt.haslab.htapbench.pojo.OrderLine;
35 |
36 |
37 | public class jdbcIO {
38 |
39 | public void insertOrder(PreparedStatement ordrPrepStmt, Oorder oorder) {
40 |
41 | try {
42 |
43 | ordrPrepStmt.setInt(1, oorder.o_w_id);
44 | ordrPrepStmt.setInt(2, oorder.o_d_id);
45 | ordrPrepStmt.setInt(3, oorder.o_id);
46 | ordrPrepStmt.setInt(4, oorder.o_c_id);
47 | if (oorder.o_carrier_id != null) {
48 | ordrPrepStmt.setInt(5, oorder.o_carrier_id);
49 | } else {
50 | ordrPrepStmt.setNull(5, Types.INTEGER);
51 | }
52 | ordrPrepStmt.setInt(6, oorder.o_ol_cnt);
53 | ordrPrepStmt.setInt(7, oorder.o_all_local);
54 | Timestamp entry_d = new java.sql.Timestamp(oorder.o_entry_d);
55 | ordrPrepStmt.setTimestamp(8, entry_d);
56 |
57 | ordrPrepStmt.addBatch();
58 | //ordrPrepStmt.execute();
59 |
60 | } catch (SQLException se) {
61 | throw new RuntimeException(se);
62 | }
63 |
64 | } // end insertOrder()
65 |
66 | public void insertNewOrder(PreparedStatement nworPrepStmt,
67 | NewOrder new_order) {
68 |
69 | try {
70 | nworPrepStmt.setInt(1, new_order.no_w_id);
71 | nworPrepStmt.setInt(2, new_order.no_d_id);
72 | nworPrepStmt.setInt(3, new_order.no_o_id);
73 |
74 | nworPrepStmt.addBatch();
75 |
76 | } catch (SQLException se) {
77 | throw new RuntimeException(se);
78 | }
79 |
80 | } // end insertNewOrder()
81 |
82 | public void insertOrderLine(PreparedStatement orlnPrepStmt,
83 | OrderLine order_line) {
84 |
85 | try {
86 | orlnPrepStmt.setInt(1, order_line.ol_w_id);
87 | orlnPrepStmt.setInt(2, order_line.ol_d_id);
88 | orlnPrepStmt.setInt(3, order_line.ol_o_id);
89 | orlnPrepStmt.setInt(4, order_line.ol_number);
90 | orlnPrepStmt.setLong(5, order_line.ol_i_id);
91 |
92 | Timestamp delivery_d = null;
93 | if (order_line.ol_delivery_d != null)
94 | delivery_d = new Timestamp(order_line.ol_delivery_d);
95 | if (delivery_d == null)
96 | //orlnPrepStmt.setNull(6, 0);
97 | orlnPrepStmt.setTimestamp(6, new Timestamp(0));
98 | else
99 | orlnPrepStmt.setTimestamp(6, delivery_d);
100 |
101 | orlnPrepStmt.setDouble(7, order_line.ol_amount);
102 | orlnPrepStmt.setLong(8, order_line.ol_supply_w_id);
103 | orlnPrepStmt.setDouble(9, order_line.ol_quantity);
104 | orlnPrepStmt.setString(10, order_line.ol_dist_info);
105 |
106 | orlnPrepStmt.addBatch();
107 |
108 | } catch (SQLException se) {
109 | throw new RuntimeException(se);
110 | }
111 |
112 | } // end insertOrderLine()
113 |
114 | } // end class jdbcIO()
115 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/pojo/District.java:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************************
3 | * Copyright 2015 by OLTPBenchmark Project *
4 | * *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); *
6 | * you may not use this file except in compliance with the License. *
7 | * You may obtain a copy of the License at *
8 | * *
9 | * http://www.apache.org/licenses/LICENSE-2.0 *
10 | * *
11 | * Unless required by applicable law or agreed to in writing, software *
12 | * distributed under the License is distributed on an "AS IS" BASIS, *
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 | * See the License for the specific language governing permissions and *
15 | * limitations under the License. *
16 | ******************************************************************************
17 | /*
18 | * Copyright 2017 by INESC TEC
19 | * This work was based on the OLTPBenchmark Project
20 | *
21 | * Licensed under the Apache License, Version 2.0 (the "License");
22 | * you may not use this file except in compliance with the License.
23 | * You may obtain a copy of the License at
24 | *
25 | * http://www.apache.org/licenses/LICENSE-2.0
26 | *
27 | * Unless required by applicable law or agreed to in writing, software
28 | * distributed under the License is distributed on an "AS IS" BASIS,
29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 | * See the License for the specific language governing permissions and
31 | * limitations under the License.
32 | */
33 | package pt.haslab.htapbench.pojo;
34 |
35 | import java.io.Serializable;
36 |
37 | public class District implements Serializable {
38 |
39 | public int d_id;
40 | public int d_w_id;
41 | public int d_next_o_id;
42 | public float d_ytd;
43 | public float d_tax;
44 | public String d_name;
45 | public String d_street_1;
46 | public String d_street_2;
47 | public String d_city;
48 | public String d_state;
49 | public String d_zip;
50 |
51 | @Override
52 | public String toString() {
53 | return ("\n***************** District ********************"
54 | + "\n* d_id = "
55 | + d_id
56 | + "\n* d_w_id = "
57 | + d_w_id
58 | + "\n* d_ytd = "
59 | + d_ytd
60 | + "\n* d_tax = "
61 | + d_tax
62 | + "\n* d_next_o_id = "
63 | + d_next_o_id
64 | + "\n* d_name = "
65 | + d_name
66 | + "\n* d_street_1 = "
67 | + d_street_1
68 | + "\n* d_street_2 = "
69 | + d_street_2
70 | + "\n* d_city = "
71 | + d_city
72 | + "\n* d_state = " + d_state + "\n* d_zip = " + d_zip + "\n**********************************************");
73 | }
74 |
75 | } // end District
76 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/pojo/History.java:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************************
3 | * Copyright 2015 by OLTPBenchmark Project *
4 | * *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); *
6 | * you may not use this file except in compliance with the License. *
7 | * You may obtain a copy of the License at *
8 | * *
9 | * http://www.apache.org/licenses/LICENSE-2.0 *
10 | * *
11 | * Unless required by applicable law or agreed to in writing, software *
12 | * distributed under the License is distributed on an "AS IS" BASIS, *
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 | * See the License for the specific language governing permissions and *
15 | * limitations under the License. *
16 | ******************************************************************************
17 | /*
18 | * Copyright 2017 by INESC TEC
19 | * This work was based on the OLTPBenchmark Project
20 | *
21 | * Licensed under the Apache License, Version 2.0 (the "License");
22 | * you may not use this file except in compliance with the License.
23 | * You may obtain a copy of the License at
24 | *
25 | * http://www.apache.org/licenses/LICENSE-2.0
26 | *
27 | * Unless required by applicable law or agreed to in writing, software
28 | * distributed under the License is distributed on an "AS IS" BASIS,
29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 | * See the License for the specific language governing permissions and
31 | * limitations under the License.
32 | */
33 | package pt.haslab.htapbench.pojo;
34 |
35 | import java.sql.Timestamp;
36 |
37 | public class History {
38 |
39 | public int h_c_id;
40 | public int h_c_d_id;
41 | public int h_c_w_id;
42 | public int h_d_id;
43 | public int h_w_id;
44 | public Timestamp h_date;
45 | public float h_amount;
46 | public String h_data;
47 |
48 | @Override
49 | public String toString() {
50 | return ("\n***************** History ********************"
51 | + "\n* h_c_id = " + h_c_id + "\n* h_c_d_id = " + h_c_d_id
52 | + "\n* h_c_w_id = " + h_c_w_id + "\n* h_d_id = " + h_d_id
53 | + "\n* h_w_id = " + h_w_id + "\n* h_date = " + h_date
54 | + "\n* h_amount = " + h_amount + "\n* h_data = " + h_data + "\n**********************************************");
55 | }
56 |
57 | } // end History
58 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/pojo/Item.java:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************************
3 | * Copyright 2015 by OLTPBenchmark Project *
4 | * *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); *
6 | * you may not use this file except in compliance with the License. *
7 | * You may obtain a copy of the License at *
8 | * *
9 | * http://www.apache.org/licenses/LICENSE-2.0 *
10 | * *
11 | * Unless required by applicable law or agreed to in writing, software *
12 | * distributed under the License is distributed on an "AS IS" BASIS, *
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 | * See the License for the specific language governing permissions and *
15 | * limitations under the License. *
16 | ******************************************************************************
17 | /*
18 | * Copyright 2017 by INESC TEC
19 | * This work was based on the OLTPBenchmark Project
20 | *
21 | * Licensed under the Apache License, Version 2.0 (the "License");
22 | * you may not use this file except in compliance with the License.
23 | * You may obtain a copy of the License at
24 | *
25 | * http://www.apache.org/licenses/LICENSE-2.0
26 | *
27 | * Unless required by applicable law or agreed to in writing, software
28 | * distributed under the License is distributed on an "AS IS" BASIS,
29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 | * See the License for the specific language governing permissions and
31 | * limitations under the License.
32 | */
33 | package pt.haslab.htapbench.pojo;
34 |
35 | public class Item {
36 |
37 | public int i_id; // PRIMARY KEY
38 | public int i_im_id;
39 | public double i_price;
40 | public String i_name;
41 | public String i_data;
42 |
43 | @Override
44 | public String toString() {
45 | return ("\n***************** Item ********************"
46 | + "\n* i_id = " + i_id + "\n* i_name = " + i_name
47 | + "\n* i_price = " + i_price + "\n* i_data = " + i_data
48 | + "\n* i_im_id = " + i_im_id + "\n**********************************************");
49 | }
50 |
51 | } // end Item
52 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/pojo/Nation.java:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************************
3 | * Copyright 2015 by OLTPBenchmark Project *
4 | * *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); *
6 | * you may not use this file except in compliance with the License. *
7 | * You may obtain a copy of the License at *
8 | * *
9 | * http://www.apache.org/licenses/LICENSE-2.0 *
10 | * *
11 | * Unless required by applicable law or agreed to in writing, software *
12 | * distributed under the License is distributed on an "AS IS" BASIS, *
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 | * See the License for the specific language governing permissions and *
15 | * limitations under the License. *
16 | ******************************************************************************
17 | /*
18 | * Copyright 2017 by INESC TEC
19 | * This work was based on the OLTPBenchmark Project
20 | *
21 | * Licensed under the Apache License, Version 2.0 (the "License");
22 | * you may not use this file except in compliance with the License.
23 | * You may obtain a copy of the License at
24 | *
25 | * http://www.apache.org/licenses/LICENSE-2.0
26 | *
27 | * Unless required by applicable law or agreed to in writing, software
28 | * distributed under the License is distributed on an "AS IS" BASIS,
29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 | * See the License for the specific language governing permissions and
31 | * limitations under the License.
32 | */
33 | package pt.haslab.htapbench.pojo;
34 |
35 | public class Nation {
36 |
37 | public int n_nationkey; // PRIMARY KEY
38 | public String n_name;
39 | public int n_regionkey;
40 | public String n_comment;
41 |
42 | @Override
43 | public String toString() {
44 | return ("\n***************** Nation ********************"
45 | + "\n* n_nationkey = " + n_nationkey + "\n* n_name = " + n_name
46 | + "\n* n_regionkey = " + n_regionkey + "\n* n_comment = " + n_comment
47 | + "\n**********************************************");
48 | }
49 |
50 | } // end Nation
51 |
52 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/pojo/NewOrder.java:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************************
3 | * Copyright 2015 by OLTPBenchmark Project *
4 | * *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); *
6 | * you may not use this file except in compliance with the License. *
7 | * You may obtain a copy of the License at *
8 | * *
9 | * http://www.apache.org/licenses/LICENSE-2.0 *
10 | * *
11 | * Unless required by applicable law or agreed to in writing, software *
12 | * distributed under the License is distributed on an "AS IS" BASIS, *
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 | * See the License for the specific language governing permissions and *
15 | * limitations under the License. *
16 | ******************************************************************************
17 | /*
18 | * Copyright 2017 by INESC TEC
19 | * This work was based on the OLTPBenchmark Project
20 | *
21 | * Licensed under the Apache License, Version 2.0 (the "License");
22 | * you may not use this file except in compliance with the License.
23 | * You may obtain a copy of the License at
24 | *
25 | * http://www.apache.org/licenses/LICENSE-2.0
26 | *
27 | * Unless required by applicable law or agreed to in writing, software
28 | * distributed under the License is distributed on an "AS IS" BASIS,
29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 | * See the License for the specific language governing permissions and
31 | * limitations under the License.
32 | */
33 | package pt.haslab.htapbench.pojo;
34 |
35 | import java.io.Serializable;
36 |
37 | public class NewOrder implements Serializable {
38 |
39 | public int no_w_id;
40 | public int no_d_id;
41 | public int no_o_id;
42 |
43 | @Override
44 | public String toString() {
45 | return ("\n***************** NewOrder ********************"
46 | + "\n* no_w_id = " + no_w_id + "\n* no_d_id = "
47 | + no_d_id + "\n* no_o_id = " + no_o_id + "\n**********************************************");
48 | }
49 |
50 | } // end NewOrder
51 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/pojo/Oorder.java:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************************
3 | * Copyright 2015 by OLTPBenchmark Project *
4 | * *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); *
6 | * you may not use this file except in compliance with the License. *
7 | * You may obtain a copy of the License at *
8 | * *
9 | * http://www.apache.org/licenses/LICENSE-2.0 *
10 | * *
11 | * Unless required by applicable law or agreed to in writing, software *
12 | * distributed under the License is distributed on an "AS IS" BASIS, *
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 | * See the License for the specific language governing permissions and *
15 | * limitations under the License. *
16 | ******************************************************************************
17 | /*
18 | * Copyright 2017 by INESC TEC
19 | * This work was based on the OLTPBenchmark Project
20 | *
21 | * Licensed under the Apache License, Version 2.0 (the "License");
22 | * you may not use this file except in compliance with the License.
23 | * You may obtain a copy of the License at
24 | *
25 | * http://www.apache.org/licenses/LICENSE-2.0
26 | *
27 | * Unless required by applicable law or agreed to in writing, software
28 | * distributed under the License is distributed on an "AS IS" BASIS,
29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 | * See the License for the specific language governing permissions and
31 | * limitations under the License.
32 | */
33 | package pt.haslab.htapbench.pojo;
34 |
35 | public class Oorder {
36 |
37 | public int o_id;
38 | public int o_w_id;
39 | public int o_d_id;
40 | public int o_c_id;
41 | public Integer o_carrier_id;
42 | public int o_ol_cnt;
43 | public int o_all_local;
44 | public long o_entry_d;
45 |
46 | @Override
47 | public String toString() {
48 | java.sql.Timestamp entry_d = new java.sql.Timestamp(o_entry_d);
49 |
50 | return ("\n***************** Oorder ********************"
51 | + "\n* o_id = " + o_id + "\n* o_w_id = " + o_w_id
52 | + "\n* o_d_id = " + o_d_id + "\n* o_c_id = "
53 | + o_c_id + "\n* o_carrier_id = " + o_carrier_id
54 | + "\n* o_ol_cnt = " + o_ol_cnt + "\n* o_all_local = "
55 | + o_all_local + "\n* o_entry_d = " + entry_d + "\n**********************************************");
56 | }
57 |
58 | } // end Oorder
59 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/pojo/OrderLine.java:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************************
3 | * Copyright 2015 by OLTPBenchmark Project *
4 | * *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); *
6 | * you may not use this file except in compliance with the License. *
7 | * You may obtain a copy of the License at *
8 | * *
9 | * http://www.apache.org/licenses/LICENSE-2.0 *
10 | * *
11 | * Unless required by applicable law or agreed to in writing, software *
12 | * distributed under the License is distributed on an "AS IS" BASIS, *
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 | * See the License for the specific language governing permissions and *
15 | * limitations under the License. *
16 | ******************************************************************************
17 | /*
18 | * Copyright 2017 by INESC TEC
19 | * This work was based on the OLTPBenchmark Project
20 | *
21 | * Licensed under the Apache License, Version 2.0 (the "License");
22 | * you may not use this file except in compliance with the License.
23 | * You may obtain a copy of the License at
24 | *
25 | * http://www.apache.org/licenses/LICENSE-2.0
26 | *
27 | * Unless required by applicable law or agreed to in writing, software
28 | * distributed under the License is distributed on an "AS IS" BASIS,
29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 | * See the License for the specific language governing permissions and
31 | * limitations under the License.
32 | */
33 | package pt.haslab.htapbench.pojo;
34 |
35 | public class OrderLine {
36 |
37 | public int ol_w_id;
38 | public int ol_d_id;
39 | public int ol_o_id;
40 | public int ol_number;
41 | public int ol_i_id;
42 | public int ol_supply_w_id;
43 | public int ol_quantity;
44 | public Long ol_delivery_d;
45 | public float ol_amount;
46 | public String ol_dist_info;
47 |
48 | @Override
49 | public String toString() {
50 | return ("\n***************** OrderLine ********************"
51 | + "\n* ol_w_id = " + ol_w_id + "\n* ol_d_id = "
52 | + ol_d_id + "\n* ol_o_id = " + ol_o_id
53 | + "\n* ol_number = " + ol_number + "\n* ol_i_id = "
54 | + ol_i_id + "\n* ol_delivery_d = " + ol_delivery_d
55 | + "\n* ol_amount = " + ol_amount + "\n* ol_supply_w_id = "
56 | + ol_supply_w_id + "\n* ol_quantity = " + ol_quantity
57 | + "\n* ol_dist_info = " + ol_dist_info + "\n**********************************************");
58 | }
59 |
60 | } // end OrderLine
61 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/pojo/Region.java:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************************
3 | * Copyright 2015 by OLTPBenchmark Project *
4 | * *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); *
6 | * you may not use this file except in compliance with the License. *
7 | * You may obtain a copy of the License at *
8 | * *
9 | * http://www.apache.org/licenses/LICENSE-2.0 *
10 | * *
11 | * Unless required by applicable law or agreed to in writing, software *
12 | * distributed under the License is distributed on an "AS IS" BASIS, *
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 | * See the License for the specific language governing permissions and *
15 | * limitations under the License. *
16 | ******************************************************************************
17 | /*
18 | * Copyright 2017 by INESC TEC
19 | * This work was based on the OLTPBenchmark Project
20 | *
21 | * Licensed under the Apache License, Version 2.0 (the "License");
22 | * you may not use this file except in compliance with the License.
23 | * You may obtain a copy of the License at
24 | *
25 | * http://www.apache.org/licenses/LICENSE-2.0
26 | *
27 | * Unless required by applicable law or agreed to in writing, software
28 | * distributed under the License is distributed on an "AS IS" BASIS,
29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 | * See the License for the specific language governing permissions and
31 | * limitations under the License.
32 | */
33 | package pt.haslab.htapbench.pojo;
34 |
35 | public class Region {
36 |
37 | public int r_regionkey; // PRIMARY KEY
38 | public String r_name;
39 | public String r_comment;
40 |
41 | @Override
42 | public String toString() {
43 | return ("\n***************** Region ********************"
44 | + "\n* r_regionkey = " + r_regionkey + "\n* r_name = " + r_name
45 | + "\n* r_comment = " + r_comment + "\n**********************************************");
46 | }
47 |
48 | } // end Region
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/pojo/Stock.java:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************************
3 | * Copyright 2015 by OLTPBenchmark Project *
4 | * *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); *
6 | * you may not use this file except in compliance with the License. *
7 | * You may obtain a copy of the License at *
8 | * *
9 | * http://www.apache.org/licenses/LICENSE-2.0 *
10 | * *
11 | * Unless required by applicable law or agreed to in writing, software *
12 | * distributed under the License is distributed on an "AS IS" BASIS, *
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 | * See the License for the specific language governing permissions and *
15 | * limitations under the License. *
16 | ******************************************************************************
17 | /*
18 | * Copyright 2017 by INESC TEC
19 | * This work was based on the OLTPBenchmark Project
20 | *
21 | * Licensed under the Apache License, Version 2.0 (the "License");
22 | * you may not use this file except in compliance with the License.
23 | * You may obtain a copy of the License at
24 | *
25 | * http://www.apache.org/licenses/LICENSE-2.0
26 | *
27 | * Unless required by applicable law or agreed to in writing, software
28 | * distributed under the License is distributed on an "AS IS" BASIS,
29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 | * See the License for the specific language governing permissions and
31 | * limitations under the License.
32 | */
33 | package pt.haslab.htapbench.pojo;
34 |
35 | import java.io.Serializable;
36 |
37 | public class Stock implements Serializable {
38 |
39 | public int s_i_id; // PRIMARY KEY 2
40 | public int s_w_id; // PRIMARY KEY 1
41 | public int s_order_cnt;
42 | public int s_remote_cnt;
43 | public int s_quantity;
44 | public float s_ytd;
45 | public String s_data;
46 | public String s_dist_01;
47 | public String s_dist_02;
48 | public String s_dist_03;
49 | public String s_dist_04;
50 | public String s_dist_05;
51 | public String s_dist_06;
52 | public String s_dist_07;
53 | public String s_dist_08;
54 | public String s_dist_09;
55 | public String s_dist_10;
56 |
57 | @Override
58 | public String toString() {
59 | return (
60 |
61 | "\n***************** Stock ********************"
62 | + "\n* s_i_id = "
63 | + s_i_id
64 | + "\n* s_w_id = "
65 | + s_w_id
66 | + "\n* s_quantity = "
67 | + s_quantity
68 | + "\n* s_ytd = "
69 | + s_ytd
70 | + "\n* s_order_cnt = "
71 | + s_order_cnt
72 | + "\n* s_remote_cnt = "
73 | + s_remote_cnt
74 | + "\n* s_data = "
75 | + s_data
76 | + "\n* s_dist_01 = "
77 | + s_dist_01
78 | + "\n* s_dist_02 = "
79 | + s_dist_02
80 | + "\n* s_dist_03 = "
81 | + s_dist_03
82 | + "\n* s_dist_04 = "
83 | + s_dist_04
84 | + "\n* s_dist_05 = "
85 | + s_dist_05
86 | + "\n* s_dist_06 = "
87 | + s_dist_06
88 | + "\n* s_dist_07 = "
89 | + s_dist_07
90 | + "\n* s_dist_08 = "
91 | + s_dist_08
92 | + "\n* s_dist_09 = "
93 | + s_dist_09 + "\n* s_dist_10 = " + s_dist_10 + "\n**********************************************");
94 | }
95 |
96 | } // end Stock
97 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/pojo/Supplier.java:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************************
3 | * Copyright 2015 by OLTPBenchmark Project *
4 | * *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); *
6 | * you may not use this file except in compliance with the License. *
7 | * You may obtain a copy of the License at *
8 | * *
9 | * http://www.apache.org/licenses/LICENSE-2.0 *
10 | * *
11 | * Unless required by applicable law or agreed to in writing, software *
12 | * distributed under the License is distributed on an "AS IS" BASIS, *
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 | * See the License for the specific language governing permissions and *
15 | * limitations under the License. *
16 | ******************************************************************************
17 | /*
18 | * Copyright 2017 by INESC TEC
19 | * This work was based on the OLTPBenchmark Project
20 | *
21 | * Licensed under the Apache License, Version 2.0 (the "License");
22 | * you may not use this file except in compliance with the License.
23 | * You may obtain a copy of the License at
24 | *
25 | * http://www.apache.org/licenses/LICENSE-2.0
26 | *
27 | * Unless required by applicable law or agreed to in writing, software
28 | * distributed under the License is distributed on an "AS IS" BASIS,
29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 | * See the License for the specific language governing permissions and
31 | * limitations under the License.
32 | */
33 | package pt.haslab.htapbench.pojo;
34 |
35 | public class Supplier {
36 |
37 | public int su_suppkey; // PRIMARY KEY
38 | public String su_name;
39 | public String su_address;
40 | public int su_nationkey;
41 | public String su_phone;
42 | public double su_acctbal;
43 | public String su_comment;
44 |
45 | @Override
46 | public String toString() {
47 | return ("\n***************** Supplier ********************"
48 | + "\n* su_suppkey = " + su_suppkey + "\n* su_name = " + su_name
49 | + "\n* su_address = " + su_address + "\n* su_nationkey = " + su_nationkey
50 | + "\n* su_phone = " + su_phone + "\n* su_acctbal = " + su_acctbal
51 | + "\n* su_comment = " + su_comment + "\n**********************************************");
52 | }
53 |
54 | } // end Supplier
55 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/pojo/Warehouse.java:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************************
3 | * Copyright 2015 by OLTPBenchmark Project *
4 | * *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); *
6 | * you may not use this file except in compliance with the License. *
7 | * You may obtain a copy of the License at *
8 | * *
9 | * http://www.apache.org/licenses/LICENSE-2.0 *
10 | * *
11 | * Unless required by applicable law or agreed to in writing, software *
12 | * distributed under the License is distributed on an "AS IS" BASIS, *
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 | * See the License for the specific language governing permissions and *
15 | * limitations under the License. *
16 | ******************************************************************************
17 | /*
18 | * Copyright 2017 by INESC TEC
19 | * This work was based on the OLTPBenchmark Project
20 | *
21 | * Licensed under the Apache License, Version 2.0 (the "License");
22 | * you may not use this file except in compliance with the License.
23 | * You may obtain a copy of the License at
24 | *
25 | * http://www.apache.org/licenses/LICENSE-2.0
26 | *
27 | * Unless required by applicable law or agreed to in writing, software
28 | * distributed under the License is distributed on an "AS IS" BASIS,
29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 | * See the License for the specific language governing permissions and
31 | * limitations under the License.
32 | */
33 | package pt.haslab.htapbench.pojo;
34 |
35 | import java.io.Serializable;
36 |
37 | public class Warehouse implements Serializable {
38 |
39 | public int w_id; // PRIMARY KEY
40 | public float w_ytd;
41 | public double w_tax;
42 | public String w_name;
43 | public String w_street_1;
44 | public String w_street_2;
45 | public String w_city;
46 | public String w_state;
47 | public String w_zip;
48 |
49 | @Override
50 | public String toString() {
51 | return ("\n***************** Warehouse ********************"
52 | + "\n* w_id = " + w_id + "\n* w_ytd = " + w_ytd
53 | + "\n* w_tax = " + w_tax + "\n* w_name = " + w_name
54 | + "\n* w_street_1 = " + w_street_1 + "\n* w_street_2 = "
55 | + w_street_2 + "\n* w_city = " + w_city
56 | + "\n* w_state = " + w_state + "\n* w_zip = " + w_zip + "\n**********************************************");
57 | }
58 |
59 | } // end Warehouse
60 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/procedures/tpcc/TPCCProcedure.java:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************************
3 | * Copyright 2015 by OLTPBenchmark Project *
4 | * *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); *
6 | * you may not use this file except in compliance with the License. *
7 | * You may obtain a copy of the License at *
8 | * *
9 | * http://www.apache.org/licenses/LICENSE-2.0 *
10 | * *
11 | * Unless required by applicable law or agreed to in writing, software *
12 | * distributed under the License is distributed on an "AS IS" BASIS, *
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 | * See the License for the specific language governing permissions and *
15 | * limitations under the License. *
16 | ******************************************************************************
17 | /*
18 | * Copyright 2017 by INESC TEC
19 | * This work was based on the OLTPBenchmark Project
20 | *
21 | * Licensed under the Apache License, Version 2.0 (the "License");
22 | * you may not use this file except in compliance with the License.
23 | * You may obtain a copy of the License at
24 | *
25 | * http://www.apache.org/licenses/LICENSE-2.0
26 | *
27 | * Unless required by applicable law or agreed to in writing, software
28 | * distributed under the License is distributed on an "AS IS" BASIS,
29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 | * See the License for the specific language governing permissions and
31 | * limitations under the License.
32 | */
33 | package pt.haslab.htapbench.procedures.tpcc;
34 |
35 | import java.sql.Connection;
36 | import java.sql.ResultSet;
37 | import java.sql.SQLException;
38 | import java.util.Random;
39 | import pt.haslab.htapbench.api.Procedure;
40 | import pt.haslab.htapbench.benchmark.TPCCWorker;
41 |
42 |
43 | public abstract class TPCCProcedure extends Procedure {
44 |
45 | public abstract ResultSet run(Connection conn, Random gen,
46 | int terminalWarehouseID, int numWarehouses,
47 | int terminalDistrictLowerID, int terminalDistrictUpperID,
48 | TPCCWorker w) throws SQLException;
49 |
50 | public abstract long getKeyingTime();
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/procedures/tpcc/extract_queries.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """
3 | Extracts SQL queries from java files.
4 |
5 | @author: alendit
6 | """
7 | import re
8 | import sqlparse
9 |
10 | if __name__ == "__main__":
11 | for x in xrange(1, 23):
12 | with open("Q{0}.java".format(x), "r") as java_file:
13 | with open("query{0}.sql".format(x), "w") as query_file:
14 | sql = "".join(re.findall('\"(.*?)\"', java_file.read()))
15 | sql = sql.replace("\\n", " ")
16 | sql = sql.replace("\t", "")
17 | sql = sqlparse.format(sql, reindent=True, keyword_case='upper')
18 | query_file.write(sql)
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/procedures/tpcc/gen_class.py:
--------------------------------------------------------------------------------
1 | def split_string(s, n=40):
2 | ss = []
3 | for i in xrange(0, len(s), n):
4 | ss.append('"{0}"'.format(s[i:i+n]))
5 | return ("\n" + " " * 30 + "+ ").join(ss)
6 |
7 | template = '''package com.oltpbenchmark.benchmarks.chbenchmark.queries;
8 |
9 | import com.oltpbenchmark.api.SQLStmt;
10 |
11 | public class Q{1} extends GenericQuery {{
12 |
13 | @Override
14 | protected SQLStmt getStmtSQL() {{
15 | return new SQLStmt(
16 | "{0}"
17 | );
18 | }}
19 | }}
20 | '''
21 |
22 | if __name__ == '__main__':
23 | for q in xrange(2, 23):
24 | with open("q{0}.txt".format(q), 'r') as f:
25 | with open("Q{0}.java".format(q), 'w') as cf:
26 | cf.write(template.format(f.read().replace("\n", '"\n + "'), q))
27 |
28 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/procedures/tpcc/gen_worker.py:
--------------------------------------------------------------------------------
1 | template = '''else if (nextTransaction.getProcedureClass().equals(Q{0}.class)) {{
2 | Q{0} proc = (Q{0}) this.getProcedure(Q{0}.class);
3 | proc.run(conn, gen, terminalWarehouseID, numWarehouses,
4 | terminalDistrictLowerID, terminalDistrictUpperID, this);
5 | }}'''
6 |
7 | with open("worker.txt", 'w') as f:
8 | with open("import.txt", "w") as fi:
9 |
10 | for x in xrange(2, 23):
11 | print >> f, template.format(x),
12 | print >> fi, "import com.oltpbenchmark.benchmarks.chbenchmark.queries.Q{0};".format(x)
13 |
14 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/procedures/tpcc/generate_classes.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """
3 | Generates query java class stubs to load sql.
4 |
5 | @author: breilly, alendit
6 | """
7 | import re;
8 | ############################################################
9 | # Routine for cleaning up SQL and formatting it nicely
10 | ############################################################
11 | def prettyprint_sql(sql_filename, out_file):
12 | with open(sql_filename, "r") as sql_file:
13 | query = [line.rstrip('\n') for line in sql_file];
14 | out_file.write('"' + re.sub(r'(\+ )"( *)', r'\1\2"', ' "\n + \"'.join(query).rstrip(';').replace(' ', ' ') + '"'));
15 |
16 |
17 | ############################################################
18 | # Template for most queries
19 | ############################################################
20 | template_start = """package com.oltpbenchmark.benchmarks.chbenchmark.queries;
21 |
22 | import com.oltpbenchmark.api.SQLStmt;
23 |
24 | public class Q{0} extends GenericQuery {{
25 |
26 | public final SQLStmt query_stmt = new SQLStmt(
27 | """
28 |
29 | template_finish = """
30 | );
31 |
32 | protected SQLStmt get_query() {
33 | return query_stmt;
34 | }
35 | }
36 | """
37 |
38 | for x in xrange(0, 22):
39 | with open("Q{0}.java".format(x+1), "w") as java_file:
40 | java_file.write(template_start.format(x+1))
41 | prettyprint_sql("query{0}.sql".format(x+1), java_file);
42 | java_file.write(template_finish)
43 |
44 | ############################################################
45 | # Template for query 15
46 | ############################################################
47 |
48 | q15_header = """package com.oltpbenchmark.benchmarks.chbenchmark.queries;
49 |
50 | import com.oltpbenchmark.api.SQLStmt;
51 | import java.sql.Connection;
52 | import java.sql.ResultSet;
53 | import java.sql.Statement;
54 | import java.sql.SQLException;
55 |
56 | public class Q15 extends GenericQuery {
57 |
58 | public final SQLStmt createview_stmt = new SQLStmt(
59 | """
60 |
61 | q15_mid1 = """
62 | );
63 |
64 | public final SQLStmt query_stmt = new SQLStmt (
65 | """
66 |
67 | q15_mid2 = """
68 | );
69 |
70 | public final SQLStmt dropview_stmt = new SQLStmt(
71 | """
72 |
73 | q15_footer = """
74 | );
75 |
76 | protected SQLStmt get_query() {
77 | return query_stmt;
78 | }
79 |
80 | public ResultSet run(Connection conn) throws SQLException {
81 | // With this query, we have to set up a view before we execute the
82 | // query, then drop it once we're done.
83 | Statement stmt = conn.createStatement();
84 | ResultSet ret = null;
85 | try {
86 | stmt.executeUpdate(createview_stmt.getSQL());
87 | ret = super.run(conn);
88 | } finally {
89 | stmt.executeUpdate(dropview_stmt.getSQL());
90 | }
91 |
92 | return ret;
93 | }
94 | }
95 | """
96 |
97 | with open("Q15.java", "w") as q15_file:
98 | q15_file.write(q15_header);
99 | prettyprint_sql("query15-create-view.sql", q15_file);
100 | q15_file.write(q15_mid1);
101 | prettyprint_sql("query15.sql", q15_file);
102 | q15_file.write(q15_mid2);
103 | prettyprint_sql("query15-drop-view.sql", q15_file);
104 | q15_file.write(q15_footer);
105 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/procedures/tpcc/get_queries.py:
--------------------------------------------------------------------------------
1 | for num, pre in enumerate(hxs.select('//pre[span[contains(text(), "select")]]')):
2 | with open("q{0}.txt".format(num + 1), "w") as q:
3 | print >>q, " ".join(pre.select(".//text()").extract())
4 |
5 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/procedures/tpch/Q1.java:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************************
3 | * Copyright 2015 by OLTPBenchmark Project *
4 | * *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); *
6 | * you may not use this file except in compliance with the License. *
7 | * You may obtain a copy of the License at *
8 | * *
9 | * http://www.apache.org/licenses/LICENSE-2.0 *
10 | * *
11 | * Unless required by applicable law or agreed to in writing, software *
12 | * distributed under the License is distributed on an "AS IS" BASIS, *
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 | * See the License for the specific language governing permissions and *
15 | * limitations under the License. *
16 | ******************************************************************************
17 | /*
18 | * Copyright 2017 by INESC TEC
19 | * This work was based on the OLTPBenchmark Project
20 | *
21 | * Licensed under the Apache License, Version 2.0 (the "License");
22 | * you may not use this file except in compliance with the License.
23 | * You may obtain a copy of the License at
24 | *
25 | * http://www.apache.org/licenses/LICENSE-2.0
26 | *
27 | * Unless required by applicable law or agreed to in writing, software
28 | * distributed under the License is distributed on an "AS IS" BASIS,
29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 | * See the License for the specific language governing permissions and
31 | * limitations under the License.
32 | */
33 | package pt.haslab.htapbench.procedures.tpch;
34 |
35 | import pt.haslab.htapbench.core.WorkloadConfiguration;
36 | import pt.haslab.htapbench.api.SQLStmt;
37 | import pt.haslab.htapbench.benchmark.HTAPBConstants;
38 | import pt.haslab.htapbench.densitity.Clock;
39 | import pt.haslab.htapbench.random.RandomParameters;
40 | import java.sql.Timestamp;
41 |
42 | public class Q1 extends GenericQuery {
43 |
44 | private SQLStmt buildQueryStmt(Clock clock){
45 | //compute random number of days [60,120]
46 | int days = RandomParameters.randBetween(60, 120);
47 | //transform tpch into the correct TS in our populate.
48 | long tpch = clock.getCurrentTs();
49 | //compute the correct TS considering the delay
50 | long ts_plusXdays = clock.computeTsMinusXDays(tpch, days);
51 | Timestamp ts = new Timestamp(clock.transformTsFromSpecToLong(ts_plusXdays));
52 |
53 | String query = "SELECT ol_number, "
54 | + "sum(ol_quantity) AS sum_qty, "
55 | + "sum(ol_amount) AS sum_amount, "
56 | + "avg(ol_quantity) AS avg_qty, "
57 | + "avg(ol_amount) AS avg_amount, "
58 | + "count(*) AS count_order "
59 | + "FROM "+ HTAPBConstants.TABLENAME_ORDERLINE
60 | + " WHERE ol_delivery_d > '"
61 | + ts.toString()
62 | + "' GROUP BY ol_number "
63 | + "ORDER BY ol_number";
64 | return new SQLStmt(query);
65 | }
66 |
67 | @Override
68 | protected SQLStmt get_query(Clock clock,WorkloadConfiguration wrklConf) {
69 | return buildQueryStmt(clock);
70 | }
71 |
72 |
73 | }
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/procedures/tpch/Q13.java:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************************
3 | * Copyright 2015 by OLTPBenchmark Project *
4 | * *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); *
6 | * you may not use this file except in compliance with the License. *
7 | * You may obtain a copy of the License at *
8 | * *
9 | * http://www.apache.org/licenses/LICENSE-2.0 *
10 | * *
11 | * Unless required by applicable law or agreed to in writing, software *
12 | * distributed under the License is distributed on an "AS IS" BASIS, *
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 | * See the License for the specific language governing permissions and *
15 | * limitations under the License. *
16 | ******************************************************************************
17 | /*
18 | * Copyright 2017 by INESC TEC
19 | * This work was based on the OLTPBenchmark Project
20 | *
21 | * Licensed under the Apache License, Version 2.0 (the "License");
22 | * you may not use this file except in compliance with the License.
23 | * You may obtain a copy of the License at
24 | *
25 | * http://www.apache.org/licenses/LICENSE-2.0
26 | *
27 | * Unless required by applicable law or agreed to in writing, software
28 | * distributed under the License is distributed on an "AS IS" BASIS,
29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 | * See the License for the specific language governing permissions and
31 | * limitations under the License.
32 | */
33 | package pt.haslab.htapbench.procedures.tpch;
34 |
35 | import pt.haslab.htapbench.core.WorkloadConfiguration;
36 | import pt.haslab.htapbench.api.SQLStmt;
37 | import pt.haslab.htapbench.benchmark.HTAPBConstants;
38 | import pt.haslab.htapbench.densitity.Clock;
39 | import pt.haslab.htapbench.random.RandomParameters;
40 |
41 | public class Q13 extends GenericQuery {
42 |
43 | private SQLStmt buildQueryStmt(){
44 | String id = ""+RandomParameters.randBetween(1, 10);
45 |
46 | String query = "SELECT c_count, "
47 | + "count(*) AS custdist "
48 | + "FROM "
49 | + "(SELECT c_id, "
50 | + "count(o_id) AS c_count "
51 | + "FROM " + HTAPBConstants.TABLENAME_CUSTOMER
52 | + " LEFT OUTER JOIN "+HTAPBConstants.TABLENAME_ORDER+" ON (c_w_id = o_w_id "
53 | + "AND c_d_id = o_d_id "
54 | + "AND c_id = o_c_id "
55 | + "AND o_carrier_id > "+id+") "
56 | + "GROUP BY c_id) AS c_orders "
57 | + "GROUP BY c_count "
58 | + "ORDER BY custdist DESC, c_count DESC";
59 | return new SQLStmt(query);
60 | }
61 | @Override
62 | protected SQLStmt get_query(Clock clock,WorkloadConfiguration wrklConf) {
63 | return buildQueryStmt();
64 | }
65 | }
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/procedures/tpch/Q14.java:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************************
3 | * Copyright 2015 by OLTPBenchmark Project *
4 | * *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); *
6 | * you may not use this file except in compliance with the License. *
7 | * You may obtain a copy of the License at *
8 | * *
9 | * http://www.apache.org/licenses/LICENSE-2.0 *
10 | * *
11 | * Unless required by applicable law or agreed to in writing, software *
12 | * distributed under the License is distributed on an "AS IS" BASIS, *
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 | * See the License for the specific language governing permissions and *
15 | * limitations under the License. *
16 | ******************************************************************************
17 | /*
18 | * Copyright 2017 by INESC TEC
19 | * This work was based on the OLTPBenchmark Project
20 | *
21 | * Licensed under the Apache License, Version 2.0 (the "License");
22 | * you may not use this file except in compliance with the License.
23 | * You may obtain a copy of the License at
24 | *
25 | * http://www.apache.org/licenses/LICENSE-2.0
26 | *
27 | * Unless required by applicable law or agreed to in writing, software
28 | * distributed under the License is distributed on an "AS IS" BASIS,
29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 | * See the License for the specific language governing permissions and
31 | * limitations under the License.
32 | */
33 | package pt.haslab.htapbench.procedures.tpch;
34 |
35 | import pt.haslab.htapbench.core.WorkloadConfiguration;
36 | import pt.haslab.htapbench.api.SQLStmt;
37 | import pt.haslab.htapbench.benchmark.HTAPBConstants;
38 | import pt.haslab.htapbench.densitity.Clock;
39 | import pt.haslab.htapbench.random.RandomParameters;
40 | import java.sql.Timestamp;
41 |
42 | public class Q14 extends GenericQuery {
43 |
44 | private SQLStmt buildQueryStmt(Clock clock){
45 | int year = RandomParameters.randBetween(1993, 1997);
46 | int month = RandomParameters.randBetween(1, 12);
47 | long date1 = RandomParameters.convertDatetoLong(year, month, 1);
48 | long date2 = RandomParameters.convertDatetoLong(year+1, month, 1);
49 | Timestamp ts1 = new Timestamp(clock.transformTsFromSpecToLong(date1));
50 | Timestamp ts2 = new Timestamp(clock.transformTsFromSpecToLong(date2));
51 |
52 | String query = "SELECT (100.00 * sum(CASE WHEN i_data LIKE 'PR%' THEN ol_amount ELSE 0 END) / (1 + sum(ol_amount))) AS promo_revenue "
53 | + "FROM "
54 | + HTAPBConstants.TABLENAME_ORDERLINE + ", "
55 | + HTAPBConstants.TABLENAME_ITEM
56 | + " WHERE ol_i_id = i_id "
57 | + "AND ol_delivery_d >= '"+ts1.toString()+"' "
58 | + "AND ol_delivery_d < '"+ts2.toString()+"'";
59 | return new SQLStmt(query);
60 | }
61 |
62 | /**
63 | *
64 | * @param clock
65 | * @param wrklConf
66 | * @return
67 | */
68 | @Override
69 | protected SQLStmt get_query(Clock clock,WorkloadConfiguration wrklConf) {
70 | return buildQueryStmt(clock);
71 | }
72 | }
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/procedures/tpch/Q17.java:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************************
3 | * Copyright 2015 by OLTPBenchmark Project *
4 | * *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); *
6 | * you may not use this file except in compliance with the License. *
7 | * You may obtain a copy of the License at *
8 | * *
9 | * http://www.apache.org/licenses/LICENSE-2.0 *
10 | * *
11 | * Unless required by applicable law or agreed to in writing, software *
12 | * distributed under the License is distributed on an "AS IS" BASIS, *
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 | * See the License for the specific language governing permissions and *
15 | * limitations under the License. *
16 | ******************************************************************************
17 | /*
18 | * Copyright 2017 by INESC TEC
19 | * This work was based on the OLTPBenchmark Project
20 | *
21 | * Licensed under the Apache License, Version 2.0 (the "License");
22 | * you may not use this file except in compliance with the License.
23 | * You may obtain a copy of the License at
24 | *
25 | * http://www.apache.org/licenses/LICENSE-2.0
26 | *
27 | * Unless required by applicable law or agreed to in writing, software
28 | * distributed under the License is distributed on an "AS IS" BASIS,
29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 | * See the License for the specific language governing permissions and
31 | * limitations under the License.
32 | */
33 | package pt.haslab.htapbench.procedures.tpch;
34 |
35 | import pt.haslab.htapbench.core.WorkloadConfiguration;
36 | import pt.haslab.htapbench.api.SQLStmt;
37 | import pt.haslab.htapbench.benchmark.HTAPBConstants;
38 | import pt.haslab.htapbench.densitity.Clock;
39 | import pt.haslab.htapbench.random.RandomParameters;
40 |
41 | public class Q17 extends GenericQuery {
42 |
43 | private SQLStmt buildQueryStmt(){
44 | RandomParameters random = new RandomParameters("uniform");
45 | String st1 = "%"+random.generateRandomCharacter();
46 |
47 | String query = "SELECT SUM(ol_amount) / 2.0 AS avg_yearly "
48 | + "FROM "+ HTAPBConstants.TABLENAME_ORDERLINE + ", "
49 | + "(SELECT i_id, AVG (ol_quantity) AS a "
50 | + "FROM "
51 | + HTAPBConstants.TABLENAME_ITEM + ", "
52 | + HTAPBConstants.TABLENAME_ORDERLINE
53 | + " WHERE i_data LIKE '"+st1+"' "
54 | + "AND ol_i_id = i_id "
55 | + "GROUP BY i_id) t "
56 | + "WHERE ol_i_id = t.i_id "
57 | + "AND ol_quantity < t.a";
58 | return new SQLStmt(query);
59 | }
60 |
61 | /**
62 | *
63 | * @param clock
64 | * @param wrklConf
65 | * @return
66 | */
67 | @Override
68 | protected SQLStmt get_query(Clock clock,WorkloadConfiguration wrklConf) {
69 | return buildQueryStmt();
70 | }
71 | }
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/procedures/tpch/Q18.java:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************************
3 | * Copyright 2015 by OLTPBenchmark Project *
4 | * *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); *
6 | * you may not use this file except in compliance with the License. *
7 | * You may obtain a copy of the License at *
8 | * *
9 | * http://www.apache.org/licenses/LICENSE-2.0 *
10 | * *
11 | * Unless required by applicable law or agreed to in writing, software *
12 | * distributed under the License is distributed on an "AS IS" BASIS, *
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 | * See the License for the specific language governing permissions and *
15 | * limitations under the License. *
16 | ******************************************************************************
17 | /*
18 | * Copyright 2017 by INESC TEC
19 | * This work was based on the OLTPBenchmark Project
20 | *
21 | * Licensed under the Apache License, Version 2.0 (the "License");
22 | * you may not use this file except in compliance with the License.
23 | * You may obtain a copy of the License at
24 | *
25 | * http://www.apache.org/licenses/LICENSE-2.0
26 | *
27 | * Unless required by applicable law or agreed to in writing, software
28 | * distributed under the License is distributed on an "AS IS" BASIS,
29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 | * See the License for the specific language governing permissions and
31 | * limitations under the License.
32 | */
33 | package pt.haslab.htapbench.procedures.tpch;
34 |
35 | import pt.haslab.htapbench.core.WorkloadConfiguration;
36 | import pt.haslab.htapbench.api.SQLStmt;
37 | import pt.haslab.htapbench.benchmark.HTAPBConstants;
38 | import pt.haslab.htapbench.densitity.Clock;
39 | import pt.haslab.htapbench.random.RandomParameters;
40 |
41 | public class Q18 extends GenericQuery {
42 |
43 | private SQLStmt buildQueryStmt(){
44 | String amount = ""+ RandomParameters.randDoubleBetween(312, 315);
45 |
46 | String query = "SELECT c_last, "
47 | + "c_id, "
48 | + "o_id, "
49 | + "o_entry_d, "
50 | + "o_ol_cnt, "
51 | + "sum(ol_amount) AS amount_sum "
52 | + "FROM "
53 | + HTAPBConstants.TABLENAME_CUSTOMER + ", "
54 | + HTAPBConstants.TABLENAME_ORDER + ", "
55 | + HTAPBConstants.TABLENAME_ORDERLINE
56 | + " WHERE c_id = o_c_id "
57 | + "AND c_w_id = o_w_id "
58 | + "AND c_d_id = o_d_id "
59 | + "AND ol_w_id = o_w_id "
60 | + "AND ol_d_id = o_d_id "
61 | + "AND ol_o_id = o_id "
62 | + "GROUP BY o_id, "
63 | + "o_w_id, "
64 | + "o_d_id, "
65 | + "c_id, "
66 | + "c_last, "
67 | + "o_entry_d, "
68 | + "o_ol_cnt HAVING sum(ol_amount) > "+amount+" "
69 | + "ORDER BY amount_sum DESC, o_entry_d";
70 | return new SQLStmt(query);
71 | }
72 |
73 | /**
74 | *
75 | * @param clock
76 | * @param wrklConf
77 | * @return
78 | */
79 | @Override
80 | protected SQLStmt get_query(Clock clock,WorkloadConfiguration wrklConf) {
81 | return buildQueryStmt();
82 | }
83 | }
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/procedures/tpch/Q6.java:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************************
3 | * Copyright 2015 by OLTPBenchmark Project *
4 | * *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); *
6 | * you may not use this file except in compliance with the License. *
7 | * You may obtain a copy of the License at *
8 | * *
9 | * http://www.apache.org/licenses/LICENSE-2.0 *
10 | * *
11 | * Unless required by applicable law or agreed to in writing, software *
12 | * distributed under the License is distributed on an "AS IS" BASIS, *
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 | * See the License for the specific language governing permissions and *
15 | * limitations under the License. *
16 | ******************************************************************************
17 | /*
18 | * Copyright 2017 by INESC TEC
19 | * This work was based on the OLTPBenchmark Project
20 | *
21 | * Licensed under the Apache License, Version 2.0 (the "License");
22 | * you may not use this file except in compliance with the License.
23 | * You may obtain a copy of the License at
24 | *
25 | * http://www.apache.org/licenses/LICENSE-2.0
26 | *
27 | * Unless required by applicable law or agreed to in writing, software
28 | * distributed under the License is distributed on an "AS IS" BASIS,
29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 | * See the License for the specific language governing permissions and
31 | * limitations under the License.
32 | */
33 | package pt.haslab.htapbench.procedures.tpch;
34 |
35 | import pt.haslab.htapbench.core.WorkloadConfiguration;
36 | import pt.haslab.htapbench.api.SQLStmt;
37 | import pt.haslab.htapbench.benchmark.HTAPBConstants;
38 | import pt.haslab.htapbench.densitity.Clock;
39 | import pt.haslab.htapbench.random.RandomParameters;
40 | import java.sql.Timestamp;
41 |
42 | public class Q6 extends GenericQuery {
43 |
44 | private SQLStmt buildQueryStmt(Clock clock){
45 | String q1 = ""+RandomParameters.randBetween(1, 100000);
46 | String q2 = ""+RandomParameters.randBetween(1, 100000);
47 | int year = RandomParameters.randBetween(1993, 1997);
48 | long date1 = RandomParameters.convertDatetoLong(year, 1, 1);
49 | long date2 = RandomParameters.convertDatetoLong(year+1, 1, 1);
50 | Timestamp ts1 = new Timestamp(clock.transformTsFromSpecToLong(date1));
51 | Timestamp ts2 = new Timestamp(clock.transformTsFromSpecToLong(date2));
52 |
53 | String query = "SELECT sum(ol_amount) AS revenue "
54 | + "FROM "+HTAPBConstants.TABLENAME_ORDERLINE
55 | + " WHERE ol_delivery_d >= '"+ts1+"' "
56 | + "AND ol_delivery_d < '"+ts2+"' "
57 | + "AND ol_quantity BETWEEN "+q1+" AND "+q2;
58 | return new SQLStmt(query);
59 | }
60 |
61 | @Override
62 | protected SQLStmt get_query(Clock clock,WorkloadConfiguration wrklConf) {
63 | return buildQueryStmt(clock);
64 | }
65 | }
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/procedures/tpch/Q9.java:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************************
3 | * Copyright 2015 by OLTPBenchmark Project *
4 | * *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); *
6 | * you may not use this file except in compliance with the License. *
7 | * You may obtain a copy of the License at *
8 | * *
9 | * http://www.apache.org/licenses/LICENSE-2.0 *
10 | * *
11 | * Unless required by applicable law or agreed to in writing, software *
12 | * distributed under the License is distributed on an "AS IS" BASIS, *
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 | * See the License for the specific language governing permissions and *
15 | * limitations under the License. *
16 | ******************************************************************************
17 | /*
18 | * Copyright 2017 by INESC TEC
19 | * This work was based on the OLTPBenchmark Project
20 | *
21 | * Licensed under the Apache License, Version 2.0 (the "License");
22 | * you may not use this file except in compliance with the License.
23 | * You may obtain a copy of the License at
24 | *
25 | * http://www.apache.org/licenses/LICENSE-2.0
26 | *
27 | * Unless required by applicable law or agreed to in writing, software
28 | * distributed under the License is distributed on an "AS IS" BASIS,
29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 | * See the License for the specific language governing permissions and
31 | * limitations under the License.
32 | */
33 | package pt.haslab.htapbench.procedures.tpch;
34 |
35 | import pt.haslab.htapbench.core.WorkloadConfiguration;
36 | import pt.haslab.htapbench.api.SQLStmt;
37 | import pt.haslab.htapbench.benchmark.HTAPBConstants;
38 | import pt.haslab.htapbench.densitity.Clock;
39 | import pt.haslab.htapbench.random.RandomParameters;
40 |
41 | public class Q9 extends GenericQuery {
42 |
43 | private SQLStmt buildQueryStmt(){
44 | RandomParameters random = new RandomParameters("uniform");
45 | String st1 = random.generateRandomCharacter();
46 | String st2 = random.generateRandomCharacter();
47 | String data=st1.toUpperCase()+st2.toUpperCase();
48 | data = "%"+data;
49 |
50 | String query = "SELECT n_name, "
51 | + "sum(ol_amount) AS sum_profit "
52 | + "FROM "
53 | + HTAPBConstants.TABLENAME_ITEM + ", "
54 | + HTAPBConstants.TABLENAME_STOCK + ", "
55 | + HTAPBConstants.TABLENAME_SUPPLIER + ", "
56 | + HTAPBConstants.TABLENAME_ORDERLINE + ", "
57 | + HTAPBConstants.TABLENAME_ORDER + ", "
58 | + HTAPBConstants.TABLENAME_NATION
59 | + " WHERE ol_i_id = s_i_id "
60 | + "AND ol_supply_w_id = s_w_id "
61 | + "AND ol_w_id = o_w_id "
62 | + "AND ol_d_id = o_d_id "
63 | + "AND ol_o_id = o_id "
64 | + "AND ol_i_id = i_id "
65 | + "AND su_nationkey = n_nationkey "
66 | + "AND i_data LIKE '"+data+"' "
67 | + "GROUP BY n_name "
68 | + "ORDER BY n_name "
69 | + "DESC";
70 | return new SQLStmt(query);
71 | }
72 |
73 | @Override
74 | protected SQLStmt get_query(Clock clock,WorkloadConfiguration wrklConf) {
75 | return buildQueryStmt();
76 | }
77 | }
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/procedures/tpch/query1.sql:
--------------------------------------------------------------------------------
1 | SELECT ol_number,
2 | sum(ol_quantity) AS sum_qty,
3 | sum(ol_amount) AS sum_amount,
4 | avg(ol_quantity) AS avg_qty,
5 | avg(ol_amount) AS avg_amount,
6 | count(*) AS count_order
7 | FROM order_line
8 | WHERE ol_delivery_d > '2007-01-02 00:00:00.000000'
9 | GROUP BY ol_number
10 | ORDER BY ol_number;
11 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/procedures/tpch/query10.sql:
--------------------------------------------------------------------------------
1 | SELECT c_id,
2 | c_last,
3 | sum(ol_amount) AS revenue,
4 | c_city,
5 | c_phone,
6 | n_name
7 | FROM customer,
8 | oorder,
9 | order_line,
10 | nation
11 | WHERE c_id = o_c_id
12 | AND c_w_id = o_w_id
13 | AND c_d_id = o_d_id
14 | AND ol_w_id = o_w_id
15 | AND ol_d_id = o_d_id
16 | AND ol_o_id = o_id
17 | AND o_entry_d >= '2007-01-02 00:00:00.000000'
18 | AND o_entry_d <= ol_delivery_d
19 | AND n_nationkey = ascii(substring(c_state from 1 for 1))
20 | GROUP BY c_id,
21 | c_last,
22 | c_city,
23 | c_phone,
24 | n_name
25 | ORDER BY revenue DESC;
26 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/procedures/tpch/query11.sql:
--------------------------------------------------------------------------------
1 | SELECT s_i_id,
2 | sum(s_order_cnt) AS ordercount
3 | FROM stock,
4 | supplier,
5 | nation
6 | WHERE mod((s_w_id * s_i_id), 10000) = su_suppkey
7 | AND su_nationkey = n_nationkey
8 | AND n_name = 'Germany'
9 | GROUP BY s_i_id HAVING sum(s_order_cnt) >
10 | (SELECT sum(s_order_cnt) * .005
11 | FROM stock,
12 | supplier,
13 | nation
14 | WHERE mod((s_w_id * s_i_id), 10000) = su_suppkey
15 | AND su_nationkey = n_nationkey
16 | AND n_name = 'Germany')
17 | ORDER BY ordercount DESC;
18 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/procedures/tpch/query12.sql:
--------------------------------------------------------------------------------
1 | SELECT o_ol_cnt,
2 | sum(CASE WHEN o_carrier_id = 1
3 | OR o_carrier_id = 2 THEN 1 ELSE 0 END) AS high_line_count,
4 | sum(CASE WHEN o_carrier_id <> 1
5 | AND o_carrier_id <> 2 THEN 1 ELSE 0 END) AS low_line_count
6 | FROM oorder,
7 | order_line
8 | WHERE ol_w_id = o_w_id
9 | AND ol_d_id = o_d_id
10 | AND ol_o_id = o_id
11 | AND o_entry_d <= ol_delivery_d
12 | AND ol_delivery_d < '2020-01-01 00:00:00.000000'
13 | GROUP BY o_ol_cnt
14 | ORDER BY o_ol_cnt;
15 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/procedures/tpch/query13.sql:
--------------------------------------------------------------------------------
1 | SELECT c_count,
2 | count(*) AS custdist
3 | FROM
4 | (SELECT c_id,
5 | count(o_id) AS c_count
6 | FROM customer
7 | LEFT OUTER JOIN oorder ON (c_w_id = o_w_id
8 | AND c_d_id = o_d_id
9 | AND c_id = o_c_id
10 | AND o_carrier_id > 8)
11 | GROUP BY c_id) AS c_orders
12 | GROUP BY c_count
13 | ORDER BY custdist DESC, c_count DESC;
14 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/procedures/tpch/query14.sql:
--------------------------------------------------------------------------------
1 | SELECT (100.00 * sum(CASE WHEN i_data LIKE 'PR%' THEN ol_amount ELSE 0 END) / (1 + sum(ol_amount))) AS promo_revenue
2 | FROM order_line,
3 | item
4 | WHERE ol_i_id = i_id
5 | AND ol_delivery_d >= '2007-01-02 00:00:00.000000'
6 | AND ol_delivery_d < '2020-01-02 00:00:00.000000';
7 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/procedures/tpch/query15-create-view.sql:
--------------------------------------------------------------------------------
1 | CREATE view revenue0 (supplier_no, total_revenue) AS
2 | SELECT
3 | mod((s_w_id * s_i_id),10000) as supplier_no,
4 | sum(ol_amount) as total_revenue
5 | FROM
6 | order_line, stock
7 | WHERE
8 | ol_i_id = s_i_id
9 | AND ol_supply_w_id = s_w_id
10 | AND ol_delivery_d >= '2007-01-02 00:00:00.000000'
11 | GROUP BY
12 | supplier_no;
13 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/procedures/tpch/query15-drop-view.sql:
--------------------------------------------------------------------------------
1 | DROP VIEW revenue0;
2 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/procedures/tpch/query15.sql:
--------------------------------------------------------------------------------
1 | SELECT su_suppkey,
2 | su_name,
3 | su_address,
4 | su_phone,
5 | total_revenue
6 | FROM supplier, revenue0
7 | WHERE su_suppkey = supplier_no
8 | AND total_revenue = (select max(total_revenue) from revenue0)
9 | ORDER BY su_suppkey;
10 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/procedures/tpch/query16.sql:
--------------------------------------------------------------------------------
1 | SELECT i_name,
2 | substring(i_data from 1 for 3) AS brand,
3 | i_price,
4 | count(DISTINCT (mod((s_w_id * s_i_id),10000))) AS supplier_cnt
5 | FROM stock,
6 | item
7 | WHERE i_id = s_i_id
8 | AND i_data NOT LIKE 'zz%'
9 | AND (mod((s_w_id * s_i_id),10000) NOT IN
10 | (SELECT su_suppkey
11 | FROM supplier
12 | WHERE su_comment LIKE '%bad%'))
13 | GROUP BY i_name,
14 | brand,
15 | i_price
16 | ORDER BY supplier_cnt DESC;
17 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/procedures/tpch/query17.sql:
--------------------------------------------------------------------------------
1 | SELECT SUM (ol_amount) / 2.0 AS avg_yearly
2 | FROM order_line,
3 | (SELECT i_id, AVG (ol_quantity) AS a
4 | FROM item,
5 | order_line
6 | WHERE i_data LIKE '%b'
7 | AND ol_i_id = i_id
8 | GROUP BY i_id) t
9 | WHERE ol_i_id = t.i_id
10 | AND ol_quantity < t.a;
11 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/procedures/tpch/query18.sql:
--------------------------------------------------------------------------------
1 | SELECT c_last,
2 | c_id,
3 | o_id,
4 | o_entry_d,
5 | o_ol_cnt,
6 | sum(ol_amount) AS amount_sum
7 | FROM customer,
8 | oorder,
9 | order_line
10 | WHERE c_id = o_c_id
11 | AND c_w_id = o_w_id
12 | AND c_d_id = o_d_id
13 | AND ol_w_id = o_w_id
14 | AND ol_d_id = o_d_id
15 | AND ol_o_id = o_id
16 | GROUP BY o_id,
17 | o_w_id,
18 | o_d_id,
19 | c_id,
20 | c_last,
21 | o_entry_d,
22 | o_ol_cnt HAVING sum(ol_amount) > 200
23 | ORDER BY amount_sum DESC, o_entry_d;
24 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/procedures/tpch/query19.sql:
--------------------------------------------------------------------------------
1 | SELECT sum(ol_amount) AS revenue
2 | FROM order_line,
3 | item
4 | WHERE (ol_i_id = i_id
5 | AND i_data LIKE '%a'
6 | AND ol_quantity >= 1
7 | AND ol_quantity <= 10
8 | AND i_price BETWEEN 1 AND 400000
9 | AND ol_w_id IN (1,
10 | 2,
11 | 3))
12 | OR (ol_i_id = i_id
13 | AND i_data LIKE '%b'
14 | AND ol_quantity >= 1
15 | AND ol_quantity <= 10
16 | AND i_price BETWEEN 1 AND 400000
17 | AND ol_w_id IN (1,
18 | 2,
19 | 4))
20 | OR (ol_i_id = i_id
21 | AND i_data LIKE '%c'
22 | AND ol_quantity >= 1
23 | AND ol_quantity <= 10
24 | AND i_price BETWEEN 1 AND 400000
25 | AND ol_w_id IN (1,
26 | 5,
27 | 3));
28 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/procedures/tpch/query2.sql:
--------------------------------------------------------------------------------
1 | SELECT su_suppkey,
2 | su_name,
3 | n_name,
4 | i_id,
5 | i_name,
6 | su_address,
7 | su_phone,
8 | su_comment
9 | FROM item, supplier, stock, nation, region,
10 | (SELECT s_i_id AS m_i_id, MIN (s_quantity) AS m_s_quantity
11 | FROM stock,
12 | supplier,
13 | nation,
14 | region
15 | WHERE MOD ((s_w_id*s_i_id), 10000)=su_suppkey
16 | AND su_nationkey=n_nationkey
17 | AND n_regionkey=r_regionkey
18 | AND r_name LIKE 'Europ%'
19 | GROUP BY s_i_id) m
20 | WHERE i_id = s_i_id
21 | AND MOD ((s_w_id * s_i_id), 10000) = su_suppkey
22 | AND su_nationkey = n_nationkey
23 | AND n_regionkey = r_regionkey
24 | AND i_data LIKE '%b'
25 | AND r_name LIKE 'Europ%'
26 | AND i_id=m_i_id
27 | AND s_quantity = m_s_quantity
28 | ORDER BY n_name,
29 | su_name,
30 | i_id;
31 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/procedures/tpch/query20.sql:
--------------------------------------------------------------------------------
1 | SELECT su_name,
2 | su_address
3 | FROM supplier,
4 | nation
5 | WHERE su_suppkey IN
6 | (SELECT mod(s_i_id * s_w_id, 10000)
7 | FROM stock
8 | INNER JOIN item ON i_id = s_i_id
9 | INNER JOIN order_line ON ol_i_id = s_i_id
10 | WHERE ol_delivery_d > '2010-05-23 12:00:00'
11 | AND i_data LIKE 'co%'
12 | GROUP BY s_i_id,
13 | s_w_id,
14 | s_quantity HAVING 2*s_quantity > sum(ol_quantity))
15 | AND su_nationkey = n_nationkey
16 | AND n_name = 'Germany'
17 | ORDER BY su_name;
18 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/procedures/tpch/query21.sql:
--------------------------------------------------------------------------------
1 | SELECT su_name,
2 | count(*) AS numwait
3 | FROM supplier,
4 | order_line l1,
5 | oorder,
6 | stock,
7 | nation
8 | WHERE ol_o_id = o_id
9 | AND ol_w_id = o_w_id
10 | AND ol_d_id = o_d_id
11 | AND ol_w_id = s_w_id
12 | AND ol_i_id = s_i_id
13 | AND mod((s_w_id * s_i_id),10000) = su_suppkey
14 | AND l1.ol_delivery_d > o_entry_d
15 | AND NOT EXISTS
16 | (SELECT *
17 | FROM order_line l2
18 | WHERE l2.ol_o_id = l1.ol_o_id
19 | AND l2.ol_w_id = l1.ol_w_id
20 | AND l2.ol_d_id = l1.ol_d_id
21 | AND l2.ol_delivery_d > l1.ol_delivery_d)
22 | AND su_nationkey = n_nationkey
23 | AND n_name = 'Germany'
24 | GROUP BY su_name
25 | ORDER BY numwait DESC, su_name;
26 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/procedures/tpch/query22.sql:
--------------------------------------------------------------------------------
1 | SELECT substring(c_state from 1 for 1) AS country,
2 | count(*) AS numcust,
3 | sum(c_balance) AS totacctbal
4 | FROM customer
5 | WHERE substring(c_phone from 1 for 1) IN ('1',
6 | '2',
7 | '3',
8 | '4',
9 | '5',
10 | '6',
11 | '7')
12 | AND c_balance >
13 | (SELECT avg(c_balance)
14 | FROM customer
15 | WHERE c_balance > 0.00
16 | AND substring(c_phone from 1 for 1) IN ('1',
17 | '2',
18 | '3',
19 | '4',
20 | '5',
21 | '6',
22 | '7'))
23 | AND NOT EXISTS
24 | (SELECT *
25 | FROM oorder
26 | WHERE o_c_id = c_id
27 | AND o_w_id = c_w_id
28 | AND o_d_id = c_d_id)
29 | GROUP BY substring(c_state from 1 for 1)
30 | ORDER BY substring(c_state,1,1);
31 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/procedures/tpch/query3.sql:
--------------------------------------------------------------------------------
1 | SELECT ol_o_id,
2 | ol_w_id,
3 | ol_d_id,
4 | sum(ol_amount) AS revenue,
5 | o_entry_d
6 | FROM customer,
7 | new_order,
8 | oorder,
9 | order_line
10 | WHERE c_state LIKE 'A%'
11 | AND c_id = o_c_id
12 | AND c_w_id = o_w_id
13 | AND c_d_id = o_d_id
14 | AND no_w_id = o_w_id
15 | AND no_d_id = o_d_id
16 | AND no_o_id = o_id
17 | AND ol_w_id = o_w_id
18 | AND ol_d_id = o_d_id
19 | AND ol_o_id = o_id
20 | AND o_entry_d > '2007-01-02 00:00:00.000000'
21 | GROUP BY ol_o_id,
22 | ol_w_id,
23 | ol_d_id,
24 | o_entry_d
25 | ORDER BY revenue DESC , o_entry_d;
26 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/procedures/tpch/query4.sql:
--------------------------------------------------------------------------------
1 | SELECT o_ol_cnt,
2 | count(*) AS order_count
3 | FROM oorder
4 | WHERE exists
5 | (SELECT *
6 | FROM order_line
7 | WHERE o_id = ol_o_id
8 | AND o_w_id = ol_w_id
9 | AND o_d_id = ol_d_id
10 | AND ol_delivery_d >= o_entry_d)
11 | GROUP BY o_ol_cnt
12 | ORDER BY o_ol_cnt
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/procedures/tpch/query5.sql:
--------------------------------------------------------------------------------
1 | SELECT n_name,
2 | sum(ol_amount) AS revenue
3 | FROM customer,
4 | oorder,
5 | order_line,
6 | stock,
7 | supplier,
8 | nation,
9 | region
10 | WHERE c_id = o_c_id
11 | AND c_w_id = o_w_id
12 | AND c_d_id = o_d_id
13 | AND ol_o_id = o_id
14 | AND ol_w_id = o_w_id
15 | AND ol_d_id=o_d_id
16 | AND ol_w_id = s_w_id
17 | AND ol_i_id = s_i_id
18 | AND MOD ((s_w_id * s_i_id), 10000) = su_suppkey
19 | AND ascii(substring(c_state from 1 for 1)) = su_nationkey
20 | AND su_nationkey = n_nationkey
21 | AND n_regionkey = r_regionkey
22 | AND r_name = 'Europe'
23 | AND o_entry_d >= '2007-01-02 00:00:00.000000'
24 | GROUP BY n_name
25 | ORDER BY revenue DESC;
26 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/procedures/tpch/query6.sql:
--------------------------------------------------------------------------------
1 | SELECT sum(ol_amount) AS revenue
2 | FROM order_line
3 | WHERE ol_delivery_d >= '1999-01-01 00:00:00.000000'
4 | AND ol_delivery_d < '2020-01-01 00:00:00.000000'
5 | AND ol_quantity BETWEEN 1 AND 100000
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/procedures/tpch/query7.sql:
--------------------------------------------------------------------------------
1 | SELECT su_nationkey AS supp_nation,
2 | substring(c_state from 1 for 1) AS cust_nation,
3 | extract(YEAR
4 | FROM o_entry_d) AS l_year,
5 | sum(ol_amount) AS revenue
6 | FROM supplier,
7 | stock,
8 | order_line,
9 | oorder,
10 | customer,
11 | nation n1,
12 | nation n2
13 | WHERE ol_supply_w_id = s_w_id
14 | AND ol_i_id = s_i_id
15 | AND MOD ((s_w_id * s_i_id), 10000) = su_suppkey
16 | AND ol_w_id = o_w_id
17 | AND ol_d_id = o_d_id
18 | AND ol_o_id = o_id
19 | AND c_id = o_c_id
20 | AND c_w_id = o_w_id
21 | AND c_d_id = o_d_id
22 | AND su_nationkey = n1.n_nationkey
23 | AND ascii(substring(c_state from 1 for 1)) = n2.n_nationkey
24 | AND ((n1.n_name = 'Germany'
25 | AND n2.n_name = 'Cambodia')
26 | OR (n1.n_name = 'Cambodia'
27 | AND n2.n_name = 'Germany'))
28 | GROUP BY su_nationkey,
29 | cust_nation,
30 | l_year
31 | ORDER BY su_nationkey,
32 | cust_nation,
33 | l_year
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/procedures/tpch/query8.sql:
--------------------------------------------------------------------------------
1 | SELECT extract(YEAR
2 | FROM o_entry_d) AS l_year,
3 | sum(CASE WHEN n2.n_name = 'Germany' THEN ol_amount ELSE 0 END) / sum(ol_amount) AS mkt_share
4 | FROM item,
5 | supplier,
6 | stock,
7 | order_line,
8 | oorder,
9 | customer,
10 | nation n1,
11 | nation n2,
12 | region
13 | WHERE i_id = s_i_id
14 | AND ol_i_id = s_i_id
15 | AND ol_supply_w_id = s_w_id
16 | AND MOD ((s_w_id * s_i_id), 10000) = su_suppkey
17 | AND ol_w_id = o_w_id
18 | AND ol_d_id = o_d_id
19 | AND ol_o_id = o_id
20 | AND c_id = o_c_id
21 | AND c_w_id = o_w_id
22 | AND c_d_id = o_d_id
23 | AND n1.n_nationkey = ascii(substring(c_state from 1 for 1))
24 | AND n1.n_regionkey = r_regionkey
25 | AND ol_i_id < 1000
26 | AND r_name = 'Europe'
27 | AND su_nationkey = n2.n_nationkey
28 | AND i_data LIKE '%b'
29 | AND i_id = ol_i_id
30 | GROUP BY l_year
31 | ORDER BY l_year;
32 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/procedures/tpch/query9.sql:
--------------------------------------------------------------------------------
1 | SELECT n_name,
2 | extract(YEAR
3 | FROM o_entry_d) AS l_year,
4 | sum(ol_amount) AS sum_profit
5 | FROM item,
6 | stock,
7 | supplier,
8 | order_line,
9 | oorder,
10 | nation
11 | WHERE ol_i_id = s_i_id
12 | AND ol_supply_w_id = s_w_id
13 | AND MOD ((s_w_id * s_i_id), 10000) = su_suppkey
14 | AND ol_w_id = o_w_id
15 | AND ol_d_id = o_d_id
16 | AND ol_o_id = o_id
17 | AND ol_i_id = i_id
18 | AND su_nationkey = n_nationkey
19 | AND i_data LIKE '%bb'
20 | GROUP BY n_name,
21 | l_year
22 | ORDER BY n_name,
23 | l_year DESC;
24 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/types/DatabaseType.java:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * Copyright 2015 by OLTPBenchmark Project *
3 | * *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); *
5 | * you may not use this file except in compliance with the License. *
6 | * You may obtain a copy of the License at *
7 | * *
8 | * http://www.apache.org/licenses/LICENSE-2.0 *
9 | * *
10 | * Unless required by applicable law or agreed to in writing, software *
11 | * distributed under the License is distributed on an "AS IS" BASIS, *
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13 | * See the License for the specific language governing permissions and *
14 | * limitations under the License. *
15 | ******************************************************************************
16 | /*
17 | * Copyright 2017 by INESC TEC
18 | * This work was based on the OLTPBenchmark Project
19 | *
20 | * Licensed under the Apache License, Version 2.0 (the "License");
21 | * you may not use this file except in compliance with the License.
22 | * You may obtain a copy of the License at
23 | *
24 | * http://www.apache.org/licenses/LICENSE-2.0
25 | *
26 | * Unless required by applicable law or agreed to in writing, software
27 | * distributed under the License is distributed on an "AS IS" BASIS,
28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
29 | * See the License for the specific language governing permissions and
30 | * limitations under the License.
31 | */
32 | /**
33 | * List of the database management systems that we support
34 | * in the framework.
35 | * @author pavlo
36 | */
37 | package pt.haslab.htapbench.types;
38 |
39 | import java.util.EnumSet;
40 | import java.util.HashMap;
41 | import java.util.Map;
42 |
43 | public enum DatabaseType {
44 |
45 | DB2,
46 | MYSQL,
47 | POSTGRES,
48 | LEANXCALE,
49 | ORACLE,
50 | SQLSERVER,
51 | SQLITE,
52 | AMAZONRDS,
53 | HSTORE,
54 | SQLAZURE,
55 | ASSCLOWN,
56 | HSQLDB,
57 | H2,
58 | MONETDB,
59 | NUODB
60 | ;
61 |
62 | public static final DatabaseType TEST_TYPE = DatabaseType.HSQLDB;
63 |
64 | protected static final Map idx_lookup = new HashMap();
65 | protected static final Map name_lookup = new HashMap();
66 | static {
67 | for (DatabaseType vt : EnumSet.allOf(DatabaseType.class)) {
68 | DatabaseType.idx_lookup.put(vt.ordinal(), vt);
69 | DatabaseType.name_lookup.put(vt.name().toUpperCase(), vt);
70 | }
71 | }
72 |
73 | public static DatabaseType get(String name) {
74 | DatabaseType ret = DatabaseType.name_lookup.get(name.toUpperCase());
75 | return (ret);
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/types/ResultSetResult.java:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * Copyright 2015 by OLTPBenchmark Project *
3 | * *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); *
5 | * you may not use this file except in compliance with the License. *
6 | * You may obtain a copy of the License at *
7 | * *
8 | * http://www.apache.org/licenses/LICENSE-2.0 *
9 | * *
10 | * Unless required by applicable law or agreed to in writing, software *
11 | * distributed under the License is distributed on an "AS IS" BASIS, *
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13 | * See the License for the specific language governing permissions and *
14 | * limitations under the License. *
15 | ******************************************************************************
16 | /*
17 | * Copyright 2017 by INESC TEC
18 | * This work was based on the OLTPBenchmark Project
19 | *
20 | * Licensed under the Apache License, Version 2.0 (the "License");
21 | * you may not use this file except in compliance with the License.
22 | * You may obtain a copy of the License at
23 | *
24 | * http://www.apache.org/licenses/LICENSE-2.0
25 | *
26 | * Unless required by applicable law or agreed to in writing, software
27 | * distributed under the License is distributed on an "AS IS" BASIS,
28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
29 | * See the License for the specific language governing permissions and
30 | * limitations under the License.
31 | */
32 | package pt.haslab.htapbench.types;
33 |
34 | public class ResultSetResult {
35 |
36 | private int rows;
37 |
38 | public ResultSetResult(){
39 | this.rows=0;
40 | }
41 |
42 | public void setRows(int rows){
43 | this.rows=rows;
44 | }
45 |
46 | public int getRows(){
47 | return this.rows;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/types/SortDirectionType.java:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * Copyright 2015 by OLTPBenchmark Project *
3 | * *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); *
5 | * you may not use this file except in compliance with the License. *
6 | * You may obtain a copy of the License at *
7 | * *
8 | * http://www.apache.org/licenses/LICENSE-2.0 *
9 | * *
10 | * Unless required by applicable law or agreed to in writing, software *
11 | * distributed under the License is distributed on an "AS IS" BASIS, *
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13 | * See the License for the specific language governing permissions and *
14 | * limitations under the License. *
15 | ******************************************************************************
16 | /*
17 | * Copyright 2017 by INESC TEC
18 | * This work was based on the OLTPBenchmark Project
19 | *
20 | * Licensed under the Apache License, Version 2.0 (the "License");
21 | * you may not use this file except in compliance with the License.
22 | * You may obtain a copy of the License at
23 | *
24 | * http://www.apache.org/licenses/LICENSE-2.0
25 | *
26 | * Unless required by applicable law or agreed to in writing, software
27 | * distributed under the License is distributed on an "AS IS" BASIS,
28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
29 | * See the License for the specific language governing permissions and
30 | * limitations under the License.
31 | */
32 | package pt.haslab.htapbench.types;
33 |
34 | import java.util.*;
35 |
36 | /**
37 | *
38 | */
39 | public enum SortDirectionType {
40 | INVALID (0),
41 | ASC (1),
42 | DESC (2);
43 |
44 | SortDirectionType(int val) {
45 | assert (this.ordinal() == val) :
46 | "Enum element " + this.name() +
47 | " in position " + this.ordinal() +
48 | " instead of position " + val;
49 | }
50 |
51 | public int getValue() {
52 | return this.ordinal();
53 | }
54 |
55 | protected static final Map idx_lookup = new HashMap();
56 | protected static final Map name_lookup = new HashMap();
57 | static {
58 | for (SortDirectionType vt : EnumSet.allOf(SortDirectionType.class)) {
59 | SortDirectionType.idx_lookup.put(vt.ordinal(), vt);
60 | SortDirectionType.name_lookup.put(vt.name().toLowerCase().intern(), vt);
61 | }
62 | }
63 |
64 | public static Map getIndexMap() {
65 | return idx_lookup;
66 | }
67 |
68 | public static Map getNameMap() {
69 | return name_lookup;
70 | }
71 |
72 | public static SortDirectionType get(Integer idx) {
73 | assert(idx >= 0);
74 | SortDirectionType ret = SortDirectionType.idx_lookup.get(idx);
75 | return (ret == null ? SortDirectionType.INVALID : ret);
76 | }
77 |
78 | public static SortDirectionType get(String name) {
79 | SortDirectionType ret = SortDirectionType.name_lookup.get(name.toLowerCase().intern());
80 | return (ret == null ? SortDirectionType.INVALID : ret);
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/types/State.java:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * Copyright 2015 by OLTPBenchmark Project *
3 | * *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); *
5 | * you may not use this file except in compliance with the License. *
6 | * You may obtain a copy of the License at *
7 | * *
8 | * http://www.apache.org/licenses/LICENSE-2.0 *
9 | * *
10 | * Unless required by applicable law or agreed to in writing, software *
11 | * distributed under the License is distributed on an "AS IS" BASIS, *
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13 | * See the License for the specific language governing permissions and *
14 | * limitations under the License. *
15 | ******************************************************************************
16 | /*
17 | * Copyright 2017 by INESC TEC
18 | * This work was based on the OLTPBenchmark Project
19 | *
20 | * Licensed under the Apache License, Version 2.0 (the "License");
21 | * you may not use this file except in compliance with the License.
22 | * You may obtain a copy of the License at
23 | *
24 | * http://www.apache.org/licenses/LICENSE-2.0
25 | *
26 | * Unless required by applicable law or agreed to in writing, software
27 | * distributed under the License is distributed on an "AS IS" BASIS,
28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
29 | * See the License for the specific language governing permissions and
30 | * limitations under the License.
31 | */
32 | package pt.haslab.htapbench.types;
33 |
34 | public enum State {
35 | WARMUP, MEASURE, COLD_QUERY, LATENCY_COMPLETE, DONE, EXIT,
36 | }
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/types/TransactionStatus.java:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * Copyright 2015 by OLTPBenchmark Project *
3 | * *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); *
5 | * you may not use this file except in compliance with the License. *
6 | * You may obtain a copy of the License at *
7 | * *
8 | * http://www.apache.org/licenses/LICENSE-2.0 *
9 | * *
10 | * Unless required by applicable law or agreed to in writing, software *
11 | * distributed under the License is distributed on an "AS IS" BASIS, *
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13 | * See the License for the specific language governing permissions and *
14 | * limitations under the License. *
15 | ******************************************************************************
16 | /*
17 | * Copyright 2017 by INESC TEC
18 | * This work was based on the OLTPBenchmark Project
19 | *
20 | * Licensed under the Apache License, Version 2.0 (the "License");
21 | * you may not use this file except in compliance with the License.
22 | * You may obtain a copy of the License at
23 | *
24 | * http://www.apache.org/licenses/LICENSE-2.0
25 | *
26 | * Unless required by applicable law or agreed to in writing, software
27 | * distributed under the License is distributed on an "AS IS" BASIS,
28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
29 | * See the License for the specific language governing permissions and
30 | * limitations under the License.
31 | */
32 | package pt.haslab.htapbench.types;
33 |
34 | public enum TransactionStatus {
35 | /**
36 | * The transaction executed successfully and
37 | * committed without any errors.
38 | */
39 | SUCCESS,
40 | /**
41 | * The transaction executed successfully but then was aborted
42 | * due to the valid user control code.
43 | * This is not an error.
44 | */
45 | USER_ABORTED,
46 | /**
47 | * The transaction did not executed due to internal
48 | * benchmark state. It should be retried
49 | */
50 | RETRY,
51 | /**
52 | * The transaction did not executed due to internal
53 | * benchmark state. The Worker should retry but select
54 | * a new random transaction to execute.
55 | */
56 | RETRY_DIFFERENT
57 | }
58 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/util/EventObservableExceptionHandler.java:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************************
3 | * Copyright 2015 by OLTPBenchmark Project *
4 | * *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); *
6 | * you may not use this file except in compliance with the License. *
7 | * You may obtain a copy of the License at *
8 | * *
9 | * http://www.apache.org/licenses/LICENSE-2.0 *
10 | * *
11 | * Unless required by applicable law or agreed to in writing, software *
12 | * distributed under the License is distributed on an "AS IS" BASIS, *
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 | * See the License for the specific language governing permissions and *
15 | * limitations under the License. *
16 | ******************************************************************************
17 | /*
18 | * Copyright 2017 by INESC TEC
19 | * This work was based on the OLTPBenchmark Project
20 | *
21 | * Licensed under the Apache License, Version 2.0 (the "License");
22 | * you may not use this file except in compliance with the License.
23 | * You may obtain a copy of the License at
24 | *
25 | * http://www.apache.org/licenses/LICENSE-2.0
26 | *
27 | * Unless required by applicable law or agreed to in writing, software
28 | * distributed under the License is distributed on an "AS IS" BASIS,
29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 | * See the License for the specific language governing permissions and
31 | * limitations under the License.
32 | */
33 | package pt.haslab.htapbench.util;
34 |
35 | public class EventObservableExceptionHandler extends EventObservable> implements Thread.UncaughtExceptionHandler {
36 |
37 | private Throwable error;
38 |
39 | @Override
40 | public void uncaughtException(Thread t, Throwable e) {
41 | if (this.error == null) this.error = e;
42 | this.notifyObservers(Pair.of(t, e));
43 | }
44 |
45 | public boolean hasError() {
46 | return (this.error != null);
47 | }
48 |
49 | public Throwable getError() {
50 | return (this.error);
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/util/EventObserver.java:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************************
3 | * Copyright 2015 by OLTPBenchmark Project *
4 | * *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); *
6 | * you may not use this file except in compliance with the License. *
7 | * You may obtain a copy of the License at *
8 | * *
9 | * http://www.apache.org/licenses/LICENSE-2.0 *
10 | * *
11 | * Unless required by applicable law or agreed to in writing, software *
12 | * distributed under the License is distributed on an "AS IS" BASIS, *
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 | * See the License for the specific language governing permissions and *
15 | * limitations under the License. *
16 | ******************************************************************************
17 | /*
18 | * Copyright 2017 by INESC TEC
19 | * This work was based on the OLTPBenchmark Project
20 | *
21 | * Licensed under the Apache License, Version 2.0 (the "License");
22 | * you may not use this file except in compliance with the License.
23 | * You may obtain a copy of the License at
24 | *
25 | * http://www.apache.org/licenses/LICENSE-2.0
26 | *
27 | * Unless required by applicable law or agreed to in writing, software
28 | * distributed under the License is distributed on an "AS IS" BASIS,
29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 | * See the License for the specific language governing permissions and
31 | * limitations under the License.
32 | */
33 | package pt.haslab.htapbench.util;
34 |
35 | import java.util.*;
36 |
37 | /**
38 | * EventObservable
39 | */
40 | public abstract class EventObserver {
41 |
42 | protected class InnerObserver implements Observer {
43 | @SuppressWarnings({ "unchecked", "rawtypes" })
44 | @Override
45 | public void update(Observable o, Object arg) {
46 | assert(o instanceof EventObservable>.InnerObservable);
47 | EventObserver.this.update(((EventObservable.InnerObservable)o).getEventObservable(), (T)arg);
48 | }
49 | public EventObserver getEventObserver() {
50 | return (EventObserver.this);
51 | }
52 | }
53 |
54 | private final InnerObserver observer;
55 |
56 | public EventObserver() {
57 | this.observer = new InnerObserver();
58 | }
59 |
60 | protected Observer getObserver() {
61 | return (this.observer);
62 | }
63 |
64 | public abstract void update(EventObservable o, T arg);
65 | }
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/util/JSONSerializable.java:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************************
3 | * Copyright 2015 by OLTPBenchmark Project *
4 | * *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); *
6 | * you may not use this file except in compliance with the License. *
7 | * You may obtain a copy of the License at *
8 | * *
9 | * http://www.apache.org/licenses/LICENSE-2.0 *
10 | * *
11 | * Unless required by applicable law or agreed to in writing, software *
12 | * distributed under the License is distributed on an "AS IS" BASIS, *
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 | * See the License for the specific language governing permissions and *
15 | * limitations under the License. *
16 | ******************************************************************************
17 | /*
18 | * Copyright 2017 by INESC TEC
19 | * This work was based on the OLTPBenchmark Project
20 | *
21 | * Licensed under the Apache License, Version 2.0 (the "License");
22 | * you may not use this file except in compliance with the License.
23 | * You may obtain a copy of the License at
24 | *
25 | * http://www.apache.org/licenses/LICENSE-2.0
26 | *
27 | * Unless required by applicable law or agreed to in writing, software
28 | * distributed under the License is distributed on an "AS IS" BASIS,
29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 | * See the License for the specific language governing permissions and
31 | * limitations under the License.
32 | */
33 | package pt.haslab.htapbench.util;
34 |
35 | import java.io.IOException;
36 |
37 | import pt.haslab.htapbench.util.json.JSONException;
38 | import pt.haslab.htapbench.util.json.JSONObject;
39 | import pt.haslab.htapbench.util.json.JSONString;
40 | import pt.haslab.htapbench.util.json.JSONStringer;
41 |
42 | public interface JSONSerializable extends JSONString {
43 | public void save(String output_path) throws IOException;
44 | public void load(String input_path) throws IOException;
45 | public void toJSON(JSONStringer stringer) throws JSONException;
46 | public void fromJSON(JSONObject json_object) throws JSONException;
47 | }
48 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/util/QueueLimitException.java:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************************
3 | * Copyright 2015 by OLTPBenchmark Project *
4 | * *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); *
6 | * you may not use this file except in compliance with the License. *
7 | * You may obtain a copy of the License at *
8 | * *
9 | * http://www.apache.org/licenses/LICENSE-2.0 *
10 | * *
11 | * Unless required by applicable law or agreed to in writing, software *
12 | * distributed under the License is distributed on an "AS IS" BASIS, *
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 | * See the License for the specific language governing permissions and *
15 | * limitations under the License. *
16 | ******************************************************************************
17 | /*
18 | * Copyright 2017 by INESC TEC
19 | * This work was based on the OLTPBenchmark Project
20 | *
21 | * Licensed under the Apache License, Version 2.0 (the "License");
22 | * you may not use this file except in compliance with the License.
23 | * You may obtain a copy of the License at
24 | *
25 | * http://www.apache.org/licenses/LICENSE-2.0
26 | *
27 | * Unless required by applicable law or agreed to in writing, software
28 | * distributed under the License is distributed on an "AS IS" BASIS,
29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 | * See the License for the specific language governing permissions and
31 | * limitations under the License.
32 | */
33 | package pt.haslab.htapbench.util;
34 |
35 | public class QueueLimitException extends Exception {
36 | private static final long serialVersionUID = 1L;
37 |
38 | public QueueLimitException() {
39 | // TODO Auto-generated constructor stub
40 | }
41 |
42 | public QueueLimitException(String message) {
43 | super(message);
44 | // TODO Auto-generated constructor stub
45 | }
46 |
47 | public QueueLimitException(Throwable cause) {
48 | super(cause);
49 | // TODO Auto-generated constructor stub
50 | }
51 |
52 | public QueueLimitException(String message, Throwable cause) {
53 | super(message, cause);
54 | // TODO Auto-generated constructor stub
55 | }
56 |
57 | }
58 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/util/SimplePrinter.java:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************************
3 | * Copyright 2015 by OLTPBenchmark Project *
4 | * *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); *
6 | * you may not use this file except in compliance with the License. *
7 | * You may obtain a copy of the License at *
8 | * *
9 | * http://www.apache.org/licenses/LICENSE-2.0 *
10 | * *
11 | * Unless required by applicable law or agreed to in writing, software *
12 | * distributed under the License is distributed on an "AS IS" BASIS, *
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 | * See the License for the specific language governing permissions and *
15 | * limitations under the License. *
16 | ******************************************************************************
17 | /*
18 | * Copyright 2017 by INESC TEC
19 | * This work was based on the OLTPBenchmark Project
20 | *
21 | * Licensed under the Apache License, Version 2.0 (the "License");
22 | * you may not use this file except in compliance with the License.
23 | * You may obtain a copy of the License at
24 | *
25 | * http://www.apache.org/licenses/LICENSE-2.0
26 | *
27 | * Unless required by applicable law or agreed to in writing, software
28 | * distributed under the License is distributed on an "AS IS" BASIS,
29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 | * See the License for the specific language governing permissions and
31 | * limitations under the License.
32 | */
33 | package pt.haslab.htapbench.util;
34 |
35 | public interface SimplePrinter {
36 | public void println(String msg);
37 | }
38 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/util/SimpleSystemPrinter.java:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************************
3 | * Copyright 2015 by OLTPBenchmark Project *
4 | * *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); *
6 | * you may not use this file except in compliance with the License. *
7 | * You may obtain a copy of the License at *
8 | * *
9 | * http://www.apache.org/licenses/LICENSE-2.0 *
10 | * *
11 | * Unless required by applicable law or agreed to in writing, software *
12 | * distributed under the License is distributed on an "AS IS" BASIS, *
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 | * See the License for the specific language governing permissions and *
15 | * limitations under the License. *
16 | ******************************************************************************
17 | /*
18 | * Copyright 2017 by INESC TEC
19 | * This work was based on the OLTPBenchmark Project
20 | *
21 | * Licensed under the Apache License, Version 2.0 (the "License");
22 | * you may not use this file except in compliance with the License.
23 | * You may obtain a copy of the License at
24 | *
25 | * http://www.apache.org/licenses/LICENSE-2.0
26 | *
27 | * Unless required by applicable law or agreed to in writing, software
28 | * distributed under the License is distributed on an "AS IS" BASIS,
29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 | * See the License for the specific language governing permissions and
31 | * limitations under the License.
32 | */
33 | package pt.haslab.htapbench.util;
34 |
35 | import java.io.PrintStream;
36 |
37 | public class SimpleSystemPrinter implements SimplePrinter {
38 | PrintStream out;
39 |
40 | public SimpleSystemPrinter(PrintStream out) {
41 | this.out = out;
42 | }
43 |
44 | public void println(String msg) {
45 | if (out != null)
46 | out.println(msg);
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/util/StatisticsCollector.java:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************************
3 | * Copyright 2015 by OLTPBenchmark Project *
4 | * *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); *
6 | * you may not use this file except in compliance with the License. *
7 | * You may obtain a copy of the License at *
8 | * *
9 | * http://www.apache.org/licenses/LICENSE-2.0 *
10 | * *
11 | * Unless required by applicable law or agreed to in writing, software *
12 | * distributed under the License is distributed on an "AS IS" BASIS, *
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 | * See the License for the specific language governing permissions and *
15 | * limitations under the License. *
16 | ******************************************************************************
17 | /*
18 | * Copyright 2017 by INESC TEC
19 | * This work was based on the OLTPBenchmark Project
20 | *
21 | * Licensed under the Apache License, Version 2.0 (the "License");
22 | * you may not use this file except in compliance with the License.
23 | * You may obtain a copy of the License at
24 | *
25 | * http://www.apache.org/licenses/LICENSE-2.0
26 | *
27 | * Unless required by applicable law or agreed to in writing, software
28 | * distributed under the License is distributed on an "AS IS" BASIS,
29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 | * See the License for the specific language governing permissions and
31 | * limitations under the License.
32 | */
33 | package pt.haslab.htapbench.util;
34 |
35 | import java.sql.SQLException;
36 | import java.util.Properties;
37 |
38 | public class StatisticsCollector {
39 |
40 | SSHGetStats osStats;
41 | MysqlGetStats mysqlGetStats;
42 |
43 | public StatisticsCollector(Properties ini) throws SQLException {
44 | osStats = new SSHGetStats(ini);
45 | mysqlGetStats = new MysqlGetStats(ini);
46 | }
47 |
48 | public double[] getStats() throws SQLException {
49 |
50 | double[] re = new double[13];
51 |
52 | re[0] = mysqlGetStats.getAverageTransactionPerSecondSinceLastCall();
53 | re[1] = osStats.getPercentageCPUSinceLastCall();
54 |
55 | double[] temp = osStats.getDifferentialDiskStats();
56 |
57 | for (int i = 0; i < 11; i++) {
58 | re[2 + i] = temp[i];
59 | }
60 |
61 | return re;
62 | }
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/util/StatsHolder.java:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************************
3 | * Copyright 2015 by OLTPBenchmark Project *
4 | * *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); *
6 | * you may not use this file except in compliance with the License. *
7 | * You may obtain a copy of the License at *
8 | * *
9 | * http://www.apache.org/licenses/LICENSE-2.0 *
10 | * *
11 | * Unless required by applicable law or agreed to in writing, software *
12 | * distributed under the License is distributed on an "AS IS" BASIS, *
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 | * See the License for the specific language governing permissions and *
15 | * limitations under the License. *
16 | ******************************************************************************
17 | /*
18 | * Copyright 2017 by INESC TEC
19 | * This work was based on the OLTPBenchmark Project
20 | *
21 | * Licensed under the Apache License, Version 2.0 (the "License");
22 | * you may not use this file except in compliance with the License.
23 | * You may obtain a copy of the License at
24 | *
25 | * http://www.apache.org/licenses/LICENSE-2.0
26 | *
27 | * Unless required by applicable law or agreed to in writing, software
28 | * distributed under the License is distributed on an "AS IS" BASIS,
29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 | * See the License for the specific language governing permissions and
31 | * limitations under the License.
32 | */
33 | package pt.haslab.htapbench.util;
34 |
35 | public class StatsHolder {
36 |
37 | double[] accumulatedValue;
38 | int count;
39 |
40 | public StatsHolder(int i) {
41 |
42 | accumulatedValue = new double[i];
43 | count = 0;
44 |
45 | }
46 |
47 | public void add(double[] t) {
48 | for (int i = 0; i < t.length; i++) {
49 | accumulatedValue[i] += t[i];
50 | }
51 | count++;
52 | }
53 |
54 | public void reset() {
55 | count = 0;
56 | accumulatedValue = new double[accumulatedValue.length];
57 | }
58 |
59 | public double[] getAverage() {
60 |
61 | double[] ret = new double[accumulatedValue.length];
62 | for (int i = 0; i < accumulatedValue.length; i++) {
63 | ret[i] = accumulatedValue[i] / count;
64 | }
65 |
66 | return ret;
67 | }
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/util/TimeUtil.java:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************************
3 | * Copyright 2015 by OLTPBenchmark Project *
4 | * *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); *
6 | * you may not use this file except in compliance with the License. *
7 | * You may obtain a copy of the License at *
8 | * *
9 | * http://www.apache.org/licenses/LICENSE-2.0 *
10 | * *
11 | * Unless required by applicable law or agreed to in writing, software *
12 | * distributed under the License is distributed on an "AS IS" BASIS, *
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 | * See the License for the specific language governing permissions and *
15 | * limitations under the License. *
16 | ******************************************************************************
17 | /*
18 | * Copyright 2017 by INESC TEC
19 | * This work was based on the OLTPBenchmark Project
20 | *
21 | * Licensed under the Apache License, Version 2.0 (the "License");
22 | * you may not use this file except in compliance with the License.
23 | * You may obtain a copy of the License at
24 | *
25 | * http://www.apache.org/licenses/LICENSE-2.0
26 | *
27 | * Unless required by applicable law or agreed to in writing, software
28 | * distributed under the License is distributed on an "AS IS" BASIS,
29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 | * See the License for the specific language governing permissions and
31 | * limitations under the License.
32 | */
33 | package pt.haslab.htapbench.util;
34 |
35 | import java.sql.Timestamp;
36 | import java.text.SimpleDateFormat;
37 |
38 | public abstract class TimeUtil {
39 |
40 | public final static SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
41 | public final static SimpleDateFormat DATE_FORMAT_14 = new SimpleDateFormat("yyyyMMddHHmmss");
42 |
43 | /**
44 | * @return
45 | */
46 | public static String getCurrentTimeString14() {
47 | return TimeUtil.DATE_FORMAT_14.format(new java.util.Date());
48 | }
49 |
50 | /**
51 | * @return
52 | */
53 | public static String getCurrentTimeString() {
54 | return TimeUtil.DATE_FORMAT.format(new java.util.Date());
55 | }
56 |
57 | /**
58 | * Get a timestamp of the current time
59 | */
60 | public static Timestamp getCurrentTime() {
61 | return new Timestamp(System.currentTimeMillis());
62 | }
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/util/dbms_collectors/DBCollector.java:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************************
3 | * Copyright 2015 by OLTPBenchmark Project *
4 | * *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); *
6 | * you may not use this file except in compliance with the License. *
7 | * You may obtain a copy of the License at *
8 | * *
9 | * http://www.apache.org/licenses/LICENSE-2.0 *
10 | * *
11 | * Unless required by applicable law or agreed to in writing, software *
12 | * distributed under the License is distributed on an "AS IS" BASIS, *
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 | * See the License for the specific language governing permissions and *
15 | * limitations under the License. *
16 | ******************************************************************************
17 | /*
18 | * Copyright 2017 by INESC TEC
19 | * This work was based on the OLTPBenchmark Project
20 | *
21 | * Licensed under the Apache License, Version 2.0 (the "License");
22 | * you may not use this file except in compliance with the License.
23 | * You may obtain a copy of the License at
24 | *
25 | * http://www.apache.org/licenses/LICENSE-2.0
26 | *
27 | * Unless required by applicable law or agreed to in writing, software
28 | * distributed under the License is distributed on an "AS IS" BASIS,
29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 | * See the License for the specific language governing permissions and
31 | * limitations under the License.
32 | */
33 | package pt.haslab.htapbench.util.dbms_collectors;
34 |
35 | import org.apache.log4j.Logger;
36 |
37 | import java.util.Map;
38 | import java.util.TreeMap;
39 |
40 | class DBCollector implements DBParameterCollector {
41 | private static final Logger LOG = Logger.getLogger(DBCollector.class);
42 | protected final Map dbConf = new TreeMap();
43 |
44 | public String collectParameters() {
45 | StringBuilder confBuilder = new StringBuilder();
46 | for (Map.Entry kv : dbConf.entrySet()) {
47 | confBuilder.append(kv.getKey().toLowerCase())
48 | .append("=")
49 | .append(kv.getValue().toLowerCase())
50 | .append("\n");
51 | }
52 | return confBuilder.toString();
53 | }
54 |
55 | public String collectVersion() {
56 | return "";
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/util/dbms_collectors/DBParameterCollector.java:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************************
3 | * Copyright 2015 by OLTPBenchmark Project *
4 | * *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); *
6 | * you may not use this file except in compliance with the License. *
7 | * You may obtain a copy of the License at *
8 | * *
9 | * http://www.apache.org/licenses/LICENSE-2.0 *
10 | * *
11 | * Unless required by applicable law or agreed to in writing, software *
12 | * distributed under the License is distributed on an "AS IS" BASIS, *
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 | * See the License for the specific language governing permissions and *
15 | * limitations under the License. *
16 | ******************************************************************************
17 | /*
18 | * Copyright 2017 by INESC TEC
19 | * This work was based on the OLTPBenchmark Project
20 | *
21 | * Licensed under the Apache License, Version 2.0 (the "License");
22 | * you may not use this file except in compliance with the License.
23 | * You may obtain a copy of the License at
24 | *
25 | * http://www.apache.org/licenses/LICENSE-2.0
26 | *
27 | * Unless required by applicable law or agreed to in writing, software
28 | * distributed under the License is distributed on an "AS IS" BASIS,
29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 | * See the License for the specific language governing permissions and
31 | * limitations under the License.
32 | */
33 | package pt.haslab.htapbench.util.dbms_collectors;
34 |
35 | public interface DBParameterCollector {
36 | String collectParameters();
37 | String collectVersion();
38 | }
39 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/util/dbms_collectors/DBParameterCollectorGen.java:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************************
3 | * Copyright 2015 by OLTPBenchmark Project *
4 | * *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); *
6 | * you may not use this file except in compliance with the License. *
7 | * You may obtain a copy of the License at *
8 | * *
9 | * http://www.apache.org/licenses/LICENSE-2.0 *
10 | * *
11 | * Unless required by applicable law or agreed to in writing, software *
12 | * distributed under the License is distributed on an "AS IS" BASIS, *
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 | * See the License for the specific language governing permissions and *
15 | * limitations under the License. *
16 | ******************************************************************************
17 | /*
18 | * Copyright 2017 by INESC TEC
19 | * This work was based on the OLTPBenchmark Project
20 | *
21 | * Licensed under the Apache License, Version 2.0 (the "License");
22 | * you may not use this file except in compliance with the License.
23 | * You may obtain a copy of the License at
24 | *
25 | * http://www.apache.org/licenses/LICENSE-2.0
26 | *
27 | * Unless required by applicable law or agreed to in writing, software
28 | * distributed under the License is distributed on an "AS IS" BASIS,
29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 | * See the License for the specific language governing permissions and
31 | * limitations under the License.
32 | */
33 | package pt.haslab.htapbench.util.dbms_collectors;
34 |
35 | public class DBParameterCollectorGen {
36 | public static DBParameterCollector getCollector(String dbType, String dbUrl, String username, String password) {
37 | String db = dbType.toLowerCase();
38 | if (db.equals("mysql")) {
39 | return new MYSQLCollector(dbUrl, username, password);
40 | } else if (db.equals("postgres")) {
41 | return new POSTGRESCollector(dbUrl, username, password);
42 | } else {
43 | return new DBCollector();
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/util/dbms_collectors/MYSQLCollector.java:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************************
3 | * Copyright 2015 by OLTPBenchmark Project *
4 | * *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); *
6 | * you may not use this file except in compliance with the License. *
7 | * You may obtain a copy of the License at *
8 | * *
9 | * http://www.apache.org/licenses/LICENSE-2.0 *
10 | * *
11 | * Unless required by applicable law or agreed to in writing, software *
12 | * distributed under the License is distributed on an "AS IS" BASIS, *
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 | * See the License for the specific language governing permissions and *
15 | * limitations under the License. *
16 | ******************************************************************************
17 | /*
18 | * Copyright 2017 by INESC TEC
19 | * This work was based on the OLTPBenchmark Project
20 | *
21 | * Licensed under the Apache License, Version 2.0 (the "License");
22 | * you may not use this file except in compliance with the License.
23 | * You may obtain a copy of the License at
24 | *
25 | * http://www.apache.org/licenses/LICENSE-2.0
26 | *
27 | * Unless required by applicable law or agreed to in writing, software
28 | * distributed under the License is distributed on an "AS IS" BASIS,
29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 | * See the License for the specific language governing permissions and
31 | * limitations under the License.
32 | */
33 | package pt.haslab.htapbench.util.dbms_collectors;
34 |
35 | import org.apache.log4j.Logger;
36 |
37 | import java.sql.*;
38 | import pt.haslab.htapbench.catalog.Catalog;
39 |
40 | class MYSQLCollector extends DBCollector {
41 | private static final Logger LOG = Logger.getLogger(MYSQLCollector.class);
42 | private static final String VERSION = "VERSION";
43 |
44 | public MYSQLCollector(String oriDBUrl, String username, String password) {
45 | String dbUrl = oriDBUrl.substring(0, oriDBUrl.lastIndexOf('/'));
46 | dbUrl = dbUrl + "/information_schema";
47 | try {
48 | Connection conn = DriverManager.getConnection(dbUrl, username, password);
49 | Catalog.setSeparator(conn);
50 | Statement s = conn.createStatement();
51 | ResultSet out = s.executeQuery("SELECT * FROM GLOBAL_VARIABLES;");
52 | while(out.next()) {
53 | dbConf.put(out.getString("VARIABLE_NAME"), out.getString("VARIABLE_VALUE"));
54 | }
55 | } catch (SQLException e) {
56 | LOG.debug("Error while collecting DB parameters: " + e.getMessage());
57 | }
58 | }
59 |
60 | @Override
61 | public String collectVersion() {
62 | String dbVersion = dbConf.get(VERSION);
63 | int verIdx = dbVersion.indexOf('-');
64 | if (verIdx >= 0)
65 | dbVersion = dbVersion.substring(0, verIdx);
66 | return dbVersion;
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/util/dbms_collectors/POSTGRESCollector.java:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************************
3 | * Copyright 2015 by OLTPBenchmark Project *
4 | * *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); *
6 | * you may not use this file except in compliance with the License. *
7 | * You may obtain a copy of the License at *
8 | * *
9 | * http://www.apache.org/licenses/LICENSE-2.0 *
10 | * *
11 | * Unless required by applicable law or agreed to in writing, software *
12 | * distributed under the License is distributed on an "AS IS" BASIS, *
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 | * See the License for the specific language governing permissions and *
15 | * limitations under the License. *
16 | ******************************************************************************
17 | /*
18 | * Copyright 2017 by INESC TEC
19 | * This work was based on the OLTPBenchmark Project
20 | *
21 | * Licensed under the Apache License, Version 2.0 (the "License");
22 | * you may not use this file except in compliance with the License.
23 | * You may obtain a copy of the License at
24 | *
25 | * http://www.apache.org/licenses/LICENSE-2.0
26 | *
27 | * Unless required by applicable law or agreed to in writing, software
28 | * distributed under the License is distributed on an "AS IS" BASIS,
29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 | * See the License for the specific language governing permissions and
31 | * limitations under the License.
32 | */
33 | package pt.haslab.htapbench.util.dbms_collectors;
34 |
35 | import org.apache.log4j.Logger;
36 |
37 | import java.sql.*;
38 | import pt.haslab.htapbench.catalog.Catalog;
39 |
40 | class POSTGRESCollector extends DBCollector {
41 | private static final Logger LOG = Logger.getLogger(POSTGRESCollector.class);
42 | private static final String VERSION = "server_version";
43 |
44 | public POSTGRESCollector(String oriDBUrl, String username, String password) {
45 | try {
46 | Connection conn = DriverManager.getConnection(oriDBUrl, username, password);
47 | Catalog.setSeparator(conn);
48 | Statement s = conn.createStatement();
49 | ResultSet out = s.executeQuery("SHOW ALL;");
50 | while(out.next()) {
51 | dbConf.put(out.getString("name"), out.getString("setting"));
52 | }
53 | } catch (SQLException e) {
54 | LOG.debug("Error while collecting DB parameters: " + e.getMessage());
55 | }
56 | }
57 |
58 | @Override
59 | public String collectVersion() {
60 | return dbConf.get(VERSION);
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/util/json/JSONException.java:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************************
3 | * Copyright 2015 by OLTPBenchmark Project *
4 | * *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); *
6 | * you may not use this file except in compliance with the License. *
7 | * You may obtain a copy of the License at *
8 | * *
9 | * http://www.apache.org/licenses/LICENSE-2.0 *
10 | * *
11 | * Unless required by applicable law or agreed to in writing, software *
12 | * distributed under the License is distributed on an "AS IS" BASIS, *
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 | * See the License for the specific language governing permissions and *
15 | * limitations under the License. *
16 | ******************************************************************************
17 | /*
18 | * Copyright 2017 by INESC TEC
19 | * This work was based on the OLTPBenchmark Project
20 | *
21 | * Licensed under the Apache License, Version 2.0 (the "License");
22 | * you may not use this file except in compliance with the License.
23 | * You may obtain a copy of the License at
24 | *
25 | * http://www.apache.org/licenses/LICENSE-2.0
26 | *
27 | * Unless required by applicable law or agreed to in writing, software
28 | * distributed under the License is distributed on an "AS IS" BASIS,
29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 | * See the License for the specific language governing permissions and
31 | * limitations under the License.
32 | */
33 | package pt.haslab.htapbench.util.json;
34 |
35 | /**
36 | * The JSONException is thrown by the JSON.org classes then things are amiss.
37 | * @author JSON.org
38 | * @version 2008-09-18
39 | */
40 | public class JSONException extends Exception {
41 | private static final long serialVersionUID = 1L;
42 | private Throwable cause;
43 |
44 | /**
45 | * Constructs a JSONException with an explanatory message.
46 | * @param message Detail about the reason for the exception.
47 | */
48 | public JSONException(String message) {
49 | super(message);
50 | }
51 |
52 | public JSONException(Throwable t) {
53 | super(t.getMessage());
54 | this.cause = t;
55 | }
56 |
57 | public Throwable getCause() {
58 | return this.cause;
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/src/pt/haslab/htapbench/util/json/JSONString.java:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************************
3 | * Copyright 2015 by OLTPBenchmark Project *
4 | * *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); *
6 | * you may not use this file except in compliance with the License. *
7 | * You may obtain a copy of the License at *
8 | * *
9 | * http://www.apache.org/licenses/LICENSE-2.0 *
10 | * *
11 | * Unless required by applicable law or agreed to in writing, software *
12 | * distributed under the License is distributed on an "AS IS" BASIS, *
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 | * See the License for the specific language governing permissions and *
15 | * limitations under the License. *
16 | ******************************************************************************
17 | /*
18 | * Copyright 2017 by INESC TEC
19 | * This work was based on the OLTPBenchmark Project
20 | *
21 | * Licensed under the Apache License, Version 2.0 (the "License");
22 | * you may not use this file except in compliance with the License.
23 | * You may obtain a copy of the License at
24 | *
25 | * http://www.apache.org/licenses/LICENSE-2.0
26 | *
27 | * Unless required by applicable law or agreed to in writing, software
28 | * distributed under the License is distributed on an "AS IS" BASIS,
29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 | * See the License for the specific language governing permissions and
31 | * limitations under the License.
32 | */
33 | package pt.haslab.htapbench.util.json;
34 | /**
35 | * The JSONString interface allows a toJSONString()
36 | * method so that a class can change the behavior of
37 | * JSONObject.toString(), JSONArray.toString(),
38 | * and JSONWriter.value(Object). The
39 | * toJSONString method will be used instead of the default behavior
40 | * of using the Object's toString() method and quoting the result.
41 | */
42 | public interface JSONString {
43 | /**
44 | * The toJSONString method allows a class to produce its own JSON
45 | * serialization.
46 | *
47 | * @return A strictly syntactically correct JSON text.
48 | */
49 | public String toJSONString();
50 | }
51 |
--------------------------------------------------------------------------------
/src/test/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/faclc4/HTAPBench/0e64856a3906b65a077335fd10003b6af90e1ea6/src/test/.DS_Store
--------------------------------------------------------------------------------