ahmedabu98 commented on code in PR #36892:
URL: https://github.com/apache/beam/pull/36892#discussion_r2585929341
##########
sdks/java/extensions/avro/src/main/java/org/apache/beam/sdk/extensions/avro/schemas/utils/AvroUtils.java:
##########
@@ -1186,6 +1196,9 @@ private static org.apache.avro.Schema getFieldSchema(
} else if (SqlTypes.TIMESTAMP.getIdentifier().equals(identifier)) {
baseType =
LogicalTypes.timestampMicros().addToSchema(org.apache.avro.Schema.create(Type.LONG));
+ } else if (Timestamp.IDENTIFIER.equals(identifier)) {
+ baseType = org.apache.avro.Schema.create(Type.LONG);
+ baseType.addProp("logicalType", TIMESTAMP_NANOS_LOGICAL_TYPE);
Review Comment:
I think since we're introducing Timestamp logical type here, we may as well
add that support, like a switch case for precision:
- 3 -> `LogicalTypes.timestampMillis()`
- 6 -> `LogicalTypes.timestampMicros()`
- 9 -> `timestamp-nanos` logical type
- otherwise fail
I'll leave it to your judgement though, I understand this PR is focusing on
the nanos case
--
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]