wuchong commented on code in PR #23511:
URL: https://github.com/apache/flink/pull/23511#discussion_r1359881451
##########
flink-formats/flink-avro/src/test/java/org/apache/flink/formats/avro/utils/AvroTestUtils.java:
##########
@@ -102,6 +104,13 @@ public final class AvroTestUtils {
.setTypeTimestampMillis(Instant.parse("2014-03-01T12:12:12.321Z"))
.setTypeTimestampMicros(
Instant.ofEpochSecond(0).plus(123456L,
ChronoUnit.MICROS))
+ .setTypeLocalTimestampMillis(
+ LocalDateTime.ofInstant(
Review Comment:
nit: Please use `LocalDateTime.parse("2014-03-01T12:12:12.32")` to construct
a `LocalDateTime`.
##########
flink-formats/flink-avro/src/main/java/org/apache/flink/formats/avro/AvroToRowDataConverters.java:
##########
@@ -201,6 +204,9 @@ private static TimestampData convertToTimestamp(Object
object) {
millis = (Long) object;
} else if (object instanceof Instant) {
millis = ((Instant) object).toEpochMilli();
+ } else if (object instanceof LocalDateTime) {
+ Instant instant = ((LocalDateTime)
object).toInstant(ZoneOffset.UTC);
+ millis = instant.toEpochMilli();
Review Comment:
`TimestampData.fromLocalDateTime(object)`.
--
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]