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

Specify decimal precision in schema for MySQL unsigned bigints in precise mode

XMLWordPrintable

    • False
    • None
    • False

      Bug report

      For bug reports, provide this information, please:

      What Debezium connector do you use and what version?

      1.9.6.Final

      What is the connector configuration?

       

      {
          "bigint.unsigned.handling.mode": "precise"
      }

       

       

      What is the captured database version and mode of depoyment?

      MySQL v8.0.32 in Docker

      What behaviour do you expect?

      Given a `bigint unsigned` field, I expect an Avro decimal type with precision 20 and scale 0.

      For example:

      CREATE TABLE t1 (f1 BIGINT UNSIGNED PRIMARY KEY); 

      What behaviour do you see?

      An Avro decimal type with precision 64 and scale 0.

          {
            "name": "before",
            "type": [
              "null",
              {
                "type": "record",
                "name": "Value",
                "fields": [
                  {
                    "name": "f1",
                    "type": {
                      "type": "bytes",
                      "scale": 0,
                      "precision": 64,
                      "connect.version": 1,
                      "connect.parameters": {
                        "scale": "0"
                      },
                      "connect.name": "org.apache.kafka.connect.data.Decimal",
                      "logicalType": "decimal"
                    }
                  }
                ],
                "connect.name": "mysql.test.t1.Value"
              }
            ],
            "default": null
          }, 

      Do you see the same behaviour using the latest relesead Debezium version?

      Yes.

      Do you have the connector logs, ideally from start till finish?

      Not necessary.

      How to reproduce the issue using our tutorial deployment?

      Create a MySQL table with the above schema and observe the result.

      Will submit a PR with a fix shortly.

              Unassigned Unassigned
              benesch Nikhil Benesch (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: