-
Notifications
You must be signed in to change notification settings - Fork 614
Description
Describe the bug
ClickHouseBinaryFormatReader cannot handle values of type Array(UInt64).
Array reader logic creates result array using widerPrimitiveType field of ClickHouseDataType.UInt64 which is long.
At the same time reading a value to set into array uses readBigIntegerLE method which leads to attempt to set BigInteger into long[].
Steps to reproduce
- Use click house v2 client and binary reader
- Query table with Array(UInt64) column
- use reader.next
Expected behaviour
Array(UInt64) column should be correctly read into java list (list of BigInteger I assume but whatever working version)
Code example
try (QueryResponse response = client.query(query, params, new QuerySettings()).get(3, TimeUnit.SECONDS);) {
ClickHouseBinaryFormatReader reader = client.newBinaryFormatReader(response);
while (reader.hasNext()) {
reader.next();
}
} catch (Exception e) {
log.error("Failed to read data", e);
}Error log
Caused by: java.lang.IllegalArgumentException: Failed to set value at index: 0 value 2193107007138251553 of class java.math.BigInteger
at com.clickhouse.client.api.data_formats.internal.BinaryStreamReader$ArrayValue.set(BinaryStreamReader.java:585)
at com.clickhouse.client.api.data_formats.internal.BinaryStreamReader.readArray(BinaryStreamReader.java:537)
at com.clickhouse.client.api.data_formats.internal.BinaryStreamReader.readValue(BinaryStreamReader.java:209)
... 41 common frames omitted
Caused by: java.lang.IllegalArgumentException: argument type mismatch
at java.base/java.lang.reflect.Array.set(Native Method)
at com.clickhouse.client.api.data_formats.internal.BinaryStreamReader$ArrayValue.set(BinaryStreamReader.java:582)
... 43 common frames omitted
Configuration
Environment
- Client version: 0.7.1-patch1
- Language version: jvm 21.0.1+12-LTS