StarRocks / starrocks

The world's fastest open query engine for sub-second analytics both on and off the data lakehouse. With the flexibility to support nearly any scenario, StarRocks provides best-in-class performance for multi-dimensional analytics, real-time analytics, and ad-hoc queries. A Linux Foundation project.
https://starrocks.io
Apache License 2.0
9.16k stars 1.82k forks source link

mysql flink sync to starrocks datetime error #51019

Open border opened 2 months ago

border commented 2 months ago

mysql flink starrocks

get error

responseBody: {
    "Status": "INTERNAL_ERROR",
    "Message": "too many filtered rows",
    "ErrorURL": "http://127.0.0.1:8040/api/_load_error_log?file=error_log_794f9870b2fa78e1_847ecb702cf534af"
}
errorLog: Error: Target column count: 3 doesn't match source value column count: 4. Column separator: '\t', Row delimiter: '\n'. Row: 10023 139571hy    2024-06-15T07:53:41 2024-06-15T07:53:41
Error: Target column count: 3 doesn't match source value column count: 4. Column separator: '\t', Row delimiter: '\n'. Row: 10170   ba1387  2024-06-15T11:53:48 2024-06-15T11:53:48
Error: Target column count: 3 doesn't match source value column count: 4. Column separator: '\t', Row delimiter: '\n'. Row: 10250   ba1473  2024-06-15T11:53:52 2024-06-15T11:53:52
Error: Target column count: 3 doesn't match source value column count: 4. Column separator: '\t', Row delimiter: '\n'. Row: 10091   ba1330  2024-06-15T11:53:45 2024-06-15T11:53:45
Error: Target column count: 3 doesn't match source value column count: 4. Column separator: '\t', Row delimiter: '\n'. Row: 10524   ba1745  2024-06-15T11:54:05 2024-06-15T11:54:05
  1. Mysql
    
    create table `user_new`
    (
    `id`               bigint auto_increment,
    `account`          varchar(32)  default ''                not null comment '账号',
    `create_time`      datetime     default CURRENT_TIMESTAMP not null comment '创建时间',
    `update_time`      datetime     default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '修改时间',
    primary key (`id`)
    ) engine = InnoDB

insert into user_new(id, account, create_time, update_time) select id, account, create_time, update_time from users order by rand() limit 10;

2.  flink

-- Flink SQL SET execution.checkpointing.interval = 10s;

-- Flink SQL user_new_source CREATE TABLE user_new_source ( id bigint not null, account varchar(32), create_time TIMESTAMP(0) WITHOUT TIME ZONE, update_time TIMESTAMP(0) WITHOUT TIME ZONE, PRIMARY KEY (id) NOT ENFORCED ) WITH ( 'connector' = 'mysql-cdc', 'hostname' = '127.0.0.1', 'port' = '3305', 'username' = 'root', 'password' = '', 'database-name' = '', 'table-name' = 'user_new' );

-- Flink SQL user_new_sink CREATE TABLE user_new_sink ( id bigint, account varchar(32), create_time TIMESTAMP(0) WITHOUT TIME ZONE, update_time TIMESTAMP(0) WITHOUT TIME ZONE, PRIMARY KEY (id) NOT ENFORCED ) WITH ( 'connector'='starrocks', 'load-url'='127.0.0.1:8030', 'jdbc-url'='jdbc:mysql://127.0.0.1:9030', 'username'='root', 'password'='', 'database-name'='', 'table-name'='user_new' );

insert into user_new_sink (id, account, create_time, update_time) select id, account, cast(create_time as TIMESTAMP(0) WITHOUT TIME ZONE) as create_time, cast(update_time as TIMESTAMP(0) WITHOUT TIME ZONE) as update_time from user_new_source;

3. starrocks

drop table if exists user_new; -- 用户信息表 create table user_new ( id bigint NOT NULL auto_increment, account varchar(32) default '' comment '账号', create_time DATETIME comment '创建时间', update_time DATETIME comment '修改时间' ) ENGINE=OLAP UNIQUE KEY(id) DISTRIBUTED BY HASH(id) BUCKETS 16 PROPERTIES ( "replication_num" = "1" );


### Flink version
Version: 1.20.0
flink-connector-starrocks-1.2.9_flink-1.18.jar

### StarRocks version (Required)

mysql> select current_version(); +-------------------+ | current_version() | +-------------------+ | 3.3.3-312ed45 | +-------------------+ 1 row in set (0.70 sec)

AnemoneIndicum commented 2 months ago

@border Hi, this problem looks like your row or column delimiter determining, and you can use a new separator rather than a default separator to resolve this.

border commented 2 months ago

how to set the separator?

HelloWorldwangjiacheng commented 2 months ago

@border Hello, have you solved this problem? I’m facing the same issue and I'm not sure what’s misconfigured.

HelloWorldwangjiacheng commented 2 months ago

@AnemoneIndicum Hello,Do you know how to solve this problem?