Skip to content

Commit 6631d5f

Browse files
authored
Merge pull request #2318 from ClickHouse/fix_benchmarks
[repo] fixed benchmark for rowbinary writer
2 parents b6201fa + 8adc814 commit 6631d5f

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public static class DataState {
9292
@Param({"data_empty"})
9393
String tableNameEmpty;
9494

95-
static DataSet dataSet;
95+
DataSet dataSet;
9696

9797
ByteBuffer datasetAsRowBinaryWithNamesAndTypes;
9898

@@ -118,7 +118,7 @@ public void setTableNameEmpty(String tableNameEmpty) {
118118
this.tableNameEmpty = tableNameEmpty;
119119
}
120120

121-
public static DataSet getDataSet() {
121+
public DataSet getDataSet() {
122122
return dataSet;
123123
}
124124

performance/src/main/java/com/clickhouse/benchmark/clients/CompressorCompare.java

Whitespace-only changes.

performance/src/main/java/com/clickhouse/benchmark/clients/ConcurrentInsertClient.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.clickhouse.benchmark.clients;
22

3-
import com.clickhouse.benchmark.BenchmarkRunner;
43
import com.clickhouse.benchmark.data.DataSet;
54
import com.clickhouse.client.ClickHouseClient;
65
import com.clickhouse.client.ClickHouseResponse;
@@ -57,8 +56,8 @@ public String createTableName() {
5756
return String.format("%s_%s", "concurrent_data_empty", id);
5857
}
5958
@Setup(Level.Trial)
60-
public void setup() {
61-
DataSet dataSet = DataState.getDataSet();
59+
public void setup(DataState dataState) {
60+
DataSet dataSet = dataState.getDataSet();
6261
String tableName = createTableName();
6362
LOGGER.warn("setup create table name: " + tableName);
6463
// create table

performance/src/main/java/com/clickhouse/benchmark/clients/InsertClient.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.clickhouse.benchmark.clients;
22

3-
import com.clickhouse.benchmark.BenchmarkRunner;
43
import com.clickhouse.client.ClickHouseResponse;
54
import com.clickhouse.client.api.data_formats.RowBinaryFormatWriter;
65
import com.clickhouse.client.api.insert.InsertResponse;
@@ -155,8 +154,9 @@ public void insertV1RowBinary(DataState dataState) {
155154
@Benchmark
156155
public void insertV2RowBinary(DataState dataState) {
157156
try {
157+
final ClickHouseFormat format = ClickHouseFormat.RowBinary;
158158
try (InsertResponse response = clientV2.insert(dataState.tableNameEmpty, out -> {
159-
RowBinaryFormatWriter w = new RowBinaryFormatWriter(out, dataState.dataSet.getSchema(), ClickHouseFormat.RowBinary);
159+
RowBinaryFormatWriter w = new RowBinaryFormatWriter(out, dataState.dataSet.getSchema(), format);
160160
for (List<Object> row : dataState.dataSet.getRowsOrdered()) {
161161
int index = 1;
162162
for (Object value : row) {
@@ -167,7 +167,7 @@ public void insertV2RowBinary(DataState dataState) {
167167
}
168168
out.flush();
169169

170-
}, ClickHouseFormat.RowBinaryWithDefaults, new InsertSettings()).get()) {
170+
}, format, new InsertSettings()).get()) {
171171
response.getWrittenRows();
172172
}
173173
} catch (Exception e) {

0 commit comments

Comments
 (0)