Skip to content

Time64 values cannot be read as LocalTime #2763

Description

@anesterenok

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:

} 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 TABLE statements for tables involved:
  • Sample data for all these tables, use clickhouse-obfuscator if necessary

Activity

  1. added this to the 0.9.9 milestone on Mar 18, 2026
  2. chernser commented on Mar 25, 2026

    @chernser
    Contributor

    Fixed in 0.9.8
    verification test com.clickhouse.jdbc.JDBCDateTimeTests#testWalkTime

  3. modified the milestones: 0.9.9, 0.9.8 on Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions