zhuangchong commented on code in PR #3667:
URL: https://github.com/apache/paimon/pull/3667#discussion_r1665046901


##########
paimon-flink/paimon-flink-cdc/src/test/java/org/apache/paimon/flink/action/cdc/mysql/MySqlSyncTableActionITCase.java:
##########
@@ -325,6 +325,49 @@ private void testSchemaEvolutionMultipleImpl(Statement 
statement) throws Excepti
         waitForResult(expected, table, rowType, primaryKeys);
     }
 
+    @Test
+    @Timeout(60)
+    public void testSchemaEvolutionWithComment() throws Exception {
+        Map<String, String> mySqlConfig = getBasicMySqlConfig();
+        mySqlConfig.put("database-name", DATABASE_NAME);
+        mySqlConfig.put("table-name", "schema_evolution_comment");
+        mySqlConfig.put("debezium.include.schema.comments", "true");
+
+        MySqlSyncTableAction action =
+                syncTableActionBuilder(mySqlConfig)
+                        .withCatalogConfig(
+                                Collections.singletonMap(
+                                        CatalogOptions.METASTORE.key(), 
"test-alter-table"))
+                        .withTableConfig(getBasicTableConfig())
+                        .withPrimaryKeys("_id")
+                        .build();
+        runActionWithDefaultEnv(action);
+
+        try (Statement statement = getStatement()) {
+            statement.executeUpdate(
+                    "ALTER TABLE schema_evolution_comment MODIFY COLUMN v1 
VARCHAR(20) COMMENT 'v1-new'");
+            statement.executeUpdate(
+                    "ALTER TABLE schema_evolution_comment ADD COLUMN v2 INT 
COMMENT 'v2'");
+        }
+
+        waitForTableSchemaResult(
+                "[{\"id\":0,\"name\":\"_id\",\"type\":\"INT NOT 
NULL\",\"description\":\"primary\"},"
+                        + 
"{\"id\":1,\"name\":\"v1\",\"type\":\"VARCHAR(20)\",\"description\":\"v1-new\"},"
+                        + "{\"id\":2,\"name\":\"v2\",\"type\":\"INT NOT 
NULL\",\"description\":\"v2\"}]");
+    }
+
+    private void waitForTableSchemaResult(String excepted) throws Exception {
+
+        FileStoreTable table = getFileStoreTable();
+        while (true) {
+            table = table.copyWithLatestSchema();
+            if 
(JsonSerdeUtil.toFlatJson(table.schema().fields()).equals(excepted)) {
+                break;
+            }
+            Thread.sleep(1000);
+        }
+    }

Review Comment:
   You can refer to the verification methods of other methods under this class, 
such as: inserting a piece of data, verifying the schema and data.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to