-
Bug
-
Resolution: Done
-
Major
-
1.6.1.Final
-
False
-
False
-
undefined
-
-
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?