[Bug] Mysql bit 类型字段生成Doris schema 错误
Search before asking
- [X] I had searched in the issues and found no similar issues.
Version
flink-doris-connector-1.18-1.5.2.jar flink: 1.18.1 mysql: 8.0 doris: 2.0.5
What's Wrong?
数据库字段xxx是bit类型,并且不为空。生成Doris预计如下:
CREATE TABLE IF NOT EXISTS `xx`.`xx`(
`id` BIGINT COMMENT '主键',
`xxx` BOOLEAN DEFAULT 'b' 0 '' COMMENT 'xxx'
) UNIQUE KEY(`id`) DISTRIBUTED BY HASH(`id`) BUCKETS AUTO PROPERTIES (
'replication_num' = '1',
'light_schema_change' = 'true'
)
在控制执行SQL后的异常:
Failed to execute sql: org.apache.doris.common.AnalysisException: errCode = 2, detailMessage = Syntax error in line 3:
`xxx` BOOLEAN DEFAULT 'b' 0 '' COMMENT 'xxx'
^
Encountered: INTEGER LITERAL
Expected: COMMA
What You Expected?
CREATE TABLE IF NOT EXISTS `cm`.`xx`(
`id` BIGINT COMMENT '主键',
`xxx` BOOLEAN DEFAULT 'false' COMMENT 'xxx'
) UNIQUE KEY(`id`) DISTRIBUTED BY HASH(`id`) BUCKETS AUTO PROPERTIES (
'replication_num' = '1',
'light_schema_change' = 'true'
)
How to Reproduce?
No response
Anything Else?
No response
Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
mysql是bit,对应flink的是BINARY(⌈(n + 7) / 8⌉),可以用flink的DECODE(binary, string)函数试试
@laizuan can you provide the ddl of mysql source table?
@laizuan can you provide the ddl of mysql source table?
@vinlee19 DDL after desensitization
CREATE TABLE `x`.`xxx` (
`id` bigint NOT NULL COMMENT '主键',
`xxx` bit(1) NOT NULL COMMENT 'xxx',
......other fields
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
The main issue is the mismatch between the default values of MySQL and Doris, resulting in DDL errors. Solutions: 1. Use Flink Connector version 1.5.1. 2. Wait for the next version to fix it.
thks
The main issue is the mismatch between the default values of MySQL and Doris, resulting in DDL errors. Solutions: 1. Use Flink Connector version 1.5.1. 2. Wait for the next version to fix it.
thks