You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@paimon.apache.org by "JingsongLi (via GitHub)" <gi...@apache.org> on 2023/07/07 11:28:48 UTC

[GitHub] [incubator-paimon] JingsongLi commented on a diff in pull request #1521: [bug][flink] CDC schema evolution should pass catalog information

JingsongLi commented on code in PR #1521:
URL: https://github.com/apache/incubator-paimon/pull/1521#discussion_r1255682213


##########
paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/sink/cdc/UpdatedDataFieldsProcessFunction.java:
##########
@@ -107,17 +122,22 @@ private List<SchemaChange> extractSchemaChanges(List<DataField> updatedDataField
     private void applySchemaChange(SchemaChange schemaChange) throws Exception {
         if (schemaChange instanceof SchemaChange.AddColumn) {
             try {
-                schemaManager.commitChanges(schemaChange);
-            } catch (Catalog.ColumnAlreadyExistException e) {
-                // This is normal. For example when a table is split into multiple database tables,
-                // all these tables will be added the same column. However schemaManager can't
-                // handle duplicated column adds, so we just catch the exception and log it.
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug(
-                            "Failed to perform SchemaChange.AddColumn {}, "
-                                    + "possibly due to duplicated column name",
-                            schemaChange,
-                            e);
+                catalog.alterTable(identifier, schemaChange, false);
+            } catch (Exception e) {
+                if (e.getCause() instanceof Catalog.ColumnAlreadyExistException) {

Review Comment:
   Consider to modify alterTable interface:
   ```
   void alterTable(Identifier identifier, List<SchemaChange> changes, boolean ignoreIfNotExists)
               throws TableNotExistException, ColumnAlreadyExistException, ColumnNotExistException;
   ```



-- 
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: issues-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org