aromanenko-dev commented on code in PR #17372:
URL: https://github.com/apache/beam/pull/17372#discussion_r851394420


##########
sdks/java/core/src/main/java/org/apache/beam/sdk/values/RowWithGetters.java:
##########
@@ -128,6 +129,14 @@ private <T> T getValue(FieldType type, Object fieldValue, 
@Nullable Integer cach
               cachedMaps.computeIfAbsent(
                   cacheKey, i -> getMapValue(type.getMapKeyType(), 
type.getMapValueType(), map))
           : (T) getMapValue(type.getMapKeyType(), type.getMapValueType(), map);
+    } else if (type.getTypeName().equals(TypeName.DATETIME)) {
+      if (fieldValue instanceof java.time.LocalDate) {
+        Instant instant = java.time.Instant.parse(fieldValue + 
"T00:00:00.00Z");
+        return (T) org.joda.time.Instant.ofEpochMilli(instant.toEpochMilli());
+      } else if (fieldValue instanceof java.time.Instant) {
+        return (T) org.joda.time.Instant.ofEpochMilli(((Instant) 
fieldValue).toEpochMilli());
+      }
+      return (T) fieldValue;

Review Comment:
   I'm not sure it's related to only Avro case but since Beam schema uses joda 
time internally then java time should be converted in any case until we won't 
switch to java time (if we will, of course).



-- 
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]

Reply via email to