Revert "[refactor](function) ignore DST for function from_unixtime (#19151)" (#19333)

This reverts commit 9dd6c8f87b73db238bfd38fb1d76f3796910f398.
This commit is contained in:
Gabriel
2023-05-06 16:33:58 +08:00
committed by GitHub
parent f584ad52ca
commit 4c6ca88088
9 changed files with 60 additions and 96 deletions

View File

@ -225,17 +225,13 @@ public class DateLiteral extends LiteralExpr {
Timestamp timestamp = new Timestamp(unixTimestamp);
ZonedDateTime zonedDateTime = ZonedDateTime.ofInstant(timestamp.toInstant(), ZoneId.of(timeZone.getID()));
// Ignore DST transition
LocalDateTime time = zonedDateTime.minusSeconds(
zonedDateTime.getOffset().getTotalSeconds() - timeZone.getRawOffset() / 1000).toLocalDateTime();
year = time.getYear();
month = time.getMonthValue();
day = time.getDayOfMonth();
hour = time.getHour();
minute = time.getMinute();
second = time.getSecond();
microsecond = time.get(ChronoField.MICRO_OF_SECOND);
year = zonedDateTime.getYear();
month = zonedDateTime.getMonthValue();
day = zonedDateTime.getDayOfMonth();
hour = zonedDateTime.getHour();
minute = zonedDateTime.getMinute();
second = zonedDateTime.getSecond();
microsecond = zonedDateTime.get(ChronoField.MICRO_OF_SECOND);
if (type.equals(Type.DATE)) {
hour = 0;
minute = 0;