[ 
https://issues.apache.org/jira/browse/FLINK-36656?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Leonard Xu updated FLINK-36656:
-------------------------------
    Description: 
The original MySQL Table
{code:java}
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 ); {code}

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.
 
 

> Flink CDC treats MySQL Sharding table with boolean type conversion error
> ------------------------------------------------------------------------
>
>                 Key: FLINK-36656
>                 URL: https://issues.apache.org/jira/browse/FLINK-36656
>             Project: Flink
>          Issue Type: Bug
>          Components: Flink CDC
>    Affects Versions: cdc-3.2.0
>            Reporter: Leonard Xu
>            Priority: Major
>             Fix For: cdc-3.3.0, cdc-3.2.1
>
>
> The original MySQL Table
> {code:java}
> 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 ); {code}
> 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.
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to