You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2022/04/14 16:44:43 UTC
[GitHub] [beam] TheNeuralBit commented on a diff in pull request #17372: [WIP][BEAM-8715] Bump Avro version to 1.9.2
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org