healchow commented on code in PR #6128:
URL: https://github.com/apache/inlong/pull/6128#discussion_r991904447
##########
inlong-sort/sort-connectors/mysql-cdc/src/main/java/org/apache/inlong/sort/cdc/mysql/table/MySqlReadableMetadata.java:
##########
@@ -432,7 +427,27 @@ public static Map<String, String> getMysqlType(@Nullable
TableChanges.TableChang
return mysqlType;
}
- private static String getMetaData(SourceRecord record, String
tableNameKey) {
+ /**
+ * get sql type from table schema, represents the jdbc data type
+ * @param tableSchema
+ */
+ public static Map<String, Integer> getSqlType(@Nullable
TableChanges.TableChange tableSchema) {
+ if (tableSchema == null) {
+ return null;
+ }
+ Map<String, Integer> sqlType = new HashMap<>();
+ final Table table = tableSchema.getTable();
+ table.columns()
+ .forEach(
+ column -> {
+ sqlType.put(
+ column.name(),
+ column.jdbcType());
+ });
+ return sqlType;
+ }
Review Comment:
```suggestion
/**
* get sql type from table schema, represents the jdbc data type
*
* @param tableSchema table schema
*/
public static Map<String, Integer> getSqlType(@Nullable
TableChanges.TableChange tableSchema) {
if (tableSchema == null) {
return null;
}
Map<String, Integer> sqlType = new HashMap<>();
final Table table = tableSchema.getTable();
table.columns().forEach(
column -> sqlType.put(column.name(), column.jdbcType())
);
return sqlType;
}
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]