Uploaded image for project: 'Debezium'
  1. Debezium
  2. DBZ-3865

Debezium MySql connector does not capture floating point numbers with the right precision

    XMLWordPrintable

Details

    • False
    • False
    • undefined
    • Hide
      • Create a table in mysql with a FLOAT data type column
      • Start the debezium mysql connector with the required configuration.
      • Insert data into the FLOAT datatype column in the table created.
      • Check if the value entered in mysql is same as the value received by debezium-mysql-connector
      Show
      Create a table in mysql with a FLOAT data type column Start the debezium mysql connector with the required configuration. Insert data into the FLOAT datatype column in the table created. Check if the value entered in mysql is same as the value received by debezium-mysql-connector

    Description

      We have a table that contains a column of float data type in MySQL.
      CREATE TABLE customers (floatColumn float);
      We've observed that floating point values in this column are not accurately captured by the debezium-mysql-connector.
      INSERT INTO customers VALUES (64.1),(5.6);
      SELECT * FROM Customers;
      -------------

      floatColumn

      -------------

      64.1               
      5.6                   

      -------------
      When we query the table in MySQL we can see that the original value and precision is retained in the FLOAT column but with the Debezium mysql connector we receive messages with a different precision:
      64.0999984741211
      5.5999999046325684

      According to the MySQL documentation https://dev.mysql.com/doc/refman/8.0/en/floating-point-types.html FLOAT column is treated as single precision/32bit, but debezium is considering FLOAT as a double precision floating point number and this could be the reason why we are seeing more precision added to values in the FLOAT column causing an inconsistency in the values entered in MySQL and the values received by Debezium.
      https://github.com/debezium/debezium/blob/v1.6.0.Final/debezium-core/src/main/java/io/debezium/jdbc/JdbcValueConverters.java#L193 

      Should FLOAT datatype values be treated as 32 bit/single precision numbers instead of 64bit/double precision numbers by the mysql-connector?

      Attachments

        Activity

          People

            Unassigned Unassigned
            sahithivelma Sahithi Velma (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: