@@ -42,7 +42,7 @@ public void insertV1(DataState dataState) {
4242 try (ClickHouseResponse response = clientV1 .read (getServer ())
4343 .write ()
4444 .option (ClickHouseClientOption .ASYNC , false )
45- .option (ClickHouseClientOption .DECOMPRESS , dataState . useClientCompression )
45+ .option (ClickHouseClientOption .DECOMPRESS , false )
4646 .format (format )
4747 .query (BenchmarkRunner .getInsertQuery (dataState .tableNameEmpty ))
4848 .data (out -> {
@@ -66,7 +66,46 @@ public void insertV2(DataState dataState) {
6666 out .write (bytes );
6767 }
6868 out .close ();
69- }, format , new InsertSettings ().compressClientRequest (dataState .useClientCompression )).get ()) {
69+ }, format , new InsertSettings ().compressClientRequest (false )).get ()) {
70+ response .getWrittenRows ();
71+ }
72+ } catch (Exception e ) {
73+ LOGGER .error ("Error: " , e );
74+ }
75+ }
76+
77+ @ Benchmark
78+ public void insertV1Compressed (DataState dataState ) {
79+ try {
80+ ClickHouseFormat format = dataState .dataSet .getFormat ();
81+ try (ClickHouseResponse response = clientV1 .read (getServer ())
82+ .write ()
83+ .option (ClickHouseClientOption .ASYNC , false )
84+ .option (ClickHouseClientOption .DECOMPRESS , true )
85+ .format (format )
86+ .query (BenchmarkRunner .getInsertQuery (dataState .tableNameEmpty ))
87+ .data (out -> {
88+ for (byte [] bytes : dataState .dataSet .getBytesList (format )) {
89+ out .write (bytes );
90+ }
91+ }).executeAndWait ()) {
92+ response .getSummary ();
93+ }
94+ } catch (Exception e ) {
95+ LOGGER .error ("Error: " , e );
96+ }
97+ }
98+
99+ @ Benchmark
100+ public void insertV2Compressed (DataState dataState ) {
101+ try {
102+ ClickHouseFormat format = dataState .dataSet .getFormat ();
103+ try (InsertResponse response = clientV2 .insert (dataState .tableNameEmpty , out -> {
104+ for (byte [] bytes : dataState .dataSet .getBytesList (format )) {
105+ out .write (bytes );
106+ }
107+ out .close ();
108+ }, format , new InsertSettings ()).get ()) {
70109 response .getWrittenRows ();
71110 }
72111 } catch (Exception e ) {
@@ -82,6 +121,7 @@ public void insertV1RowBinary(DataState dataState) {
82121 .write ()
83122 .option (ClickHouseClientOption .ASYNC , false )
84123 .format (format )
124+ .option (ClickHouseClientOption .DECOMPRESS , false )
85125 .query (BenchmarkRunner .getInsertQuery (dataState .tableNameEmpty ))
86126 .data (out -> {
87127 ClickHouseDataProcessor p = dataState .dataSet .getClickHouseDataProcessor ();
@@ -116,7 +156,8 @@ public void insertV2RowBinary(DataState dataState) {
116156 }
117157 out .flush ();
118158
119- }, ClickHouseFormat .RowBinaryWithDefaults , new InsertSettings ()).get ()) {
159+ }, ClickHouseFormat .RowBinaryWithDefaults , new InsertSettings ()
160+ .compressClientRequest (false )).get ()) {
120161 response .getWrittenRows ();
121162 }
122163 } catch (Exception e ) {
0 commit comments