-
Notifications
You must be signed in to change notification settings - Fork 617
Open
Labels
Description
Description
For Time64 column, a Long value is returned from server, but JdbcUtils.convertObject() only supports Time.class conversion for non-temporal values.
Steps to reproduce
Getting a Time64 value like:
resultset.getObject(columnIndex, LocalTime.class);fails
this is due to:
clickhouse-java/jdbc-v2/src/main/java/com/clickhouse/jdbc/internal/JdbcUtils.java
Lines 387 to 391 in 00c0987
| } else if (type == Time.class && value instanceof Integer) { // Time | |
| return new Time((Integer) value * 1000L); | |
| } else if (type == Time.class && value instanceof Long) { // Time64 | |
| Instant instant = DataTypeUtils.instantFromTime64Integer(column.getScale(), (Long) value); | |
| return new Time(instant.getEpochSecond() * 1000L + instant.getNano() / 1_000_000); |
JdbcUtils.convertObject() supporting only Time.class.
Error Log or Exception StackTrace
java.sql.SQLException: Unsupported conversion from java.lang.Long to java.time.LocalTime
at com.clickhouse.jdbc.internal.JdbcUtils.convertObject(JdbcUtils.java:362)
at com.clickhouse.jdbc.internal.JdbcUtils.convert(JdbcUtils.java:300)
at com.clickhouse.jdbc.ResultSetImpl.getObjectImpl(ResultSetImpl.java:1504)
at com.clickhouse.jdbc.ResultSetImpl.getObject(ResultSetImpl.java:1468)
at com.clickhouse.jdbc.ResultSetImpl.getObject(ResultSetImpl.java:1462)
at com.zaxxer.hikari.pool.HikariProxyResultSet.getObject(HikariProxyResultSet.java)
Expected Behaviour
As per JDBC 4.3, reading time values as LocalTime.class must be supported.
Configuration
Client Configuration
Environment
- Cloud
- Client version: driver clickhouse-jdbc-0.9.6-all.jar
- Language version: JDK 17
- OS: Linux
ClickHouse Server
- ClickHouse Server version: 25.12.6.38
- ClickHouse Server non-default settings, if any: none
CREATE TABLEstatements for tables involved:- Sample data for all these tables, use clickhouse-obfuscator if necessary
Reactions are currently unavailable