Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.OffsetDateTime;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.time.temporal.TemporalAmount;
Expand Down Expand Up @@ -664,7 +663,7 @@ public Instant getInstant(int index) {
case Date:
case Date32:
LocalDate date = getLocalDate(index);
return date == null ? null : date.atStartOfDay(ZoneId.of("UTC")).toInstant();
return date == null ? null : date.atStartOfDay(DataTypeConverter.UTC_ZONE_ID).toInstant();
case Time:
case Time64:
LocalDateTime dt = getLocalDateTime(index);
Expand Down Expand Up @@ -707,7 +706,7 @@ public static byte[] stringLikeToBytes(Object value) {
static Instant objectToInstant(Object value) {
if (value instanceof LocalDateTime) {
LocalDateTime dateTime = (LocalDateTime) value;
return Instant.from(dateTime.atZone(ZoneId.of("UTC")));
return Instant.from(dateTime.atZone(DataTypeConverter.UTC_ZONE_ID));
} else if (value instanceof ZonedDateTime) {
ZonedDateTime dateTime = (ZonedDateTime) value;
return dateTime.toInstant();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.clickhouse.client.api.Client;
import com.clickhouse.client.api.ClientException;
import com.clickhouse.client.api.internal.DataTypeConverter;
import com.clickhouse.client.api.serde.POJOFieldDeserializer;
import com.clickhouse.data.ClickHouseAggregateFunction;
import com.clickhouse.data.ClickHouseColumn;
Expand Down Expand Up @@ -727,18 +728,18 @@ private static void serializePrimitiveData(OutputStream stream, Object value, Cl
}
break;
case Date:
writeDate(stream, value, ZoneId.of("UTC")); // TODO: check
writeDate(stream, value, DataTypeConverter.UTC_ZONE_ID); // TODO: check
break;
case Date32:
writeDate32(stream, value, ZoneId.of("UTC")); // TODO: check
writeDate32(stream, value, DataTypeConverter.UTC_ZONE_ID); // TODO: check
break;
case DateTime: {
ZoneId zoneId = column.getTimeZone() == null ? ZoneId.of("UTC") : column.getTimeZone().toZoneId();
ZoneId zoneId = column.getTimeZone() == null ? DataTypeConverter.UTC_ZONE_ID : column.getTimeZone().toZoneId();
writeDateTime(stream, value, zoneId);
break;
}
case DateTime64: {
ZoneId zoneId = column.getTimeZone() == null ? ZoneId.of("UTC") : column.getTimeZone().toZoneId();
ZoneId zoneId = column.getTimeZone() == null ? DataTypeConverter.UTC_ZONE_ID : column.getTimeZone().toZoneId();
writeDateTime64(stream, value, column.getScale(), zoneId);
break;
}
Expand Down