You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flink.apache.org by "xiaogang zhou (Jira)" <ji...@apache.org> on 2020/10/22 03:55:00 UTC

[jira] [Created] (FLINK-19757) TimeStampData can cause time inconsistent problem

xiaogang zhou created FLINK-19757:
-------------------------------------

             Summary: TimeStampData can cause time inconsistent problem
                 Key: FLINK-19757
                 URL: https://issues.apache.org/jira/browse/FLINK-19757
             Project: Flink
          Issue Type: Improvement
          Components: Table SQL / Runtime
    Affects Versions: 1.11.1
            Reporter: xiaogang zhou


when we check jdk LocalDateTime code,we find that

public static LocalDateTime ofEpochSecond(long epochSecond, int nanoOfSecond, ZoneOffset offset) {
 Objects.requireNonNull(offset, "offset");
 NANO_OF_SECOND.checkValidValue(nanoOfSecond);
 long localSecond = epochSecond + offset.getTotalSeconds(); // overflow caught later
 long localEpochDay = Math.floorDiv(localSecond, SECONDS_PER_DAY);
 int secsOfDay = (int)Math.floorMod(localSecond, SECONDS_PER_DAY);
 LocalDate date = LocalDate.ofEpochDay(localEpochDay);
 LocalTime time = LocalTime.ofNanoOfDay(secsOfDay * NANOS_PER_SECOND + nanoOfSecond);
 return new LocalDateTime(date, time);
}

 

offset.getTotalSeconds() they add the offset, but in the TimeStampData

toLocalDateTime, we don't add a offset.

 

I'd like to add a TimeZone.getDefault().getRawOffset() in the 

toLocalDateTime()

and minus a TimeZone.getDefault().getRawOffset() in the 

fromLocalDateTime



--
This message was sent by Atlassian Jira
(v8.3.4#803005)