TheNeuralBit commented on code in PR #17372:
URL: https://github.com/apache/beam/pull/17372#discussion_r850621495


##########
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 think this logic should be in the Avro getters, instead of branching on 
this instance check.



##########
sdks/java/core/build.gradle:
##########
@@ -105,5 +105,6 @@ dependencies {
   shadowTest library.java.avro_tests
   shadowTest library.java.zstd_jni
   shadowTest library.java.jamm
+  shadowTest library.java.xz_java

Review Comment:
   Why do we need to add this?



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