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
Reading an array date value as LocalDate fails, same for other temporal types #3284
Reading an array value with conversion to another class fails, though the same conversion works for non-array values.
Steps to reproduce
Create a MergeTree table with Array(Nullable(Date32)) and/or Array(Nullable(DateTime64)) and/or Array(Nullable(Time64)), add some values
Query the table and read the array values as a ResultSet:
try (ResultSettrs = query.getResultSet() {
trs.next();
Arrayarray = rs.getArray(columnIndex);
ResultSetars = array.getResultSet()) {
while (ars.next()) {
Objectvalue = ars.getObject(2, LocalDate.class);
// or LocalDateTime.class for DateTime64, // or LocalTime.class for Time64
}
}
getObject() fails
Error Log or Exception StackTrace
java.sql.SQLException: Value of class java.sql.Date cannot be converted to class java.time.LocalDate
at com.clickhouse.jdbc.types.ArrayResultSet.convertValue(ArrayResultSet.java:146)
at com.clickhouse.jdbc.types.ArrayResultSet.getValueAsObject(ArrayResultSet.java:168)
at com.clickhouse.jdbc.types.ArrayResultSet.getObject(ArrayResultSet.java:1254)
Expected Behaviour
The same conversion works for row ResultSet, so I think it should work for array result sets as well.
I believe the cause is that for array conversions, com.clickhouse.client.api.data_formats.internal.ValueConverters class is used, and it does not have Date->LocalDate / Time -> LocalTime / Timestamp -> LocalDateTime conversions.
Code Example
see above
Configuration
Client Configuration
?
Environment
Cloud
Client version: JDBC driver version 0.11-all
Language version: JDK 17
OS: Ubuntu 24
ClickHouse Server
ClickHouse Server version: 26.10
ClickHouse Server non-default settings, if any: none
I also add that storing array time value as java.sql.Time means it gets rounded to milliseconds, while Time64 type is expected to be precise up to nanoseconds.
Just conversion is not a solution for this problem because converting Date to LocalDate should be done with care to timezone. LocalDate is date in some local timezone and DB value has none.
Date values are already read as LocalDate internally and conversion to Date then to LocalDate back might be not correct.
Issue is in Array object as I see it is created as array of Date objects.
I don't quite get it.
LocalDate (or Date, for that matter) is not influenced by TZ at all, as well as LocalTime.
Even for LocalDateTime, its "naive" datetime which is not in any local time zone, its just bunch of numbers.
And you already support that conversion for primitive fields, just as the JDBC spec tolds to.
I don't really see how conversion of array elements is supposed to be different from converting primitive values. Yes, I understand that on physical level these are represented differently, but we're talking API, right?
And from API viewpoint, it should not matter whether I read a "real" ResultSet, or an Array one. In fact, that's the whole point of JDBC specifying reading arrays as result sets in the first place.
Activity
anesterenok commentedon Nov 2, 2026
I also add that storing array time value as
java.sql.Timemeans it gets rounded to milliseconds, whileTime64type is expected to be precise up to nanoseconds.chernser commentedon Nov 17, 2026
@anesterenok Thank you for reporting this!
Just conversion is not a solution for this problem because converting Date to LocalDate should be done with care to timezone. LocalDate is date in some local timezone and DB value has none.
Date values are already read as
LocalDateinternally and conversion toDatethen toLocalDateback might be not correct.Issue is in Array object as I see it is created as array of
Dateobjects.lets review together and decide.
CC: @pcbeingused333
anesterenok commentedon Nov 19, 2026
I don't quite get it.
LocalDate (or Date, for that matter) is not influenced by TZ at all, as well as LocalTime.
Even for LocalDateTime, its "naive" datetime which is not in any local time zone, its just bunch of numbers.
And you already support that conversion for primitive fields, just as the JDBC spec tolds to.
I don't really see how conversion of array elements is supposed to be different from converting primitive values. Yes, I understand that on physical level these are represented differently, but we're talking API, right?
And from API viewpoint, it should not matter whether I read a "real" ResultSet, or an Array one. In fact, that's the whole point of JDBC specifying reading arrays as result sets in the first place.
fix(jdbc-v2): serve java.time array elements from source values inste…