Skip to content

Commit 4bb7baf

Browse files
author
Paultagoras
committed
Update BenchmarkBase.java
1 parent 9b45e52 commit 4bb7baf

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

performance/src/test/com/clickhouse/benchmark/clients/BenchmarkBase.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
package com.clickhouse.benchmark.clients;
22

33
import com.clickhouse.benchmark.BenchmarkRunner;
4-
import com.clickhouse.benchmark.TestEnvironment;
54
import com.clickhouse.benchmark.data.DataSet;
6-
import com.clickhouse.benchmark.data.DataSets;
75
import com.clickhouse.benchmark.data.FileDataSet;
86
import com.clickhouse.benchmark.data.SimpleDataSet;
9-
import com.clickhouse.client.BaseIntegrationTest;
107
import com.clickhouse.client.ClickHouseClient;
118
import com.clickhouse.client.ClickHouseCredentials;
129
import com.clickhouse.client.ClickHouseNode;
@@ -40,7 +37,6 @@
4037
import static com.clickhouse.benchmark.BenchmarkRunner.getSelectCountQuery;
4138
import static com.clickhouse.benchmark.BenchmarkRunner.getSyncQuery;
4239
import static com.clickhouse.benchmark.TestEnvironment.DB_NAME;
43-
import static com.clickhouse.benchmark.TestEnvironment.cleanupEnvironment;
4440
import static com.clickhouse.benchmark.TestEnvironment.getPassword;
4541
import static com.clickhouse.benchmark.TestEnvironment.getServer;
4642
import static com.clickhouse.benchmark.TestEnvironment.getUsername;
@@ -111,12 +107,11 @@ public static void initializeTables(DataState dataState) {
111107
LOGGER.info("Initializing tables: {}, {}", dataState.tableNameFilled, dataState.tableNameEmpty);
112108
LOGGER.debug("Create {}: {}", dataState.tableNameFilled, dataState.dataSet.getCreateTableString(dataState.tableNameFilled));
113109
LOGGER.debug("Create {}: {}", dataState.tableNameEmpty, dataState.dataSet.getCreateTableString(dataState.tableNameEmpty));
114-
//Truncate tables if they exist
115-
truncateTable(dataState.tableNameEmpty);
116-
truncateTable(dataState.tableNameFilled);
117110
runAndSyncQuery(dataState.dataSet.getCreateTableString(dataState.tableNameEmpty), dataState.tableNameEmpty);
118111
runAndSyncQuery(dataState.dataSet.getCreateTableString(dataState.tableNameFilled), dataState.tableNameFilled);
119-
//A happy side effect of the above is that the tables are created if they don't exist, and if they do they are truncated + synced
112+
//Truncate tables if they existed
113+
truncateTable(dataState.tableNameEmpty);
114+
truncateTable(dataState.tableNameFilled);
120115

121116
ClickHouseFormat format = dataState.dataSet.getFormat();
122117
LOGGER.debug("Inserting data into table: {}, format: {}", dataState.tableNameFilled, format);
@@ -153,6 +148,7 @@ public static void syncQuery(String tableName) {
153148
}
154149
}
155150

151+
156152
public static void truncateTable(String tableName) {
157153
LOGGER.info("Truncating table: {}", tableName);
158154
runAndSyncQuery(String.format("TRUNCATE TABLE IF EXISTS `%s`.`%s`", DB_NAME, tableName), tableName);

0 commit comments

Comments
 (0)