yuxiqian commented on code in PR #3865: URL: https://github.com/apache/flink-cdc/pull/3865#discussion_r1920277704
########## flink-cdc-common/src/main/java/org/apache/flink/cdc/common/utils/SchemaUtils.java: ########## @@ -452,6 +455,43 @@ public static Schema inferWiderSchema(@Nullable Schema lSchema, Schema rSchema) return lSchema.copy(mergedColumns); } + public static void validateMetaSchemaCompatibility(LinkedHashSet<Schema> schemas) { Review Comment: I wonder if is this method really reusable enough to be a utility method? Seems the argument type is quite specific (it must be a `LinkedHashSet` instead of a generic schemas' collection). Also, it didn't return a "Yes or No" boolean and let the caller to decide what to do, but throws an exception if it's incompatible. ########## flink-cdc-common/src/test/java/org/apache/flink/cdc/common/utils/SchemaMergingUtilsTest.java: ########## @@ -1116,6 +1117,27 @@ void testGetLeastCommonType() { MAP)); } + @Test + void testTransformColumn() { + Assertions.assertThatCode( Review Comment: We may use `assertThatThrownBy` as we're surely expecting an error ########## flink-cdc-common/src/main/java/org/apache/flink/cdc/common/utils/SchemaUtils.java: ########## @@ -452,6 +455,43 @@ public static Schema inferWiderSchema(@Nullable Schema lSchema, Schema rSchema) return lSchema.copy(mergedColumns); } + public static void validateMetaSchemaCompatibility(LinkedHashSet<Schema> schemas) { + if (schemas.size() > 1) { + Schema outputSchema = null; + for (Schema schema : schemas) { + isMetaSchemaCompatible(outputSchema, schema); + outputSchema = schema; + } + } + } + + public static void isMetaSchemaCompatible( Review Comment: nit: this is not a pure function returning `Boolean`, so `validateSchemaMetadataCompatibility` might be a better name. -- 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