You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "dawidwys (via GitHub)" <gi...@apache.org> on 2023/02/01 11:04:43 UTC

[GitHub] [flink] dawidwys commented on a diff in pull request #21594: [FLINK-30483] [Formats] [Avro] Add avro format support for TIMESTAMP_LTZ

dawidwys commented on code in PR #21594:
URL: https://github.com/apache/flink/pull/21594#discussion_r1093073075


##########
flink-formats/flink-avro/src/main/java/org/apache/flink/formats/avro/typeutils/AvroSchemaConverter.java:
##########
@@ -363,6 +368,23 @@ public static Schema convertToSchema(LogicalType logicalType, String rowName) {
                 }
                 Schema timestamp = avroLogicalType.addToSchema(SchemaBuilder.builder().longType());
                 return nullable ? nullableSchema(timestamp) : timestamp;
+            case TIMESTAMP_WITH_LOCAL_TIME_ZONE:
+                final LocalZonedTimestampType localZonedTimestampType =
+                        (LocalZonedTimestampType) logicalType;
+                precision = localZonedTimestampType.getPrecision();
+                org.apache.avro.LogicalType avrolocalLogicalType;
+                if (precision <= 3) {
+                    avrolocalLogicalType = LogicalTypes.localTimestampMillis();
+                } else {
+                    throw new IllegalArgumentException(
+                            "Avro does not support LocalDateTime type "

Review Comment:
   +1, but I'd use `TIMESTAMP_LTZ`



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org