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

[GitHub] [incubator-paimon] tsreaper opened a new pull request, #674: [FLINK-31434] Introduce CDC sink

tsreaper opened a new pull request, #674:
URL: https://github.com/apache/incubator-paimon/pull/674

   ### Purpose
   
   To directly consume changes from Flink CDC connectors, we need a special CDC sink for Paimon.
   
   ### Tests
   
   * FlinkCdcSinkITCase
   
   ### API and Format 
   
   N/A
   
   ### Documentation
   
   N/A
   


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


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

Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
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


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

Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
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?
   
   if it is hard to support alter type.
   Maybe we should support `Wide Type Matching Pattern`, for example, all char and varchar are mapping to string. byte,short,int,long mapping to Long.



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


[GitHub] [incubator-paimon] JingsongLi merged pull request #674: [FLINK-31434] Introduce CDC sink

Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi merged PR #674:
URL: https://github.com/apache/incubator-paimon/pull/674


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


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

Posted by "tsreaper (via GitHub)" <gi...@apache.org>.
tsreaper commented on code in PR #674:
URL: https://github.com/apache/incubator-paimon/pull/674#discussion_r1144294021


##########
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:
   Good point, but we'll have to modify both `SchemaChangeProcessFunction` and `SchemaAwareStoreWriteOperator` and add separate tests. I'd like to implement this in a separate PR.



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