You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Flight SQL JDBC] Read Float4 values as double and BigDecimal with correct precision #1406
Describe the bug, including details regarding any error messages, version, and platform.
Describe the bug
ArrowFlightJdbcFloat4VectorAccessor widens the underlying float to double directly. Reading a Float4Vector (SQL REAL/FLOAT4) through ResultSet.getDouble(), ResultSet.getBigDecimal() or ResultSet.getObject(col, Double.class) therefore returns the binary approximation of the float, not the decimal value the float stands for.
getDouble() is implemented as (double) getFloat().
getBigDecimal() and getBigDecimal(int scale) use BigDecimal.valueOf(float), which widens to double first.
getObject(Double.class) goes through getDouble() in ArrowFlightJdbcAccessor.getObject(Class).
getString() already uses Float.toString(value), so the same cell gives different results depending on the getter:
The same happens through a real connection with a query returning a REAL column containing 0.1, 1.1, 123.456 and similar values.
Expected behaviour
For a finite float, getDouble(), getBigDecimal() and getObject(Double.class) should return the decimal value the float represents. That is the shortest decimal that uniquely identifies the float, the same one Float.toString yields. For 0.1f that is 0.1, which is what getString() already returns. Other JDBC drivers show this behaviour for REAL columns.
Activity