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/03/21 10:11:32 UTC

[GitHub] [incubator-paimon] JingsongLi commented on a diff in pull request #674: [FLINK-31434] Introduce CDC sink

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


##########
paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/sink/cdc/SchemaChangeProcessFunction.java:
##########
@@ -0,0 +1,64 @@
+/*
+ * 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.paimon.flink.sink.cdc;
+
+import org.apache.paimon.schema.SchemaChange;
+import org.apache.paimon.schema.SchemaManager;
+import org.apache.paimon.utils.Preconditions;
+
+import org.apache.flink.streaming.api.functions.ProcessFunction;
+import org.apache.flink.util.Collector;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * A {@link ProcessFunction} to handle {@link SchemaChange}.
+ *
+ * <p>NOTE: To avoid concurrent schema changes, the parallelism of this {@link ProcessFunction} must
+ * be 1.
+ */
+public class SchemaChangeProcessFunction extends ProcessFunction<SchemaChange, Void> {
+
+    private static final Logger LOG = LoggerFactory.getLogger(SchemaChangeProcessFunction.class);
+
+    private final SchemaManager schemaManager;
+
+    public SchemaChangeProcessFunction(SchemaManager schemaManager) {
+        this.schemaManager = schemaManager;
+    }
+
+    @Override
+    public void processElement(
+            SchemaChange schemaChange, Context context, Collector<Void> collector)
+            throws Exception {
+        Preconditions.checkArgument(

Review Comment:
   alter type is not supported now?



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