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

ASF subversion and git services commented on NIFI-5662:
-------------------------------------------------------

Commit 023f0c41cec8aca798f17cb5f9ef13c589db23f8 in nifi's branch 
refs/heads/master from gkkorir
[ https://git-wip-us.apache.org/repos/asf?p=nifi.git;h=023f0c4 ]

NIFI-5662 - Support for generic fixed when using decimal logical type

Signed-off-by: Pierre Villard <[email protected]>

This closes #3175.


> AvroTypeUtil Decimal support using Fixed Error
> ----------------------------------------------
>
>                 Key: NIFI-5662
>                 URL: https://issues.apache.org/jira/browse/NIFI-5662
>             Project: Apache NiFi
>          Issue Type: Improvement
>          Components: Core Framework
>    Affects Versions: 1.7.1
>         Environment: RHEL 7.5
> JDK 1.8.182
>            Reporter: Gideon Korir
>            Priority: Major
>
> When the decimal is specified as fixed in the Avro schema, AvroTypeUtils 
> converts the decimal into a ByteBuffer instead of a GenericFixed.
> The code:
> {code:java}
> return new Conversions.DecimalConversion().toBytes(decimal, fieldSchema, 
> logicalType)
> {code}
>  Should be:
> {code:java}
> return fieldSchema.getType() == Type.BYTES
> ? new Conversions.DecimalConversion().toBytes(decimal, fieldSchema, 
> logicalType)
> : new Conversions.DecimalConversion().toFixed(decimal, fieldSchema, 
> logicalType);
> {code}
> The former causes the AvroRecordSetWriter to fail with the error: 
> _org.apache.avro.file.DataFileWriter$AppendWriteException: 
> java.lang.ClassCastException: java.nio.HeapByteBuffer cannot be cast to 
> org.apache.avro.generic.GenericFixed_



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to