lvyanquan commented on code in PR #3215:
URL: https://github.com/apache/flink-cdc/pull/3215#discussion_r1565217554


##########
flink-cdc-connect/flink-cdc-pipeline-connectors/flink-cdc-pipeline-connector-doris/src/main/java/org/apache/flink/cdc/connectors/doris/sink/DorisSchemaChangeManager.java:
##########
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.cdc.connectors.doris.sink;
+
+import org.apache.doris.flink.catalog.doris.FieldSchema;
+import org.apache.doris.flink.cfg.DorisOptions;
+import org.apache.doris.flink.exception.IllegalArgumentException;
+import org.apache.doris.flink.sink.schema.SchemaChangeManager;
+
+import java.io.IOException;
+
+/** Provides schema change operations based on {@link SchemaChangeManager}. */
+public class DorisSchemaChangeManager extends SchemaChangeManager {
+    public DorisSchemaChangeManager(DorisOptions dorisOptions) {
+        super(dorisOptions);
+    }
+
+    private static final String MODIFY_COLUMN_DDL = "ALTER TABLE %s MODIFY 
COLUMN %s %s";
+
+    public boolean alterColumn(
+            String database, String table, String columnName, String 
newColumnType)
+            throws IOException, IllegalArgumentException {
+        String tableIdentifier = String.format("%s.%s", database, table);
+        FieldSchema alterFieldSchema = new FieldSchema(columnName, 
newColumnType, "");
+
+        String alterColumnDDL =
+                String.format(
+                        MODIFY_COLUMN_DDL,
+                        tableIdentifier,
+                        columnName,
+                        alterFieldSchema.getTypeString());
+
+        try {
+            return this.schemaChange(
+                    database, table, buildRequestParam(true, columnName), 
alterColumnDDL);
+        } catch (RuntimeException ex) {
+            if (ex.getMessage().contains("Nothing is changed. please check 
your alter stmt.")) {

Review Comment:
   Got it. 
   And I have checked the history of this code and it has been a long time 
since it was modified. It looks quite stable, so adding a comment to describe 
the source is enough.



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