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

Sean Busbey commented on AVRO-1895:
-----------------------------------

patch looks good [~cutting]. a few points of feedback:

* could we update the javadoc for deepcopy to call out that logical types may 
go through a round trip of conversion? Just to make sure folks are aware in the 
case of expensive conversions.
* could we update the test to include a logical type nested in a complex type 
deeper than just a containing record? looking at the patch, I believe it should 
work properly but I'd rather avoid having that large of a gap.
* could we include a test that we maintain expected behavior for a field with a 
logical type when there are no conversions present?

> 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
>         Attachments: 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