@@ -57,7 +57,7 @@ public void insertV1(DataState dataState) {
5757 try (ClickHouseResponse response = clientV1 .read (getServer ())
5858 .write ()
5959 .option (ClickHouseClientOption .ASYNC , false )
60- .option (ClickHouseClientOption .COMPRESS , dataState . useClientCompression )
60+ .option (ClickHouseClientOption .DECOMPRESS , false )
6161 .format (format )
6262 .query (BenchmarkRunner .getInsertQuery (dataState .tableNameEmpty ))
6363 .data (out -> {
@@ -81,7 +81,46 @@ public void insertV2(DataState dataState) {
8181 out .write (bytes );
8282 }
8383 out .close ();
84- }, format , new InsertSettings ().compressClientRequest (dataState .useClientCompression )).get ()) {
84+ }, format , new InsertSettings ().compressClientRequest (false )).get ()) {
85+ response .getWrittenRows ();
86+ }
87+ } catch (Exception e ) {
88+ LOGGER .error ("Error: " , e );
89+ }
90+ }
91+
92+ @ Benchmark
93+ public void insertV1Compressed (DataState dataState ) {
94+ try {
95+ ClickHouseFormat format = dataState .dataSet .getFormat ();
96+ try (ClickHouseResponse response = clientV1 .read (getServer ())
97+ .write ()
98+ .option (ClickHouseClientOption .ASYNC , false )
99+ .option (ClickHouseClientOption .DECOMPRESS , true )
100+ .format (format )
101+ .query (BenchmarkRunner .getInsertQuery (dataState .tableNameEmpty ))
102+ .data (out -> {
103+ for (byte [] bytes : dataState .dataSet .getBytesList (format )) {
104+ out .write (bytes );
105+ }
106+ }).executeAndWait ()) {
107+ response .getSummary ();
108+ }
109+ } catch (Exception e ) {
110+ LOGGER .error ("Error: " , e );
111+ }
112+ }
113+
114+ @ Benchmark
115+ public void insertV2Compressed (DataState dataState ) {
116+ try {
117+ ClickHouseFormat format = dataState .dataSet .getFormat ();
118+ try (InsertResponse response = clientV2 .insert (dataState .tableNameEmpty , out -> {
119+ for (byte [] bytes : dataState .dataSet .getBytesList (format )) {
120+ out .write (bytes );
121+ }
122+ out .close ();
123+ }, format , new InsertSettings ()).get ()) {
85124 response .getWrittenRows ();
86125 }
87126 } catch (Exception e ) {
@@ -97,6 +136,7 @@ public void insertV1RowBinary(DataState dataState) {
97136 .write ()
98137 .option (ClickHouseClientOption .ASYNC , false )
99138 .format (format )
139+ .option (ClickHouseClientOption .DECOMPRESS , false )
100140 .query (BenchmarkRunner .getInsertQuery (dataState .tableNameEmpty ))
101141 .data (out -> {
102142 ClickHouseDataProcessor p = dataState .dataSet .getClickHouseDataProcessor ();
@@ -131,7 +171,8 @@ public void insertV2RowBinary(DataState dataState) {
131171 }
132172 out .flush ();
133173
134- }, ClickHouseFormat .RowBinaryWithDefaults , new InsertSettings ()).get ()) {
174+ }, ClickHouseFormat .RowBinaryWithDefaults , new InsertSettings ()
175+ .compressClientRequest (false )).get ()) {
135176 response .getWrittenRows ();
136177 }
137178 } catch (Exception e ) {
0 commit comments