You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Randall Hauch (Jira)" <ji...@apache.org> on 2020/06/11 01:41:00 UTC

[jira] [Updated] (KAFKA-9067) BigDecimal conversion unnecessarily enforces the scale

     [ https://issues.apache.org/jira/browse/KAFKA-9067?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Randall Hauch updated KAFKA-9067:
---------------------------------
    Labels: needs-kip  (was: )

> BigDecimal conversion unnecessarily enforces the scale 
> -------------------------------------------------------
>
>                 Key: KAFKA-9067
>                 URL: https://issues.apache.org/jira/browse/KAFKA-9067
>             Project: Kafka
>          Issue Type: Bug
>          Components: KafkaConnect
>    Affects Versions: 2.3.0
>            Reporter: Piotr Smolinski
>            Priority: Major
>              Labels: needs-kip
>
> In Kafka Connect schema framework it is possible to use fixed point decimal numbers mapped as logical type Decimal. The type is related to Avro defined logical type. When the type is used, the scale value is stored in the schema definition (later it might end in Avro schema) and the unscaled value is stored as integer of unbounded size.
> The problem arises when the decimal value to decode has different scale than the one declared in the schema. During conversion to Avro or JSON using standard converters the operation fails with DataException.
> The proposed solution is to use setScale method to adapt the scale to the correct value and provide rounding mode as parameter to the schema:
> https://docs.oracle.com/javase/8/docs/api/java/math/BigDecimal.html#setScale-int-java.math.RoundingMode-
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)