You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "Oleksandr Diachenko (Jira)" <ji...@apache.org> on 2020/09/02 04:40:00 UTC
[jira] [Created] (KAFKA-10457) JsonConverter.toConnectData trims
BigInteger to Double for schema-less case
Oleksandr Diachenko created KAFKA-10457:
-------------------------------------------
Summary: JsonConverter.toConnectData trims BigInteger to Double 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
Fix For: 2.7.0
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.3.4#803005)