yiyutian1 commented on code in PR #25763:
URL: https://github.com/apache/flink/pull/25763#discussion_r1889875808
##########
flink-table/flink-table-common/src/main/java/org/apache/flink/table/utils/DateTimeUtils.java:
##########
@@ -365,6 +368,38 @@ public static TimestampData toTimestampData(double v, int
precision) {
}
}
+ public static TimestampData toTimestampData(int v, int precision) {
+ switch (precision) {
+ case 0:
+ if (MIN_EPOCH_SECONDS <= v && v <= MAX_EPOCH_SECONDS) {
+ return timestampDataFromEpochMills((v *
MILLIS_PER_SECOND));
+ } else {
+ return null;
+ }
+ case 3:
+ return timestampDataFromEpochMills(v);
+ default:
+ throw new TableException(
+ "The precision value '"
+ + precision
+ + "' for function "
+ + "TO_TIMESTAMP_LTZ(numeric, precision) is
unsupported,"
+ + " the supported value is '0' for second or
'3' for millisecond.");
+ }
+ }
Review Comment:
Modified.
##########
flink-table/flink-table-common/src/main/java/org/apache/flink/table/utils/DateTimeUtils.java:
##########
@@ -421,6 +456,21 @@ public static TimestampData parseTimestampData(String
dateStr, int precision, Ti
.toInstant());
}
+ public static TimestampData parseTimestampData(String dateStr, String
format, String timezone) {
+ if (dateStr == null || format == null || timezone == null) {
+ return null;
+ }
+
+ TimestampData ts = parseTimestampData(dateStr, format);
+ if (ts == null) {
+ return null;
+ }
+
+ ZonedDateTime utcZoned = ts.toLocalDateTime().atZone(ZoneId.of("UTC"));
Review Comment:
Modified.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]