the-other-tim-brown commented on code in PR #11070:
URL: https://github.com/apache/hudi/pull/11070#discussion_r1595526953
##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/sources/helpers/ProtoConversionUtil.java:
##########
@@ -402,7 +438,21 @@ private static Object convertObject(Schema schema, Object
value) {
if (value instanceof Message) {
// check if this is a Timestamp
if
(LogicalTypes.timestampMicros().equals(schema.getLogicalType())) {
- return Timestamps.toMicros((Timestamp) value);
+ if (value instanceof Timestamp) {
+ return Timestamps.toMicros((Timestamp) value);
+ } else if (value instanceof DynamicMessage) {
+ Timestamp.Builder builder = Timestamp.newBuilder();
+ ((DynamicMessage)
value).getAllFields().forEach((fieldDescriptor, fieldValue) -> {
+ if
(fieldDescriptor.getFullName().equals("google.protobuf.Timestamp.seconds")) {
+ builder.setSeconds((Long) fieldValue);
+ } else if
(fieldDescriptor.getFullName().equals("google.protobuf.Timestamp.nanos")) {
+ builder.setNanos((Integer) fieldValue);
+ }
Review Comment:
Seconds is seconds since epoch and nanos is nanos within the second so the
units are as expected
--
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]