|
3 | 3 | import com.clickhouse.client.api.command.CommandResponse; |
4 | 4 | import com.clickhouse.client.api.command.CommandSettings; |
5 | 5 | import com.clickhouse.client.api.data_formats.ClickHouseBinaryFormatReader; |
| 6 | +import com.clickhouse.client.api.data_formats.ClickHouseFormatReader; |
6 | 7 | import com.clickhouse.client.api.data_formats.NativeFormatReader; |
7 | 8 | import com.clickhouse.client.api.data_formats.RowBinaryFormatReader; |
8 | 9 | import com.clickhouse.client.api.data_formats.RowBinaryWithNamesAndTypesFormatReader; |
@@ -135,8 +136,6 @@ public class Client implements AutoCloseable { |
135 | 136 |
|
136 | 137 | private final Map<ClickHouseDataType, Class<?>> typeHintMapping; |
137 | 138 |
|
138 | | - private final boolean binaryStringSupport; |
139 | | - |
140 | 139 | // Server context |
141 | 140 | private String dbUser; |
142 | 141 | private String serverVersion; |
@@ -202,7 +201,6 @@ private Client(Collection<Endpoint> endpoints, Map<String,String> configuration, |
202 | 201 | this.serverVersion = configuration.getOrDefault(ClientConfigProperties.SERVER_VERSION.getKey(), "unknown"); |
203 | 202 | this.dbUser = configuration.getOrDefault(ClientConfigProperties.USER.getKey(), ClientConfigProperties.USER.getDefObjVal()); |
204 | 203 | this.typeHintMapping = (Map<ClickHouseDataType, Class<?>>) this.configuration.get(ClientConfigProperties.TYPE_HINT_MAPPING.getKey()); |
205 | | - this.binaryStringSupport = ClientConfigProperties.BINARY_STRING_SUPPORT.getOrDefault(this.configuration); |
206 | 204 | } |
207 | 205 |
|
208 | 206 | /** |
@@ -1123,10 +1121,10 @@ public Builder typeHintMapping(Map<ClickHouseDataType, Class<?>> typeHintMapping |
1123 | 1121 | } |
1124 | 1122 |
|
1125 | 1123 | /** |
1126 | | - * Enables reading top-level {@code String} and {@code FixedString} columns as |
1127 | | - * {@link com.clickhouse.client.api.data_formats.StringValue}, preserving the raw bytes instead of |
1128 | | - * decoding them into a {@link String}. Values nested inside containers (Array, Map, Tuple, Nested, |
1129 | | - * Variant) are still read as {@link String}. |
| 1124 | + * Enables reading {@code String} and {@code FixedString} columns into an intermediate {@code byte[]} |
| 1125 | + * (a new array each time) instead of decoding them into a {@link String}. This improves working with |
| 1126 | + * large strings and allows {@link ClickHouseFormatReader#getByteArray} to be used more effectively. Can also be configured |
| 1127 | + * per operation. |
1130 | 1128 | * |
1131 | 1129 | * @param enable - if the feature is enabled |
1132 | 1130 | * @return this builder instance |
@@ -2126,17 +2124,17 @@ public ClickHouseBinaryFormatReader newBinaryFormatReader(QueryResponse response |
2126 | 2124 | switch (response.getFormat()) { |
2127 | 2125 | case Native: |
2128 | 2126 | reader = new NativeFormatReader(response.getInputStream(), response.getSettings(), |
2129 | | - byteBufferPool, typeHintMapping, binaryStringSupport); |
| 2127 | + byteBufferPool, typeHintMapping); |
2130 | 2128 | break; |
2131 | 2129 | case RowBinaryWithNamesAndTypes: |
2132 | | - reader = new RowBinaryWithNamesAndTypesFormatReader(response.getInputStream(), response.getSettings(), byteBufferPool, typeHintMapping, binaryStringSupport); |
| 2130 | + reader = new RowBinaryWithNamesAndTypesFormatReader(response.getInputStream(), response.getSettings(), byteBufferPool, typeHintMapping); |
2133 | 2131 | break; |
2134 | 2132 | case RowBinaryWithNames: |
2135 | | - reader = new RowBinaryWithNamesFormatReader(response.getInputStream(), response.getSettings(), schema, byteBufferPool, typeHintMapping, binaryStringSupport); |
| 2133 | + reader = new RowBinaryWithNamesFormatReader(response.getInputStream(), response.getSettings(), schema, byteBufferPool, typeHintMapping); |
2136 | 2134 | break; |
2137 | 2135 | case RowBinary: |
2138 | 2136 | reader = new RowBinaryFormatReader(response.getInputStream(), response.getSettings(), schema, |
2139 | | - byteBufferPool, typeHintMapping, binaryStringSupport); |
| 2137 | + byteBufferPool, typeHintMapping); |
2140 | 2138 | break; |
2141 | 2139 | default: |
2142 | 2140 | throw new IllegalArgumentException("Binary readers doesn't support format: " + response.getFormat()); |
|
0 commit comments