MOBIN-F commented on code in PR #3749:
URL: https://github.com/apache/flink-cdc/pull/3749#discussion_r1909895338


##########
flink-cdc-composer/src/test/java/org/apache/flink/cdc/composer/flink/FlinkPipelineTransformITCase.java:
##########
@@ -370,6 +371,99 @@ void 
testMultiTransformMissingProjection(ValuesDataSink.SinkApi sinkApi) throws
                         
"DataChangeEvent{tableId=default_namespace.default_schema.mytable2, before=[4, 
DERRIDA, 25, student], after=[], op=DELETE, meta=()}"));
     }
 
+    @ParameterizedTest
+    @EnumSource
+    void testMultiTransformSchemaColumnsCompatibility(ValuesDataSink.SinkApi 
sinkApi) {
+        TransformDef nullProjection =
+                new TransformDef(
+                        "default_namespace.default_schema.mytable2",
+                        null,
+                        "age < 18",
+                        null,
+                        null,
+                        null,
+                        null,
+                        null);
+
+        TransformDef emptyProjection =
+                new TransformDef(
+                        "default_namespace.default_schema.mytable2",
+                        "",
+                        "age < 18",
+                        null,
+                        null,
+                        null,
+                        null,
+                        null);
+
+        TransformDef asteriskProjection =
+                new TransformDef(
+                        "default_namespace.default_schema.mytable2",
+                        "*",
+                        "age < 18",
+                        null,
+                        null,
+                        null,
+                        null,
+                        null);
+
+        List<TransformDef> transformDefList =
+                Arrays.asList(nullProjection, emptyProjection, 
asteriskProjection);
+
+        for (TransformDef transformDef : transformDefList) {
+            assertThatThrownBy(
+                            () ->
+                                    runGenericTransformTest(
+                                            sinkApi,
+                                            Arrays.asList(
+                                                    transformDef,
+                                                    new TransformDef(
+                                                            
"default_namespace.default_schema.mytable2",
+                                                            // reference part 
column
+                                                            "id,UPPER(name) AS 
name",
+                                                            "age >= 18",
+                                                            null,
+                                                            null,
+                                                            null,
+                                                            null,
+                                                            null)),
+                                            Collections.emptyList()))
+                    .rootCause()
+                    .isExactlyInstanceOf(IllegalStateException.class)
+                    .hasMessage(
+                            "Unable to merge schema columns={`id` 
BIGINT,`name` VARCHAR(255),`age` TINYINT,`description` STRING}, primaryKeys=id, 
options=() "
+                                    + "and columns={`id` BIGINT,`name` 
STRING}, primaryKeys=id, options=() with different column counts.");
+        }
+
+        for (TransformDef transformDef : transformDefList) {
+            assertThatThrownBy(

Review Comment:
   Thanks for the review!!
   I modified the test case to be more rigorous, please help review again~
   Deleted redundant assertThatThrownBy and I shouldn't use 
runGenericTransformTest in for loop, which will cause duplicate data events.



-- 
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-unsubscr...@flink.apache.org

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

Reply via email to