Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-10457

JsonConverter.toConnectData trims BigInteger to Long for schema-less case

    XMLWordPrintableJSON

Details

    • Bug
    • Status: In Progress
    • Critical
    • Resolution: Unresolved
    • None
    • None
    • connect
    • None

    Description

       

      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:

      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());
      

       

       Fails with:

       

      expected:<9223372036854775808> but was:<-9223372036854775808>
      Expected :9223372036854775808
      Actual :-9223372036854775808
      

       

       

      Attachments

        Activity

          People

            swasnik@confluent.io Sudesh Wasnik
            odiachenko Oleksandr Diachenko
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated: