Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-36656

Flink CDC treats MySQL Sharding table with boolean type conversion error

    XMLWordPrintableJSON

Details

    Description

      The original MySQL Table

      CREATE TABLE full_types_0
      (
        id                   BIGINT,
        tiny1_c              TINYINT(1) DEFAULT '0' COMMENT 'test tinyint1',
        boolean_c            BOOLEAN DEFAULT '0' COMMENT 'test boolean'
        PRIMARY KEY (id)
      ) DEFAULT CHARSET=utf8;INSERT INTO full_types_0 VALUES (1 true, true );
      CREATE TABLE full_types_1
      (
        id                   BIGINT,
        tiny1_c              TINYINT(1) DEFAULT '0' COMMENT 'test tinyint1',
        boolean_c            BOOLEAN DEFAULT '0' COMMENT 'test boolean'
        PRIMARY KEY (id)
      ) DEFAULT CHARSET=utf8;INSERT INTO full_types_1 VALUES (1 true, true ); 

      The exception error:

      Caused by: java.lang.NumberFormatException: For input string: "true"

       

      The reason:
      MySQL cdc uses  SHOW CREATE TABLE command  to build its Flink SQL table' schema for existing MySQL table, uses create table DDL statement in binlog to build its Flink SQL table' schema for newly-added table. But BOOLEAN type is a magic type in MySQL world, you can not obtain BOOLEAN type anymore via show create table command, you can only obtain BOOLEAN type in original create table DDL statement.
       
       

      Attachments

        Activity

          People

            leonard Leonard Xu
            leonard Leonard Xu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: