lvyanquan commented on code in PR #3636: URL: https://github.com/apache/flink-cdc/pull/3636#discussion_r1798837548
########## flink-cdc-runtime/src/main/java/org/apache/flink/cdc/runtime/operators/schema/coordinator/SchemaDerivation.java: ########## @@ -343,23 +348,14 @@ private List<SchemaChangeEvent> handleCreateTableEvent( return schemaChangeEvents; } - private DataType getWiderType(DataType thisType, DataType thatType) { - if (thisType.equals(thatType)) { - return thisType; - } - if (thisType.is(DataTypeFamily.INTEGER_NUMERIC) - && thatType.is(DataTypeFamily.INTEGER_NUMERIC)) { - return DataTypes.BIGINT(); - } - if (thisType.is(DataTypeFamily.CHARACTER_STRING) - && thatType.is(DataTypeFamily.CHARACTER_STRING)) { - return DataTypes.STRING(); - } - if (thisType.is(DataTypeFamily.APPROXIMATE_NUMERIC) - && thatType.is(DataTypeFamily.APPROXIMATE_NUMERIC)) { - return DataTypes.DOUBLE(); + private DataType getWiderType(String columnName, DataType thisType, DataType thatType) { + try { + return SchemaUtils.inferWiderType(thisType, thatType); + } catch (IllegalStateException e) { + throw new IllegalStateException( + String.format( + "Incompatible types found for column `%s': \"%s\" and \"%s\"", Review Comment: Incompatible types found for column `%s`: \"%s\" and \"%s\" -- 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