Skip to content

Commit

Permalink
Extract rw compress to ClickHouseDefines (#388)
Browse files Browse the repository at this point in the history
* Extract rw compress to ClickHouseDefines

* rename
  • Loading branch information
pan3793 committed Dec 3, 2021
1 parent a8d3ada commit 9a4f75c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ public static NativeClient connect(ClickHouseConfig configure) throws SQLExcepti
socket.connect(endpoint, (int) configure.connectTimeout().toMillis());

return new NativeClient(socket,
new BinarySerializer(new SocketBuffedWriter(socket), true),
new BinaryDeserializer(new SocketBuffedReader(socket), true));
new BinarySerializer(new SocketBuffedWriter(socket), ClickHouseDefines.WRITE_COMPRESS),
new BinaryDeserializer(new SocketBuffedReader(socket), ClickHouseDefines.READ_DECOMPRESS));
} catch (IOException ex) {
throw new SQLException(ex.getMessage(), ex);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ public class ClickHouseDefines {
public static final int COMPRESSION_HEADER_LENGTH = 9;
public static final int CHECKSUM_LENGTH = 16;

public static boolean WRITE_COMPRESS = true;
public static boolean READ_DECOMPRESS = true;

/**
* The optimal size for receive buffer and send buffer should be
* latency * network_bandwidth.
Expand Down

0 comments on commit 9a4f75c

Please sign in to comment.