diff --git a/clickhouse-native-jdbc/src/main/java/com/github/housepower/client/NativeClient.java b/clickhouse-native-jdbc/src/main/java/com/github/housepower/client/NativeClient.java index 50d400df..6eb4fd91 100644 --- a/clickhouse-native-jdbc/src/main/java/com/github/housepower/client/NativeClient.java +++ b/clickhouse-native-jdbc/src/main/java/com/github/housepower/client/NativeClient.java @@ -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); } diff --git a/clickhouse-native-jdbc/src/main/java/com/github/housepower/settings/ClickHouseDefines.java b/clickhouse-native-jdbc/src/main/java/com/github/housepower/settings/ClickHouseDefines.java index 29ecf015..2da8b270 100644 --- a/clickhouse-native-jdbc/src/main/java/com/github/housepower/settings/ClickHouseDefines.java +++ b/clickhouse-native-jdbc/src/main/java/com/github/housepower/settings/ClickHouseDefines.java @@ -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.