ClickHouse / clickhouse-odbc

ODBC driver for ClickHouse
https://clickhouse.tech
Apache License 2.0
245 stars 86 forks source link

Floats get rounded if handled as String #382

Open kylhuk opened 2 years ago

kylhuk commented 2 years ago

Currently have a setup, where I connect to an Oracle DB via Clickhouse ODBC and I just came across a very strange issue. Not sure yet if this is a bug or feature.

If I query the Oracle DB via ODBC, I usually set up the tables where all columns are set as string, due to the fact that Oracle has like 1824728 data types and I simply do not care about them yet. Then I realized that the numbers were odd, to be more precise, they were correctly rounded from a real number to an integer number.

When I set the data type to Float32, the value gets represented correctly

        |           |       |       |
        | Original Oracle DB    | Clickhouse    | Clickhouse    |
        |-----------------------|---------------|---------------|
Data Type   | Number        | String    | Float32   |
Value       | 32.86         | 33        | 32.86     |
        ---------------------------------------------------------
                       ^
                       | This should not be 33

Is that a bug or a feature? Any ideas?