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

avro schema type missing "logicalType" when time.precision.mode=adaptive

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • 1.0.0.Final
    • mysql-connector
    • None

      When I'm using time.precision.mode=adaptive, Avro Schema generated by Debezium missing logicalType in date, time, datetime columns of MySQL:
      For example I have table like this:

      CREATE TABLE `datatypes` (
          `id`            bigint UNSIGNED NOT NULL AUTO_INCREMENT,
          `T_DATE`        date,
          `T_TIME`        time,
          `T_DATETIME`    datetime,
          `T_TIMESTAMP`   timestamp
      ) ENGINE=InnoDB;
      
      INSERT INTO `datatypes`
      SET
          `T_DATE`        = CURRENT_DATE(),
          `T_TIME`        = CURRENT_TIME(),
          `T_DATETIME`    = NOW(),
          `T_TIMESTAMP`   = CURRENT_TIMESTAMP()
      ;
      

      Here is JSON which debezium produce:

      {
        "type" : "record",
        "name" : "Value",
        "namespace" : "sample_mysql.ingestion.datatypes",
        "fields" : [ {
          "name" : "T_DATE",
          "type" : [ "null", {
            "type" : "int",
            "connect.version" : 1,
            "connect.name" : "io.debezium.time.Date"
          } ],
          "default" : null
        }, {
          "name" : "T_TIME",
          "type" : [ "null", {
            "type" : "long",
            "connect.version" : 1,
            "connect.name" : "io.debezium.time.MicroTime"
          } ],
          "default" : null
        }, {
          "name" : "T_DATETIME",
          "type" : [ "null", {
            "type" : "long",
            "connect.version" : 1,
            "connect.name" : "io.debezium.time.Timestamp"
          } ],
          "default" : null
        }, {
          "name" : "T_TIMESTAMP",
          "type" : [ "null", {
            "type" : "string",
            "connect.version" : 1,
            "connect.name" : "io.debezium.time.ZonedTimestamp"
          } ],
          "default" : null
        } ],
        "connect.version" : 1,
        "connect.name" : "sample_mysql.ingestion.datatypes.Value"
      }
      

      My expectation is date, time and datetime fileds has logicalType represent original datatype, something like this:

      {
        "type" : "record",
        "name" : "Value",
        "namespace" : "sample_mysql.ingestion.datatypes",
        "fields" : [ {
          "name" : "T_DATE",
          "type" : [ "null", {
            "type" : "int",
            "logicalType": "date",
            "connect.version" : 1,
            "connect.name" : "io.debezium.time.Date"
          } ],
          "default" : null
        }, {
          "name" : "T_TIME",
          "type" : [ "null", {
            "type" : "long",
            "logicalType": "time-micros",
            "connect.version" : 1,
            "connect.name" : "io.debezium.time.MicroTime"
          } ],
          "default" : null
        }, {
          "name" : "T_DATETIME",
          "type" : [ "null", {
            "type" : "long",
            "logicalType": "timestamp-micros",
            "connect.version" : 1,
            "connect.name" : "io.debezium.time.Timestamp"
          } ],
          "default" : null
        }, {
          "name" : "T_TIMESTAMP",
          "type" : [ "null", {
            "type" : "string",
            "connect.version" : 1,
            "connect.name" : "io.debezium.time.ZonedTimestamp"
          } ],
          "default" : null
        } ],
        "connect.version" : 1,
        "connect.name" : "sample_mysql.ingestion.datatypes.Value"
      }
      

            Unassigned Unassigned
            dungdm93 Dũng Đặng Minh (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: