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

Yash Mayya commented on KAFKA-10457:
------------------------------------

If we want to add a new Connect schema type to accommodate big numbers, it'll 
probably require a small KIP since the types are a part of the public API. This 
ticket probably hasn't received more attention because a workaround exists with 
the 
[Decimal|https://github.com/apache/kafka/blob/c7de30f38bfd6e2d62a0b5c09b5dc9707e58096b/connect/api/src/main/java/org/apache/kafka/connect/data/Decimal.java#L40]
 class when schemas are enabled.

> JsonConverter.toConnectData trims BigInteger to Long for schema-less case
> -------------------------------------------------------------------------
>
>                 Key: KAFKA-10457
>                 URL: https://issues.apache.org/jira/browse/KAFKA-10457
>             Project: Kafka
>          Issue Type: Bug
>          Components: KafkaConnect
>            Reporter: Oleksandr Diachenko
>            Assignee: Oleksandr Diachenko
>            Priority: Critical
>
>  
> When _JsonConverter_ is configured with _schemas.enable=false_ and value, 
> exceeding _Double_ is passed, the result is incorrect since the converter 
> trims it to _Double:_
> {code:java}
> Map<String, Boolean> props = Collections.singletonMap("schemas.enable", 
> false);
> converter.configure(props, true);
> BigInteger value = BigInteger.valueOf(Long.MAX_VALUE).add(new 
> BigInteger("1"));
> String msg = value.toString();
> SchemaAndValue schemaAndValue = converter.toConnectData(TOPIC, 
> msg.getBytes());
> assertNull(schemaAndValue.schema());
> assertEquals(value, schemaAndValue.value());
> {code}
>  
>  Fails with:
>  
> {code:java}
> expected:<9223372036854775808> but was:<-9223372036854775808>
> Expected :9223372036854775808
> Actual :-9223372036854775808
> {code}
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to