You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@avro.apache.org by "Emmanuel Brard (Jira)" <ji...@apache.org> on 2023/02/07 10:37:00 UTC
[jira] (AVRO-3654) BigDecimal not supported in GenericData.getSchemaName() method
[ https://issues.apache.org/jira/browse/AVRO-3654 ]
Emmanuel Brard deleted comment on AVRO-3654:
--------------------------------------
was (Author: ebrard):
Thanks for the suggestion, using the singleton doesn't work either, same exception:
Caused by: java.lang.Exception: Unsupported Avro type UNION
> BigDecimal not supported in GenericData.getSchemaName() method
> --------------------------------------------------------------
>
> Key: AVRO-3654
> URL: https://issues.apache.org/jira/browse/AVRO-3654
> Project: Apache Avro
> Issue Type: Improvement
> Components: java
> Affects Versions: 1.11.1
> Reporter: Emmanuel Brard
> Priority: Critical
>
> When trying to add a `GenericRecord` in a Java set, the hashcode computation code is called.
> If a Union contains a decimal logical type which is mapped with a `BigDecimal` in Java, the call to `add` will fail with:
> {code}
> Caused by: org.apache.avro.AvroRuntimeException: Unknown datum type java.math.BigDecimal: 4042030.00
> at org.apache.avro.generic.GenericData.getSchemaName(GenericData.java:933)
> at org.apache.avro.generic.GenericData.resolveUnion(GenericData.java:892)
> at org.apache.avro.generic.GenericData.hashCode(GenericData.java:1113)
> at org.apache.avro.generic.GenericData.hashCodeAdd(GenericData.java:1127)
> at org.apache.avro.generic.GenericData.hashCode(GenericData.java:1103)
> at org.apache.avro.generic.GenericData.hashCode(GenericData.java:1113)
> at org.apache.avro.generic.GenericData.hashCodeAdd(GenericData.java:1127)
> at org.apache.avro.generic.GenericData.hashCode(GenericData.java:1103)
> at org.apache.avro.generic.GenericData$Record.hashCode(GenericData.java:292)
> at java.base/java.util.HashMap.hash(HashMap.java:338)
> at java.base/java.util.HashMap.put(HashMap.java:610)
> at java.base/java.util.HashSet.add(HashSet.java:221)
> {code}
> The method `getSchemaName` does not handle the BigDecimal Java type, which is used by the `DecimalConversion`.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)