Date32 return ZonedDateTime rather then LocalDate strings
Description
Only Date clickhouse types are formatted and returned as local date strings. Date32 is returned as LocalDateTime. See https://github.com/ClickHouse/clickhouse-java/blob/b46d249bc894709b9f68962917c56b021dee9652/client-v2/src/main/java/com/clickhouse/client/api/data_formats/internal/AbstractBinaryFormatReader.java#L334-L340
The fix for date was added in https://github.com/ClickHouse/clickhouse-java/pull/2062/files, not sure why Date32 was not added
As a user its surprising that Date32 come back as LocalDateTimes. The value returned by clickhouse is only the date, see https://fiddle.clickhouse.com/caed507d-8d72-48c5-92e2-fac7f5dff261
Steps to reproduce
connection.createStatement().use { stmt ->
val query = """
SELECT
toDate('1900-01-01') AS Date,
toDate32('1900-01-01') AS Date32
""".trimIndent()
stmt.executeQuery(query).use { rs ->
while (rs.next()) {
val date = rs.getString("Date")
val date32 = rs.getString("Date32")
println("date=$date, date32=$date32")
}
}
}
prints: date=1970-01-01, date32=1900-01-01T00:00Z[UTC]
Expected Behaviour
Date32 columns are returned as LocalDates. date=1970-01-01, date32=1900-01-01
This seems like an easy fix to me, happy to contribute if this really is a bug
Good day, @jaccozilla! Thank you for reporting! yes, this seems a bug.
I am looking into it.