[ https://issues.apache.org/jira/browse/BEAM-4454?focusedWorklogId=171598&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-171598 ]
ASF GitHub Bot logged work on BEAM-4454: ---------------------------------------- Author: ASF GitHub Bot Created on: 03/Dec/18 14:33 Start Date: 03/Dec/18 14:33 Worklog Time Spent: 10m Work Description: kanterov commented on a change in pull request #7181: [BEAM-4454] Add more AVRO utilities to convert between Beam and Avro. URL: https://github.com/apache/beam/pull/7181#discussion_r238261525 ########## File path: sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/utils/AvroUtils.java ########## @@ -150,9 +439,20 @@ public static Object convertAvroFieldStrict( @Nonnull org.apache.avro.Schema avroSchema, @Nonnull Schema.FieldType fieldType) { - org.apache.avro.Schema unwrapped = unwrapNullableSchema(avroSchema); + TypeWithNullability type = new TypeWithNullability(avroSchema); + LogicalType logicalType = LogicalTypes.fromSchema(type.type); + if (logicalType != null) { + if (logicalType instanceof LogicalTypes.Decimal) { + BigDecimal bigDecimal = + new Conversions.DecimalConversion() + .fromBytes((ByteBuffer) value, type.type, logicalType); Review comment: As I understand, we need to do `.duplicate()` for the same reason as in `convertBytesStrict` because `fromBytes` is implemented as: ``` int scale = ((LogicalTypes.Decimal) type).getScale(); // always copy the bytes out because BigInteger has no offset/length ctor byte[] bytes = new byte[value.remaining()]; value.get(bytes); return new BigDecimal(new BigInteger(bytes), scale); ``` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 171598) Time Spent: 4h 50m (was: 4h 40m) > Provide automatic schema registration for AVROs > ----------------------------------------------- > > Key: BEAM-4454 > URL: https://issues.apache.org/jira/browse/BEAM-4454 > Project: Beam > Issue Type: Sub-task > Components: sdk-java-core > Reporter: Reuven Lax > Assignee: Reuven Lax > Priority: Major > Time Spent: 4h 50m > Remaining Estimate: 0h > > Need to make sure this is a compatible change -- This message was sent by Atlassian JIRA (v7.6.3#76005)