[ https://issues.apache.org/jira/browse/FLINK-34147?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17810723#comment-17810723 ]
Jark Wu commented on FLINK-34147: --------------------------------- I agree it is ambiguous. Currently, {{TimestampData}} represents both {{Instant}} and {{LocalDateTime}}. * When it represents as an {{Instant}}, you can use conversion methods {{fromInstant()/toInstant()}} to convert an {{Instant}} to {{TimestampData}}, but do not use {{fromLocalDateTime()/toLocalDateTime()}}. * When it represents as an {{LocalDateTime}}, you can use conversion methods {{fromLocalDateTime()/toLocalDateTime()}} to convert a {{LocalDateTime}} to {{TimestampData}}, but do not use {{fromInstant()/toInstant()}}. Therefore, if you have a Java {{LocalDateTime}} and want to convert it into an Instant {{TimestampData}}, you need to convert the {{LocalDateTime}} into Java {{Instant}} with a specific time zone first. And then use the {{Instant}} to create the {{TimestampData}}. This is not very clear from the javadoc of {{TimestampData}} and I agree we need to improve the doc. > TimestampData to/from LocalDateTime is ambiguous > ------------------------------------------------ > > Key: FLINK-34147 > URL: https://issues.apache.org/jira/browse/FLINK-34147 > Project: Flink > Issue Type: Bug > Components: Table SQL / API > Reporter: Rui Li > Priority: Major > > It seems TimestampData is essentially an {{Instant}}. Therefore an implicit > time zone is used in the {{fromLocalDateTime}} and {{toLocalDateTime}} > methods. However neither the method name nor the API doc indicates which time > zone is used. So from caller's perspective, the results of these two methods > are ambiguous. -- This message was sent by Atlassian Jira (v8.20.10#820010)