ClickHouse / clickhouse-java

ClickHouse Java Clients & JDBC Driver
https://clickhouse.com
Apache License 2.0
1.45k stars 535 forks source link

[client-v2] No conversion between number types (ex. short to int) #1852

Closed chernser closed 2 weeks ago

chernser commented 1 month ago

Describe the bug

It should be possible to get number values in different convertible types. Today it is required for application to know datatype of a column.

For example, binary format reader:

java.lang.ClassCastException: class java.lang.Short cannot be cast to class java.lang.Integer (java.lang.Short and java.lang.Integer are in module java.base of loader 'bootstrap')

    at com.clickhouse.client.api.data_formats.internal.AbstractBinaryFormatReader.getInteger(AbstractBinaryFormatReader.java:484)

Expected behavior

Convertion between number types should be done automatically where applicable without data truncation.