You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Martin Sillence (Jira)" <ji...@apache.org> on 2021/10/20 15:50:00 UTC
[jira] [Comment Edited] (AVRO-2028) Specific Data,
newBuilder(existingInstance) fails for BigDecimal
[ https://issues.apache.org/jira/browse/AVRO-2028?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17431312#comment-17431312 ]
Martin Sillence edited comment on AVRO-2028 at 10/20/21, 3:49 PM:
------------------------------------------------------------------
One minor point it works with my build of 1.12.0-SNAPSHOT not the 1.11.0-SNAPSHOT #Wed Aug 19 21:39:36 UTC 2020 SHA1 8ff660f1b70b588051257aced9ef6bf7a7b611ff
The fix was merged 15 days ago which would have been the 5th October and the published snapshot I can see is 19 August so that hopefully it will be in the next 11 release
was (Author: msillence):
One minor point it works with my build of 1.12.0-SNAPSHOT not the 1.11.0-SNAPSHOT #Wed Aug 19 21:39:36 UTC 2020 SHA1 8ff660f1b70b588051257aced9ef6bf7a7b611ff
Which is odd as what we thought was the fix was merged 15 days ago which would have been the 5th
> Specific Data, newBuilder(existingInstance) fails for BigDecimal
> ----------------------------------------------------------------
>
> Key: AVRO-2028
> URL: https://issues.apache.org/jira/browse/AVRO-2028
> Project: Apache Avro
> Issue Type: Bug
> Components: java
> Affects Versions: 1.8.2
> Reporter: Adrian McCague
> Priority: Major
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> Using 1.8.2-rc3
> When attempting to use:
> {{MyType.newBuilder(existingType)}}
> With a field of type {{Union}}:
> {code}
> ["null",{"type":"bytes","logicalType":"decimal","precision":20,"scale":8}]
> {code}
> I get the following exception:
> {code}
> org.apache.avro.UnresolvedUnionException: Not in union ["null",{"type":"bytes","logicalType":"decimal","precision":20,"scale":8}]: 12000.00000000
> at org.apache.avro.generic.GenericData.resolveUnion(GenericData.java:740)
> at org.apache.avro.generic.GenericData.deepCopyRaw(GenericData.java:1146)
> at org.apache.avro.generic.GenericData.deepCopy(GenericData.java:1062)
> at MyType$Builder.<init>
> {code}
> I suspected it may be related but also noticed in the generated Specific Data class the following:
> {code}
> private static final org.apache.avro.Conversion<?>[] conversions =
> new org.apache.avro.Conversion<?>[] {
> null,
> TIMESTAMP_CONVERSION,
> null,
> null, // Should be DECIMAL_CONVERSION
> null,
> null,
> null,
> null,
> null
> };
> {code}
> ie, the conversion was missing.
> Adding this by hand however did not resolve the issue. I will add this as another issue.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)