-
Notifications
You must be signed in to change notification settings - Fork 618
3.1 jdbc driver broke float handling for nan/inf #770
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
3.1 jdbc driver broke float handling for nan/inf #770
Conversation
27c0324 to
3a1799c
Compare
| assertEquals(70511139L, rs.getLong(2)); | ||
| } | ||
|
|
||
| @Test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing changed about this testcase, intellij just warned me it was missing a "@test" annotation.
e34f857 to
3ca5c06
Compare
|
Thank you @grantatspothero for the contribution. We're working on 0.3.2 which is a complete rewrite and we'll move to a RowBinary-based new JDBC driver, which supports nan/inf(examples). Anyway, I changed target branch from |
ResultSet.getFloat and ResultSet.getObject(Float.class) did not agree with each other
3ca5c06 to
6cc8b68
Compare
|
|
|
@zhicwu Just a bump |
Sorry for the late response. Will merge this pull request after I'm done with another. |
When upgrading from the jdbc driver from 2.x to 3.x I noticed this following error occurring in tests (for the trinodb project)
The root cause of the problem is
ResultSet.getFloatandResultSet.getObject(Float.class)use different parsing functions (a custom double parser for getFloat and Float::valueOf for getObject): https://github.com/ClickHouse/clickhouse-jdbc/blob/v0.3.1-patch/clickhouse-jdbc/src/main/java/ru/yandex/clickhouse/response/parser/ClickHouseValueParser.java#L43-L45Clickhouse sends
[+|-]?infover the wire (not[+|-]?Infinity) so if you useResultSet.getObject(Float.class)theFloat::valueOffunction errors out.The fix is just creating a custom float parser (much like the double parser) such that both float and double parsing perform the same logic.