Skip to content

Conversation

@dufeng1010
Copy link

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

@dufeng1010
Copy link
Author

@lvyanquan Could you please help me review this PR

@everhopingandwaiting
Copy link

thanks for your implements


-- create a table which contain column comments
CREATE TABLE columnCommentsTable(
id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY COMMENT '自增主键',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use English because we may have foreign developers.


@Experimental
public static final ConfigOption<Boolean> ENABLE_COLUMN_COMMENTS =
ConfigOptions.key("enable.column.comments")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be better to use "column-comments.enabled"?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, i fix it.

@everhopingandwaiting
Copy link

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
Copy link

everhopingandwaiting commented Jan 29, 2024

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?

@dufeng1010
Copy link
Author

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.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice work

@dufeng1010
Copy link
Author

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

"+I[2000, user_21, Shanghai, 123567891234]"
};
// Step 2: wait the snapshot splits finished reading
Thread.sleep(5000L);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should only modify the necessary code, is it necessary?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sometimes 5 seconds cann't finish read, so i increment sleep time to 10 second.

@lvyanquan
Copy link
Contributor

Hi @dufeng1010 can you help to rebase to master?

@github-actions
Copy link

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 github-actions bot added Stale and removed Stale labels Jul 24, 2024
@github-actions
Copy link

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 github-actions bot added Stale and removed Stale labels Sep 24, 2024
@github-actions
Copy link

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 github-actions bot added the Stale label Nov 24, 2024
@github-actions
Copy link

This pull request has been closed because it has not had recent activity. You could reopen it if you try to continue your work, and anyone who are interested in it are encouraged to continue work on this pull request.

@github-actions github-actions bot closed this Dec 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

3 participants