flink-cdc icon indicating copy to clipboard operation
flink-cdc copied to clipboard

[enhancement] add param which contain column comments of source table field

Open dufeng1010 opened this issue 2 years ago • 7 comments

add param which contain column comments of source table field. fix #3007

dufeng1010 avatar Jan 28 '24 10:01 dufeng1010

@lvyanquan Could you please help me review this PR

dufeng1010 avatar Jan 28 '24 11:01 dufeng1010

thanks for your implements

everhopingandwaiting avatar Jan 28 '24 14:01 everhopingandwaiting

In my testing, I found that when modifying both the field type and field comments of a table simultaneously, the comment information is not synchronized to the target database.

test case


CREATE TABLE IF NOT EXISTS test_flinkcdc1
(
    XFID             varchar(64)                          not null comment 'Primary key ID'
        primary key,
    CXYY             text                                 null,
    CXSJ             datetime                             null comment 'Cancellation time',
    CREATE_TIME      timestamp  default CURRENT_TIMESTAMP null comment 'Creation time',
    UPDATE_TIME      timestamp  default CURRENT_TIMESTAMP null comment 'Modification time',
    CREATE_USER_ID   varchar(64)                          null comment 'Creator ID',
    CREATE_USER_NAME varchar(20)                          null comment 'Creator name',
    CREATE_ORG_CODE  varchar(64)                          null comment 'Creator organization code',
    CREATE_ORG_NAME  varchar(255)                         null comment 'Creator organization name',
    UPDATE_USER_ID   varchar(64)                          null comment 'Updater ID',
    UPDATE_USER_NAME varchar(20)                          null comment 'Updater name',
    UPDATE_ORG_CODE  varchar(64)                          null comment 'Updater organization code',
    UPDATE_ORG_NAME  varchar(255)                         null comment 'Updater organization name',
    DELETED          varchar(2)                           null comment 'Deletion flag; 0-Normal, 1-Deleted'
)
    comment 'Test Flink CDC 3 table' collate = utf8mb4_general_ci;

ALTER TABLE test_flinkcdc1 ADD COLUMN test11 text comment 'Test added field sync';

ALTER TABLE test_flinkcdc1 ADD COLUMN test12 text comment 'Test added field sync 2';
ALTER TABLE test_flinkcdc1 MODIFY COLUMN test12 text comment 'Test added field sync 2 modified type';

ALTER TABLE test_flinkcdc1 ADD COLUMN test13 text comment 'Test added field sync 3';

###

-- targetdb : auto-generated definition
CREATE TABLE test_flinkcdc1
(
    XFID             varchar(192)     not null comment 'Primary key ID',
    CXYY             varchar(1048576) null,
    CXSJ             datetime         null comment 'Cancellation time',
    CREATE_TIME      datetime         null comment 'Creation time',
    UPDATE_TIME      datetime         null comment 'Modification time',
    CREATE_USER_ID   varchar(192)     null comment 'Creator ID',
    CREATE_USER_NAME varchar(60)      null comment 'Creator name',
    CREATE_ORG_CODE  varchar(192)     null comment 'Creator organization code',
    CREATE_ORG_NAME  varchar(765)     null comment 'Creator organization name',
    UPDATE_USER_ID   varchar(192)     null comment 'Updater ID',
    UPDATE_USER_NAME varchar(60)      null comment 'Updater name',
    UPDATE_ORG_CODE  varchar(192)     null comment 'Updater organization code',
    UPDATE_ORG_NAME  varchar(765)     null comment 'Updater organization name',
    DELETED          varchar(6)       null comment 'Deletion flag; 0-Normal, 1-Deleted',
    test11           varchar(30)      null comment 'Test added field sync',
    test12           varchar(30)      null comment 'Test added field sync 2',
    test13           varchar(1048576) null comment 'Test added field sync 3'
)
    comment 'OLAP' engine = StarRocks;

error in ALTER TABLE test_flinkcdc1 MODIFY COLUMN test12 text comment 'Test added field sync 2 modified type';

everhopingandwaiting avatar Jan 29 '24 07:01 everhopingandwaiting

For starRocks db, it was observed that the comment for the table name in the target database is fixed to "OLAP." Is it possible to also synchronize the table comment from the source table?

everhopingandwaiting avatar Jan 29 '24 08:01 everhopingandwaiting

For starRocks db, it was observed that the comment for the table name in the target database is fixed to "OLAP." Is it possible to also synchronize the table comment from the source table?

@everhopingandwaiting i try to fix it.

dufeng1010 avatar Jan 29 '24 09:01 dufeng1010

@lvyanquan @everhopingandwaiting Compilation failure is not related to the submitted code

dufeng1010 avatar Jan 31 '24 01:01 dufeng1010

Hi @dufeng1010 can you help to rebase to master?

lvyanquan avatar May 24 '24 09:05 lvyanquan

This pull request has been automatically marked as stale because it has not had recent activity for 60 days. It will be closed in 30 days if no further activity occurs.

github-actions[bot] avatar Jul 24 '24 00:07 github-actions[bot]