[ 
https://issues.apache.org/jira/browse/AVRO-1895?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15455443#comment-15455443
 ] 

ASF subversion and git services commented on AVRO-1895:
-------------------------------------------------------

Commit 9cfd33870092d5c16a35b523305950215d1feabe in avro's branch 
refs/heads/master from [~cutting]
[ https://git-wip-us.apache.org/repos/asf?p=avro.git;h=9cfd338 ]

AVRO-1895. Fix deepCopy() to get correct logical type conversion.

(cherry picked from commit 9456db01859dd3619fb09a6d4205ab433b357b02)


> DeepCopy does not work with logical types
> -----------------------------------------
>
>                 Key: AVRO-1895
>                 URL: https://issues.apache.org/jira/browse/AVRO-1895
>             Project: Avro
>          Issue Type: Improvement
>          Components: logical types
>    Affects Versions: 1.8.1
>            Reporter: Taras Bobrovytsky
>            Assignee: Doug Cutting
>            Priority: Critical
>             Fix For: 1.9.0, 1.8.2
>
>         Attachments: AVRO-1895.patch, AVRO-1895.patch, AVRO-1895.patch, 
> AVRO-1895.patch
>
>
> AvroSchema is taken from a compiled avsc file which contains a decimal field.
> {code}
> AvroSchema.Builder builder = AvroSchema.newBuilder();
> BigDecimal bd = new BigDecimal(new BigInteger("155"), 3);
> campaignBuilder.setDecimalField(bd);
> AvroSchema source = builder.build();
> //This line causes an exception
> AvroSchema.Builder builder1 = AvroSchema.newBuilder(source);
> {code}
> Exception:
> {code}
> InvocationTargetException: java.math.BigDecimal cannot be cast to 
> java.nio.ByteBuffer
> {code}
> The same failure happens with GenericData as well:
> {code}
> GenericRecord copy = GenericData.get().deepCopy(AvroSchema.getClassSchema(), 
> source);
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to